static struct ccn_charbuf * resolve_templ(struct ccn_charbuf *templ, unsigned const char *vcomp, int size) { if (templ == NULL) templ = ccn_charbuf_create(); if (size < 3 || size > 16) { ccn_charbuf_destroy(&templ); return(NULL); } templ->length = 0; ccn_charbuf_append_tt(templ, CCN_DTAG_Interest, CCN_DTAG); ccn_charbuf_append_tt(templ, CCN_DTAG_Name, CCN_DTAG); ccn_charbuf_append_closer(templ); /* </Name> */ ccn_charbuf_append_tt(templ, CCN_DTAG_Exclude, CCN_DTAG); append_filter_all(templ); ccn_charbuf_append_tt(templ, CCN_DTAG_Component, CCN_DTAG); ccn_charbuf_append_tt(templ, size, CCN_BLOB); ccn_charbuf_append(templ, vcomp, size); ccn_charbuf_append_closer(templ); /* </Component> */ append_future_vcomp(templ); append_filter_all(templ); ccn_charbuf_append_closer(templ); /* </Exclude> */ answer_highest(templ); answer_passive(templ); ccn_charbuf_append_closer(templ); /* </Interest> */ return(templ); }
static struct ndn_charbuf * resolve_templ(struct ndn_charbuf *templ, unsigned const char *vcomp, int size, int lifetime, int versioning_flags) { if (templ == NULL) templ = ndn_charbuf_create(); if (size < 3 || size > 16) { ndn_charbuf_destroy(&templ); return(NULL); } templ->length = 0; ndn_charbuf_append_tt(templ, NDN_DTAG_Interest, NDN_DTAG); ndn_charbuf_append_tt(templ, NDN_DTAG_Name, NDN_DTAG); ndn_charbuf_append_closer(templ); /* </Name> */ ndn_charbuf_append_tt(templ, NDN_DTAG_Exclude, NDN_DTAG); append_filter_all(templ); ndn_charbuf_append_tt(templ, NDN_DTAG_Component, NDN_DTAG); ndn_charbuf_append_tt(templ, size, NDN_BLOB); ndn_charbuf_append(templ, vcomp, size); ndn_charbuf_append_closer(templ); /* </Component> */ append_future_vcomp(templ); append_filter_all(templ); ndn_charbuf_append_closer(templ); /* </Exclude> */ answer_highest(templ); answer_passive(templ); if ((versioning_flags & NDN_V_SCOPE2) != 0) ndnb_tagged_putf(templ, NDN_DTAG_Scope, "%d", 2); else if ((versioning_flags & NDN_V_SCOPE1) != 0) ndnb_tagged_putf(templ, NDN_DTAG_Scope, "%d", 1); else if ((versioning_flags & NDN_V_SCOPE0) != 0) ndnb_tagged_putf(templ, NDN_DTAG_Scope, "%d", 0); if (lifetime > 0) ndnb_append_tagged_binary_number(templ, NDN_DTAG_InterestLifetime, lifetime); ndn_charbuf_append_closer(templ); /* </Interest> */ return(templ); }