Update in sending Info Interest
diff --git a/nlsr.c b/nlsr.c
index bcf897c..0040473 100644
--- a/nlsr.c
+++ b/nlsr.c
@@ -175,6 +175,82 @@
}
void
+process_command_lsdb_synch_interval(char *command)
+{
+ if(command==NULL)
+ {
+ printf(" Wrong Command Format ( lsdb-synch-interval secs )\n");
+ return;
+ }
+ char *rem;
+ const char *sep=" \t\n";
+ char *secs;
+ long int seconds;
+
+ secs=strtok_r(command,sep,&rem);
+ if(secs==NULL)
+ {
+ printf(" Wrong Command Format ( lsdb-synch-interval secs)\n");
+ return;
+ }
+
+ seconds=atoi(secs);
+ nlsr->lsdb_synch_interval=seconds;
+
+}
+
+
+void
+process_command_interest_retry(char *command)
+{
+ if(command==NULL)
+ {
+ printf(" Wrong Command Format ( interest-retry number )\n");
+ return;
+ }
+ char *rem;
+ const char *sep=" \t\n";
+ char *secs;
+ long int seconds;
+
+ secs=strtok_r(command,sep,&rem);
+ if(secs==NULL)
+ {
+ printf(" Wrong Command Format ( interest-retry number)\n");
+ return;
+ }
+
+ seconds=atoi(secs);
+ nlsr->interest_retry=seconds;
+
+}
+
+void
+process_command_interest_resend_time(char *command)
+{
+ if(command==NULL)
+ {
+ printf(" Wrong Command Format ( interest-resend-time secs )\n");
+ return;
+ }
+ char *rem;
+ const char *sep=" \t\n";
+ char *secs;
+ long int seconds;
+
+ secs=strtok_r(command,sep,&rem);
+ if(secs==NULL)
+ {
+ printf(" Wrong Command Format ( interest-resend-time secs)\n");
+ return;
+ }
+
+ seconds=atoi(secs);
+ nlsr->interest_resend_time=seconds;
+
+}
+
+void
process_conf_command(char *command)
{
const char *separators=" \t\n";
@@ -198,6 +274,18 @@
{
process_command_ccnname(remainder);
}
+ else if(!strcmp(cmd_type,"lsdb-synch-interval") )
+ {
+ process_command_lsdb_synch_interval(remainder);
+ }
+ else if(!strcmp(cmd_type,"interest-retry") )
+ {
+ process_command_interest_retry(remainder);
+ }
+ else if(!strcmp(cmd_type,"interest-resend-time") )
+ {
+ process_command_interest_resend_time(remainder);
+ }
else
{
printf("Wrong configuration Command %s \n",cmd_type);
@@ -368,6 +456,13 @@
nlsr->is_synch_init=1;
nlsr->nlsa_id=0;
+ nlsr->adj_build_flag=0;
+ nlsr->adj_build_count=0;
+
+ nlsr->lsdb_synch_interval = LSDB_SYNCH_INTERVAL;
+ nlsr->interest_retry = INTEREST_RETRY;
+ nlsr->interest_resend_time = INTEREST_RESEND_TIME;
+
}
@@ -424,8 +519,9 @@
nlsr->sched = ccn_schedule_create(nlsr, &ndn_rtr_ticker);
- nlsr->event_send_lsdb_interest = ccn_schedule_event(nlsr->sched, 1000000, &send_lsdb_interest, NULL, 0);
- nlsr->event_send_lsdb_interest = ccn_schedule_event(nlsr->sched, 500000, &initial_build_name_lsa, NULL, 0);
+ nlsr->event_build_name_lsa = ccn_schedule_event(nlsr->sched, 500000, &initial_build_name_lsa, NULL, 0);
+ nlsr->event_send_info_interest = ccn_schedule_event(nlsr->sched, 1000000, &send_info_interest, NULL, 0);
+
while(1)
{
diff --git a/nlsr.conf b/nlsr.conf
new file mode 100644
index 0000000..dbbaf9c
--- /dev/null
+++ b/nlsr.conf
@@ -0,0 +1,11 @@
+router-name /ndn/memphis.edu/netlab/macbook
+ccnneighbor /ndn/memphis.edu/netlab/maia face2 10
+ccnneighbor /ndn/memphis.edu/netlab/castor face3 8
+ccnneighbor /ndn/memphis.edu/netlab/pollux face4 15
+ccnname /ndn/memphis.edu/netlab/macbook/name1
+ccnname /ndn/memphis.edu/netlab/macbook/test
+lsdb-synch-interval 300
+interest-retry 2
+interest-resend-time 15
+
+
diff --git a/nlsr.h b/nlsr.h
index d6779b8..0cd71e8 100644
--- a/nlsr.h
+++ b/nlsr.h
@@ -3,6 +3,9 @@
#define LSA_ADJ_TYPE 1
#define LSA_NAME_TYPE 2
+#define LSDB_SYNCH_INTERVAL 300
+#define INTEREST_RETRY 3
+#define INTEREST_RESEND_TIME 15
struct name_prefix
{
@@ -16,6 +19,7 @@
int face;
int status;
long int last_lsdb_version;
+ int info_interest_timed_out;
struct hashtb *lsa_update_queue;
};
@@ -34,6 +38,9 @@
struct ccn_schedule *sched;
struct ccn_scheduled_event *event;
struct ccn_scheduled_event *event_send_lsdb_interest;
+ struct ccn_scheduled_event *event_send_info_interest;
+ struct ccn_scheduled_event *event_build_name_lsa;
+ struct ccn_scheduled_event *event_build_adj_lsa;
struct hashtb *adl;
struct hashtb *npl;
@@ -45,6 +52,13 @@
int is_synch_init;
long int nlsa_id;
+ int adj_build_flag;
+ long int adj_build_count;
+
+ long int lsdb_synch_interval;
+ int interest_retry;
+ long int interest_resend_time;
+
};
struct nlsr *nlsr;
@@ -55,6 +69,9 @@
void process_command_router_name(char *command);
void process_command_ccnname(char *command);
void process_command_ccnneighbor(char *command);
+void process_command_lsdb_synch_interval(char *command);
+void process_command_interest_retry(char *command);
+void process_command_interest_resend_time(char *command);
void process_conf_command(char *command);
int readConfigFile(const char *filename);
diff --git a/nlsr_adl.c b/nlsr_adl.c
index f4237fb..767d7bd 100644
--- a/nlsr_adl.c
+++ b/nlsr_adl.c
@@ -47,6 +47,7 @@
hnbr->face=nbr->face;
hnbr->status=nbr->status;
hnbr->last_lsdb_version=0;
+ hnbr->info_interest_timed_out=0;
struct hashtb_param param_luq = {0};
hnbr->lsa_update_queue=hashtb_create(200, ¶m_luq);
@@ -75,7 +76,7 @@
for(i=0;i<adl_element;i++)
{
nbr=e->data;
- printf("Neighbor: %s Length: %d Face: %d Status: %d LSDB Version: %ld \n",ccn_charbuf_as_string(nbr->neighbor),(int)nbr->neighbor->length,nbr->face, nbr->status, nbr->last_lsdb_version);
+ printf("Neighbor: %s Length: %d Face: %d Status: %d LSDB Version: %ld Interest Timed Out: %d\n",ccn_charbuf_as_string(nbr->neighbor),(int)nbr->neighbor->length,nbr->face, nbr->status, nbr->last_lsdb_version,nbr->info_interest_timed_out);
hashtb_next(e);
}
@@ -140,3 +141,72 @@
hashtb_end(e);
}
+
+void
+update_adjacent_timed_out_to_adl(struct ccn_charbuf *nbr, int increment)
+{
+ printf("update_adjacent_timed_out_to_adl called \n");
+
+ int res;
+ struct ndn_neighbor *nnbr;
+
+ struct hashtb_enumerator ee;
+ struct hashtb_enumerator *e = ⅇ
+
+ hashtb_start(nlsr->adl, e);
+ res = hashtb_seek(e, nbr->buf, nbr->length, 0);
+
+ if( res == HT_OLD_ENTRY )
+ {
+ nnbr=e->data;
+ nnbr->info_interest_timed_out += increment;
+ }
+ else if(res == HT_NEW_ENTRY)
+ {
+ hashtb_delete(e);
+ }
+
+ hashtb_end(e);
+}
+
+void
+update_adjacent_timed_out_zero_to_adl(struct ccn_charbuf *nbr)
+{
+
+ printf("update_adjacent_timed_out_zero_to_adl called \n");
+ int time_out_number=get_timed_out_number(nbr);
+ update_adjacent_timed_out_to_adl(nbr,-time_out_number);
+
+}
+
+
+int
+get_timed_out_number(struct ccn_charbuf *nbr)
+{
+
+ printf("get_timed_out_number called \n");
+
+ int res,ret=-1;
+ struct ndn_neighbor *nnbr;
+
+ struct hashtb_enumerator ee;
+ struct hashtb_enumerator *e = ⅇ
+
+ hashtb_start(nlsr->adl, e);
+ res = hashtb_seek(e, nbr->buf, nbr->length, 0);
+
+ if( res == HT_OLD_ENTRY )
+ {
+ nnbr=e->data;
+ ret=nnbr->info_interest_timed_out;
+ }
+ else if(res == HT_NEW_ENTRY)
+ {
+ hashtb_delete(e);
+ }
+
+ hashtb_end(e);
+
+ return ret;
+
+}
diff --git a/nlsr_adl.h b/nlsr_adl.h
index cd25524..dc2e899 100644
--- a/nlsr_adl.h
+++ b/nlsr_adl.h
@@ -6,4 +6,8 @@
void update_adjacent_status_to_adl(struct ccn_charbuf *nbr, int status);
void update_adjacent_lsdb_version_to_adl(struct ccn_charbuf *nbr, long int version);
+int get_timed_out_number(struct ccn_charbuf *nbr);
+void update_adjacent_timed_out_to_adl(struct ccn_charbuf *nbr, int increment);
+void update_adjacent_timed_out_zero_to_adl(struct ccn_charbuf *nbr);
+
#endif
diff --git a/nlsr_lsdb.c b/nlsr_lsdb.c
index 26b130a..d9d66c2 100644
--- a/nlsr_lsdb.c
+++ b/nlsr_lsdb.c
@@ -29,16 +29,17 @@
struct ccn_charbuf *c=ccn_charbuf_create();
ccn_charbuf_reset(c);
- ccn_charbuf_putf(c, "%d", (unsigned)ls_type);
+ ccn_charbuf_putf(c, "%d", ls_type);
ccn_charbuf_append_string(key,ccn_charbuf_as_string(c));
ccn_charbuf_reset(c);
- ccn_charbuf_putf(c, "%d", (unsigned)nlsa_id);
+ ccn_charbuf_putf(c, "%ld", nlsa_id);
ccn_charbuf_append_string(key,ccn_charbuf_as_string(c));
ccn_charbuf_reset(c);
- ccn_charbuf_putf(c, "%ld", (unsigned)orig_time);
+ ccn_charbuf_putf(c, "%ld", orig_time);
ccn_charbuf_append_string(key,ccn_charbuf_as_string(c));
+ //ccn_charbuf_append_string(key,orig_time);
ccn_charbuf_destroy(&c);
@@ -104,7 +105,9 @@
name_lsa->header->orig_router=ccn_charbuf_create();
name_lsa->header->ls_type=LS_TYPE_NAME;
- name_lsa->header->orig_time=get_current_time_sec();
+ name_lsa->header->orig_time=get_current_time_microsec();
+ //name_lsa->header->orig_time=(char *)malloc(strlen(get_current_time_microsec())+1);
+ //memcpy(name_lsa->header->orig_time,get_current_time_microsec(),strlen(get_current_time_microsec())+1);
name_lsa->header->ls_id=++nlsr->nlsa_id;
ccn_charbuf_append_string(name_lsa->header->orig_router,nlsr->router_name);
name_lsa->header->isValid=1;
@@ -166,7 +169,7 @@
printf(" LS Type : %d\n",name_lsa->header->ls_type);
printf(" LS Id : %ld\n",name_lsa->header->ls_id);
printf(" Origination Time : %ld\n",name_lsa->header->orig_time);
- printf(" Is Valid : %u\n",name_lsa->header->isValid);
+ printf(" Is Valid : %d\n",name_lsa->header->isValid);
printf(" LSA Data \n");
printf(" Name Prefix: : %s\n",ccn_charbuf_as_string(name_lsa->name_prefix));
@@ -199,3 +202,15 @@
hashtb_end(e);
}
+
+
+int
+install_adj_lsa(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
+{
+ printf("install_adj_lsa called \n");
+
+ ev = ccn_schedule_event(nlsr->sched, 1000000, &install_adj_lsa, NULL, 0);
+
+ return 0;
+
+}
diff --git a/nlsr_lsdb.h b/nlsr_lsdb.h
index a5316f0..23a670e 100644
--- a/nlsr_lsdb.h
+++ b/nlsr_lsdb.h
@@ -51,4 +51,7 @@
void print_name_lsdb(void);
void print_name_lsa(struct nlsa *name_lsa);
+
+int install_adj_lsa(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
+
#endif
diff --git a/nlsr_ndn.c b/nlsr_ndn.c
index eaa0ba0..3f92698 100644
--- a/nlsr_ndn.c
+++ b/nlsr_ndn.c
@@ -22,6 +22,24 @@
#include "nlsr_ndn.h"
#include "utility.h"
#include "nlsr_adl.h"
+#include "nlsr_lsdb.h"
+
+int
+appendLifetime(struct ccn_charbuf *cb, int lifetime)
+{
+ unsigned char buf[sizeof(int32_t)];
+ int32_t dreck = lifetime << 12;
+ int pos = sizeof(int32_t);
+ int res = 0;
+ while (dreck > 0 && pos > 0)
+ {
+ pos--;
+ buf[pos] = dreck & 255;
+ dreck = dreck >> 8;
+ }
+ res |= ccnb_append_tagged_blob(cb, CCN_DTAG_InterestLifetime, buf+pos, sizeof(buf)-pos);
+ return res;
+}
enum ccn_upcall_res
incoming_interest(struct ccn_closure *selfp,
@@ -147,6 +165,10 @@
{
process_incoming_content_lsdb(selfp,info);
}
+ if(!strcmp((char *)comp_ptr1,"info"))
+ {
+ process_incoming_content_info(selfp,info);
+ }
}
@@ -184,6 +206,21 @@
}
+
+void
+process_incoming_content_info(struct ccn_closure* selfp, struct ccn_upcall_info* info)
+{
+ printf("process_incoming_content_info called \n");
+
+ const unsigned char *content_data;
+ size_t length;
+ ccn_content_get_value(info->content_ccnb, info->pco->offset[CCN_PCO_E_Content]-info->pco->offset[CCN_PCO_B_Content], info->pco, &content_data, &length);
+
+ printf("Info Value: %s \n",(char *)content_data);
+
+
+}
+
void
process_incoming_timed_out_interest(struct ccn_closure* selfp, struct ccn_upcall_info* info)
{
@@ -222,6 +259,10 @@
{
process_incoming_timed_out_interest_lsdb(selfp,info);
}
+ else if(ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,nlsr_position+1,"info") == 0)
+ {
+ process_incoming_timed_out_interest_info(selfp,info);
+ }
}
@@ -272,6 +313,60 @@
}
void
+process_incoming_timed_out_interest_info(struct ccn_closure* selfp, struct ccn_upcall_info* info)
+{
+
+ printf("process_incoming_timed_out_interest_info called \n");
+
+ int res,i;
+ int nlsr_position=0;
+ int name_comps=(int)info->interest_comps->n;
+
+ for(i=0;i<name_comps;i++)
+ {
+ res=ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,i,"nlsr");
+ if( res == 0)
+ {
+ nlsr_position=i;
+ break;
+ }
+ }
+
+ struct ccn_charbuf *nbr;
+ nbr=ccn_charbuf_create();
+
+
+ const unsigned char *comp_ptr1;
+ size_t comp_size;
+ for(i=0;i<nlsr_position;i++)
+ {
+ res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,i,&comp_ptr1, &comp_size);
+ //printf("%s \n",comp_ptr1);
+ ccn_charbuf_append_string(nbr,"/");
+ ccn_charbuf_append_string(nbr,(const char *)comp_ptr1);
+ }
+
+ ccn_charbuf_append_string(nbr,"\0");
+ printf("Info Interest Timed out for Neighbor: %s\n",ccn_charbuf_as_string(nbr));
+
+ update_adjacent_timed_out_to_adl(nbr,1);
+ int timed_out=get_timed_out_number(nbr);
+ if(timed_out<nlsr->interest_retry && timed_out>0) // use configured variables
+ {
+ printf("Neighbor: %s Info Interest Timed Out: %d times\n",ccn_charbuf_as_string(nbr),timed_out);
+ send_info_interest_to_neighbor(nbr);
+ }
+ else
+ {
+ printf("Neighbor: %s Info Interest Timed Out: %d times\n",ccn_charbuf_as_string(nbr),timed_out);
+ nlsr->event_build_adj_lsa = ccn_schedule_event(nlsr->sched, 1, &install_adj_lsa, NULL, 0);
+ }
+
+ ccn_charbuf_destroy(&nbr);
+}
+
+
+void
process_incoming_interest(struct ccn_closure *selfp, struct ccn_upcall_info *info)
{
printf("process_incoming_interest called \n");
@@ -307,8 +402,10 @@
{
process_incoming_interest_lsdb(selfp,info);
}
-
-
+ if(!strcmp((char *)comp_ptr1,"info"))
+ {
+ process_incoming_interest_info(selfp,info);
+ }
}
@@ -395,12 +492,55 @@
printf("Sending NACK Content is successful \n");
ccn_charbuf_destroy(&data);
+ ccn_charbuf_destroy(&name);
ccn_charbuf_destroy(&sp.template_ccnb);
}
}
+
+void
+process_incoming_interest_info(struct ccn_closure *selfp, struct ccn_upcall_info *info)
+{
+ printf("process_incoming_interest_info called \n");
+ int res;
+
+ printf("Sending Info Content back.....\n");
+
+ struct ccn_charbuf *data=ccn_charbuf_create();
+ struct ccn_charbuf *name=ccn_charbuf_create();
+ struct ccn_signing_params sp=CCN_SIGNING_PARAMS_INIT;
+
+ ccn_charbuf_append(name, info->interest_ccnb + info->pi->offset[CCN_PI_B_Name],info->pi->offset[CCN_PI_E_Name] - info->pi->offset[CCN_PI_B_Name]);
+
+
+ sp.template_ccnb=ccn_charbuf_create();
+ ccn_charbuf_append_tt(sp.template_ccnb,CCN_DTAG_SignedInfo, CCN_DTAG);
+ ccnb_tagged_putf(sp.template_ccnb, CCN_DTAG_FreshnessSeconds, "%ld", 10);
+ sp.sp_flags |= CCN_SP_TEMPL_FRESHNESS;
+ ccn_charbuf_append_closer(sp.template_ccnb);
+
+ struct ccn_charbuf *c=ccn_charbuf_create();
+ ccn_charbuf_reset(c);
+ ccn_charbuf_putf(c, "%ld", nlsr->lsdb_synch_interval);
+ ccn_charbuf_append_string(data,ccn_charbuf_as_string(c));
+
+ res= ccn_sign_content(nlsr->ccn, data, name, &sp, "info", strlen("info"));
+ if(res >= 0)
+ printf("Signing Content is successful \n");
+
+ res=ccn_put(nlsr->ccn,data->buf,data->length);
+ if(res >= 0)
+ printf("Sending NACK Content is successful \n");
+
+ ccn_charbuf_destroy(&data);
+ ccn_charbuf_destroy(&c);
+ ccn_charbuf_destroy(&name);
+ ccn_charbuf_destroy(&sp.template_ccnb);
+
+}
+
int
send_lsdb_interest(struct ccn_schedule *sched, void *clienth,
struct ccn_scheduled_event *ev, int flags)
@@ -487,3 +627,158 @@
}
+
+int
+send_info_interest(struct ccn_schedule *sched, void *clienth,
+ struct ccn_scheduled_event *ev, int flags)
+{
+
+ struct ccn_charbuf *name;
+ long int rnum;
+ char rnumstr[20];
+ char info_str[5];
+ char nlsr_str[5];
+
+ int res,i;
+ int adl_element;
+ int scope = 2; //no further than the next host
+
+ rnum=random();
+ memset(&rnumstr,0,20);
+ sprintf(rnumstr,"%ld",rnum);
+ memset(&nlsr_str,0,5);
+ sprintf(nlsr_str,"nlsr");
+ memset(&info_str,0,5);
+ sprintf(info_str,"info");
+
+
+ struct ndn_neighbor *nbr;
+
+ struct hashtb_enumerator ee;
+ struct hashtb_enumerator *e = ⅇ
+
+ hashtb_start(nlsr->adl, e);
+ adl_element=hashtb_n(nlsr->adl);
+ //int mynumber=15;
+
+ for(i=0;i<adl_element;i++)
+ {
+ nbr=e->data;
+ printf("Sending interest for name prefix:%s/%s/%s\n",ccn_charbuf_as_string(nbr->neighbor),nlsr_str,info_str);
+ name=ccn_charbuf_create();
+ res=ccn_name_from_uri(name,ccn_charbuf_as_string(nbr->neighbor));
+ ccn_name_append_str(name,nlsr_str);
+ ccn_name_append_str(name,info_str);
+ //ccn_name_append_str(name,rnumstr);
+
+ /* adding Exclusion filter */
+
+ struct ccn_charbuf *templ;
+ templ = ccn_charbuf_create();
+
+// struct ccn_charbuf *c;
+// c = ccn_charbuf_create();
+
+
+ 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);
+// ccnb_tagged_putf(templ, CCN_DTAG_Any, "");
+// ccn_charbuf_reset(c);
+// //ccn_charbuf_putf(c, "%u", (unsigned)mynumber);
+// //ccn_charbuf_putf(c, "%s", nbr->last_lsdb_version);
+// ccn_charbuf_putf(c, "%u", (unsigned)nbr->last_lsdb_version);
+// ccnb_append_tagged_blob(templ, CCN_DTAG_Component, c->buf, c->length);
+// ccn_charbuf_append_closer(templ); /* </Exclude> */
+ ccnb_tagged_putf(templ, CCN_DTAG_Scope, "%d", scope);
+ appendLifetime(templ,nlsr->interest_resend_time);
+ ccn_charbuf_append_closer(templ); /* </Interest> */
+
+
+ /* Adding Exclusion filter done */
+
+ res=ccn_express_interest(nlsr->ccn,name,&(nlsr->in_content),templ);
+
+ if ( res >= 0 )
+ printf("Interest sending Successfull .... \n");
+// ccn_charbuf_destroy(&c);
+ ccn_charbuf_destroy(&templ);
+ ccn_charbuf_destroy(&name);
+
+ hashtb_next(e);
+ }
+
+ hashtb_end(e);
+
+ //nlsr->event_send_info_interest = ccn_schedule_event(nlsr->sched, 20000000, &send_info_interest, NULL, 0);
+
+ return 0;
+
+}
+
+
+void
+send_info_interest_to_neighbor(struct ccn_charbuf *nbr)
+{
+
+ struct ccn_charbuf *name;
+ long int rnum;
+ char rnumstr[20];
+ char info_str[5];
+ char nlsr_str[5];
+
+ int res;
+ int scope = 2; //no further than the next host
+
+ rnum=random();
+ memset(&rnumstr,0,20);
+ sprintf(rnumstr,"%ld",rnum);
+ memset(&nlsr_str,0,5);
+ sprintf(nlsr_str,"nlsr");
+ memset(&info_str,0,5);
+ sprintf(info_str,"info");
+
+ printf("Sending interest for name prefix:%s/%s/%s\n",ccn_charbuf_as_string(nbr),nlsr_str,info_str);
+ name=ccn_charbuf_create();
+ res=ccn_name_from_uri(name,ccn_charbuf_as_string(nbr));
+ ccn_name_append_str(name,nlsr_str);
+ ccn_name_append_str(name,info_str);
+ //ccn_name_append_str(name,rnumstr);
+
+ /* adding Exclusion filter */
+
+ struct ccn_charbuf *templ;
+ templ = ccn_charbuf_create();
+
+// struct ccn_charbuf *c;
+// c = ccn_charbuf_create();
+
+
+ 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);
+// ccnb_tagged_putf(templ, CCN_DTAG_Any, "");
+// ccn_charbuf_reset(c);
+// //ccn_charbuf_putf(c, "%u", (unsigned)mynumber);
+// //ccn_charbuf_putf(c, "%s", nbr->last_lsdb_version);
+// ccn_charbuf_putf(c, "%u", (unsigned)nbr->last_lsdb_version);
+// ccnb_append_tagged_blob(templ, CCN_DTAG_Component, c->buf, c->length);
+// ccn_charbuf_append_closer(templ); /* </Exclude> */
+ ccnb_tagged_putf(templ, CCN_DTAG_Scope, "%d", scope);
+ appendLifetime(templ,15);
+ ccn_charbuf_append_closer(templ); /* </Interest> */
+
+
+ /* Adding Exclusion filter done */
+
+ res=ccn_express_interest(nlsr->ccn,name,&(nlsr->in_content),templ);
+
+ if ( res >= 0 )
+ printf("Interest sending Successfull .... \n");
+// ccn_charbuf_destroy(&c);
+ ccn_charbuf_destroy(&templ);
+ ccn_charbuf_destroy(&name);
+
+}
diff --git a/nlsr_ndn.h b/nlsr_ndn.h
index cb249c2..4c2a79c 100644
--- a/nlsr_ndn.h
+++ b/nlsr_ndn.h
@@ -1,20 +1,28 @@
#ifndef _NLSR_NDN_H_
#define _NLSR_NDN_H_
+int appendLifetime(struct ccn_charbuf *cb, int lifetime);
int send_lsdb_interest(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
enum ccn_upcall_res incoming_interest(struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info);
void process_incoming_interest(struct ccn_closure *selfp, struct ccn_upcall_info *info);
void process_incoming_interest_lsdb(struct ccn_closure *selfp, struct ccn_upcall_info *info);
+void process_incoming_interest_info(struct ccn_closure *selfp, struct ccn_upcall_info *info);
void process_incoming_timed_out_interest(struct ccn_closure* selfp, struct ccn_upcall_info* info);
void process_incoming_timed_out_interest_lsdb(struct ccn_closure* selfp, struct ccn_upcall_info* info);
+void process_incoming_timed_out_interest_info(struct ccn_closure* selfp, struct ccn_upcall_info* info);
enum ccn_upcall_res incoming_content(struct ccn_closure* selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info* info);
void process_incoming_content(struct ccn_closure* selfp, struct ccn_upcall_info* info);
void process_incoming_content_lsdb(struct ccn_closure* selfp, struct ccn_upcall_info* info);
+void process_incoming_content_info(struct ccn_closure* selfp, struct ccn_upcall_info* info);
+
+
+int send_info_interest(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
+void send_info_interest_to_neighbor(struct ccn_charbuf *nbr);
#endif
diff --git a/utility.c b/utility.c
index ed22483..283376d 100644
--- a/utility.c
+++ b/utility.c
@@ -70,3 +70,14 @@
gettimeofday(&now,NULL);
return now.tv_sec;
}
+
+
+long int
+get_current_time_microsec(void)
+{
+ struct timeval now;
+ gettimeofday(&now, NULL);
+ long int microSec=1000000*now.tv_sec+now.tv_usec;
+ return microSec;
+
+}
diff --git a/utility.h b/utility.h
index 96cd3cf..b068d1a 100644
--- a/utility.h
+++ b/utility.h
@@ -5,5 +5,6 @@
char * getGmTimeStamp(void);
char * nth_named_component(const char *name_prefix, int n);
long int get_current_time_sec(void);
+long int get_current_time_microsec(void);
#endif