Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/nfn' into nfn
Browse files Browse the repository at this point in the history
  • Loading branch information
basilkohler committed Apr 1, 2014
2 parents 9202a7d + 69f0e24 commit bc19ac8
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 4 deletions.
24 changes: 20 additions & 4 deletions krivine-common.c
Expand Up @@ -309,11 +309,27 @@ ccnl_receive_content_synchronous(struct ccnl_relay_s *ccnl, struct ccnl_interest
if(ccnl_prefix_cmp(c->name, md, interest->prefix, CMP_MATCH)){
return c;
}
else{
ccnl_core_RX(ccnl, i, buf+14, len-14,
&src_addr.sa, sizeof(src_addr.eth));
else{//else --> normal packet handling???
if (src_addr.sa.sa_family == AF_INET) {
ccnl_core_RX(ccnl, i, buf, len,
&src_addr.sa, sizeof(src_addr.ip4));
}
#ifdef USE_ETHERNET
else if (src_addr.sa.sa_family == AF_PACKET) {
if (len > 14){
ccnl_core_RX(ccnl, i, buf+14, len-14,
&src_addr.sa, sizeof(src_addr.eth));
}
}
#endif
#ifdef USE_UNIXSOCKET
else if (src_addr.sa.sa_family == AF_UNIX) {
ccnl_core_RX(ccnl, i, buf, len,
&src_addr.sa, sizeof(src_addr.ux));
}
#endif
}
//else --> normal packet handling???

}
}
}
Expand Down
32 changes: 32 additions & 0 deletions krivine.c
Expand Up @@ -177,6 +177,38 @@ char *cs_in_name; // currently only one for incoming msgs

char *global_dict;

// ----------------------------------------------------------------------
struct stack_element_s{
char *content;
struct stack_element_s *next;
};

void push_to_stack(struct stack_element_s **top, char *content){
struct stack_element_s *h = malloc(sizeof(struct stack_element_s));
if(*top != NULL){
h->next = *top;
}else{
h->next = NULL;
}
h->content = strdup(content);
*top = h;
}

char *pop_from_stack(struct stack_element_s **top){
struct stack_element_s *h = *top;
if(*top != NULL){
char *res = h->content;
if(h->next == NULL){
*top = NULL;
}else{
*top = h->next;
}
free(h);
return res;
}
return NULL;
}

// ----------------------------------------------------------------------

int iscontent(char *cp){
Expand Down

0 comments on commit bc19ac8

Please sign in to comment.