int ccnl_nfn_RX_result(struct ccnl_relay_s *relay, struct ccnl_face_s *from, struct ccnl_content_s *c) { struct ccnl_interest_s *i_it = NULL; int found = 0; DEBUGMSG_CFWD(INFO, "data in rx result %.*s\n", c->pkt->contlen, c->pkt->content); TRACEIN(); #ifdef USE_NACK if (ccnl_nfnprefix_contentIsNACK(c)) { ccnl_nfn_nack_local_computation(relay, c->pkt->buf, c->pkt->pfx, from, c->pkt->pfx->suite); return -1; } #endif // USE_NACK for (i_it = relay->pit; i_it;/* i_it = i_it->next*/) { //Check if prefix match and it is a nfn request if (!ccnl_prefix_cmp(c->pkt->pfx, NULL, i_it->pkt->pfx, CMP_EXACT) && i_it->from && i_it->from->faceid < 0) { struct ccnl_face_s *from = i_it->from; int faceid = - from->faceid; DEBUGMSG(TRACE, " interest faceid=%d\n", i_it->from->faceid); ccnl_content_add2cache(relay, c); DEBUGMSG_CFWD(INFO, "data in rx resulti after add to cache %.*s\n", c->pkt->contlen, c->pkt->content); DEBUGMSG(DEBUG, "Continue configuration for configid: %d with prefix: %s\n", faceid, ccnl_prefix_to_path(c->pkt->pfx)); i_it->flags |= CCNL_PIT_COREPROPAGATES; i_it->from = NULL; ccnl_nfn_continue_computation(relay, faceid, 0); i_it = ccnl_interest_remove(relay, i_it); //ccnl_face_remove(relay, from); ++found; //goto Done; } else i_it = i_it->next; } TRACEOUT(); return found > 0; }
int ccnl_nfn_RX_result(struct ccnl_relay_s *relay, struct ccnl_face_s *from, struct ccnl_content_s *c) { struct ccnl_interest_s *i_it = NULL; int found = 0; DEBUGMSG(TRACE, "ccnl_nfn_RX_result()\n"); #ifdef USE_NACK if (ccnl_nfnprefix_contentIsNACK(c)) { ccnl_nfn_nack_local_computation(relay, c->pkt, c->name, from, c->name->suite); return -1; } #endif // USE_NACK for (i_it = relay->pit; i_it;/* i_it = i_it->next*/) { //Check if prefix match and it is a nfn request DEBUGMSG(DEBUG, "CMP: %d (match if zero), faceid: %d \n", ccnl_prefix_cmp(c->name, NULL, i_it->prefix, CMP_EXACT), i_it->from->faceid); if (!ccnl_prefix_cmp(c->name, NULL, i_it->prefix, CMP_EXACT) && i_it->from->faceid < 0) { int faceid = -i_it->from->faceid; ccnl_content_add2cache(relay, c); DEBUGMSG(DEBUG, "Continue configuration for configid: %d with prefix: %s\n", -i_it->from->faceid, ccnl_prefix_to_path(c->name)); i_it->flags |= CCNL_PIT_COREPROPAGATES; i_it = ccnl_interest_remove(relay, i_it); ccnl_nfn_continue_computation(relay, faceid, 0); ++found; //goto Done; } else i_it = i_it->next; } return found > 0; }