int ccnl_i_prefixof_c(struct ccnl_prefix_s *prefix, int minsuffix, int maxsuffix, struct ccnl_content_s *c) { unsigned char *md; #ifdef USE_LOGGING char prefixBuf1[CCNL_PREFIX_BUFSIZE], prefixBuf2[CCNL_PREFIX_BUFSIZE]; #endif struct ccnl_prefix_s *p = c->pkt->pfx; DEBUGMSG_CPFX(VERBOSE, "ccnl_i_prefixof_c prefix=<%s> content=<%s> min=%d max=%d\n", ccnl_prefix2path(prefixBuf1, CCNL_ARRAY_SIZE(prefixBuf1), prefix), ccnl_prefix2path(prefixBuf2, CCNL_ARRAY_SIZE(prefixBuf2), p), minsuffix, maxsuffix); if (!prefix || !p) return 0; // CONFORM: we do prefix match, honour min. and maxsuffix, // NON-CONFORM: "Note that to match a ContentObject must satisfy // all of the specifications given in the Interest Message." // >> CCNL does not honour the exclusion filtering if ( (prefix->compcnt + minsuffix) > (p->compcnt + 1) || (prefix->compcnt + maxsuffix) < (p->compcnt + 1)) { DEBUGMSG_CPFX(TRACE, " mismatch in # of components\n"); return 0; } md = (prefix->compcnt - p->compcnt == 1) ? compute_ccnx_digest(c->pkt->buf) : NULL; return ccnl_prefix_cmp(p, md, prefix, CMP_MATCH) == prefix->compcnt; }
int ccnl_i_prefixof_c(struct ccnl_prefix_s *prefix, struct ccnl_buf_s *ppkd, int minsuffix, int maxsuffix, struct ccnl_content_s *c) { unsigned char *md; DEBUGMSG(99, "ccnl_i_prefixof_c prefix=%s min=%d max=%d\n", ccnl_prefix_to_path(prefix), minsuffix, maxsuffix); // CONFORM: we do prefix match, honour min. and maxsuffix, // and check the PublisherPublicKeyDigest if present // NON-CONFORM: "Note that to match a ContentObject must satisfy // all of the specifications given in the Interest Message." // >> CCNL does not honour the exclusion filtering if ((ppkd && !buf_equal(ppkd, c->ppkd)) || (prefix->compcnt + minsuffix) > (c->name->compcnt + 1) || (prefix->compcnt + maxsuffix) < (c->name->compcnt + 1)) { return 0; } md = NULL; if ((prefix->compcnt - c->name->compcnt) == 1) { md = compute_ccnx_digest(c->pkt); } return ccnl_prefix_cmp(c->name, md, prefix, CMP_MATCH) == prefix->compcnt; }