blob: 1fcdd162692fe2b9a0d1f7490774434bd920d8e0 [file] [log] [blame]
akmhoque59980a52012-08-09 12:36:09 -05001#include<stdio.h>
2#include<string.h>
3#include<stdlib.h>
4#include <unistd.h>
5#include <getopt.h>
6#include <sys/time.h>
7#include <assert.h>
8#ifdef HAVE_CONFIG_H
9#include <config.h>
10#endif
11
12
13#include <ccn/ccn.h>
14#include <ccn/uri.h>
15#include <ccn/keystore.h>
16#include <ccn/signing.h>
17#include <ccn/schedule.h>
18#include <ccn/hashtb.h>
19
20#include "nlsr.h"
21#include "nlsr_ndn.h"
akmhoque03004e62012-09-06 01:12:28 -050022#include "nlsr_npl.h"
akmhoque8a5babe2012-08-16 17:39:33 -050023#include "nlsr_adl.h"
akmhoqued79438d2012-08-27 13:31:42 -050024#include "nlsr_lsdb.h"
akmhoque53f64222012-09-05 13:57:51 -050025#include "utility.h"
akmhoqueedb68d92013-03-05 10:18:16 -060026#include "nlsr_km.h"
27#include "nlsr_km_util.h"
akmhoque53f64222012-09-05 13:57:51 -050028
akmhoqueedb68d92013-03-05 10:18:16 -060029
akmhoque59980a52012-08-09 12:36:09 -050030
akmhoque3d319d42013-02-20 11:08:32 -060031/**
32* get neighbor name prefix from interest/content name and put into nbr
33*/
akmhoque53f64222012-09-05 13:57:51 -050034
35void
akmhoque3d319d42013-02-20 11:08:32 -060036get_nbr(struct name_prefix *nbr,struct ccn_closure *selfp,
37 struct ccn_upcall_info *info)
akmhoque53f64222012-09-05 13:57:51 -050038{
akmhoque7b791452012-10-30 11:24:56 -050039 if ( nlsr->debugging )
40 printf("get_nbr called\n");
41 if ( nlsr->detailed_logging )
42 writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_nbr called\n");
akmhoque53f64222012-09-05 13:57:51 -050043
akmhoque53f64222012-09-05 13:57:51 -050044 int res,i;
45 int nlsr_position=0;
46 int name_comps=(int)info->interest_comps->n;
47 int len=0;
48
49 for(i=0;i<name_comps;i++)
50 {
51 res=ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,i,"nlsr");
52 if( res == 0)
53 {
54 nlsr_position=i;
55 break;
56 }
57 }
58
59
60 const unsigned char *comp_ptr1;
61 size_t comp_size;
62 for(i=0;i<nlsr_position;i++)
63 {
akmhoque3d319d42013-02-20 11:08:32 -060064 res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,i,&
65 comp_ptr1, &comp_size);
akmhoque53f64222012-09-05 13:57:51 -050066 len+=1;
67 len+=(int)comp_size;
68 }
69 len++;
70
71 char *neighbor=(char *)malloc(len);
72 memset(neighbor,0,len);
73
74 for(i=0; i<nlsr_position;i++)
75 {
akmhoque3d319d42013-02-20 11:08:32 -060076 res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,i,
77 &comp_ptr1, &comp_size);
akmhoque53f64222012-09-05 13:57:51 -050078 memcpy(neighbor+strlen(neighbor),"/",1);
79 memcpy(neighbor+strlen(neighbor),(char *)comp_ptr1,strlen((char *)comp_ptr1));
80
81 }
akmhoque53f64222012-09-05 13:57:51 -050082
akmhoque284056b2013-03-15 01:20:16 -050083 nbr->name=(char *)calloc(strlen(neighbor)+1,sizeof(char));
akmhoque53f64222012-09-05 13:57:51 -050084 memcpy(nbr->name,neighbor,strlen(neighbor)+1);
85 nbr->length=strlen(neighbor)+1;
86
akmhoque7b791452012-10-30 11:24:56 -050087 if ( nlsr->debugging )
88 printf("Neighbor: %s Length: %d\n",nbr->name,nbr->length);
89 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -060090 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Neighbor: %s Length: %d\n",
91 nbr->name,nbr->length);
akmhoquececba942013-02-25 17:33:34 -060092 free(neighbor);
akmhoque53f64222012-09-05 13:57:51 -050093}
94
akmhoque3d319d42013-02-20 11:08:32 -060095/**
96* Retrieve LSA identifier from content name
97*/
akmhoque53f64222012-09-05 13:57:51 -050098
akmhoque3d319d42013-02-20 11:08:32 -060099void
100get_lsa_identifier(struct name_prefix *lsaId,struct ccn_closure *selfp,
101 struct ccn_upcall_info *info, int offset)
102{
akmhoque7b791452012-10-30 11:24:56 -0500103
104 if ( nlsr->debugging )
105 printf("get_lsa_identifier called\n");
106 if ( nlsr->detailed_logging )
107 writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_lsa_identifier called\n");
108
akmhoque53f64222012-09-05 13:57:51 -0500109 int res,i;
110 int nlsr_position=0;
111 int name_comps=(int)info->interest_comps->n;
112 int len=0;
113
114 for(i=0;i<name_comps;i++)
115 {
116 res=ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,i,"nlsr");
117 if( res == 0)
118 {
119 nlsr_position=i;
120 break;
121 }
122 }
123
124
125 const unsigned char *comp_ptr1;
126 size_t comp_size;
akmhoque03004e62012-09-06 01:12:28 -0500127 for(i=nlsr_position+3+offset;i<info->interest_comps->n-1;i++)
akmhoque53f64222012-09-05 13:57:51 -0500128 {
akmhoque3d319d42013-02-20 11:08:32 -0600129 res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,i,
130 &comp_ptr1, &comp_size);
akmhoque53f64222012-09-05 13:57:51 -0500131 len+=1;
132 len+=(int)comp_size;
133 }
134 len++;
135
akmhoquececba942013-02-25 17:33:34 -0600136 char *neighbor=(char *)calloc(len,sizeof(char));
akmhoque53f64222012-09-05 13:57:51 -0500137
akmhoque03004e62012-09-06 01:12:28 -0500138 for(i=nlsr_position+3+offset; i<info->interest_comps->n-1;i++)
akmhoque53f64222012-09-05 13:57:51 -0500139 {
akmhoque3d319d42013-02-20 11:08:32 -0600140 res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,i,
141 &comp_ptr1, &comp_size);
akmhoque53f64222012-09-05 13:57:51 -0500142 memcpy(neighbor+strlen(neighbor),"/",1);
143 memcpy(neighbor+strlen(neighbor),(char *)comp_ptr1,strlen((char *)comp_ptr1));
144
145 }
akmhoque53f64222012-09-05 13:57:51 -0500146
akmhoque83a94da2013-03-15 01:38:21 -0500147 lsaId->name=(char *)calloc(strlen(neighbor)+1,sizeof(char));
akmhoque53f64222012-09-05 13:57:51 -0500148 memcpy(lsaId->name,neighbor,strlen(neighbor)+1);
149 lsaId->length=strlen(neighbor)+1;
150
akmhoque7b791452012-10-30 11:24:56 -0500151 if ( nlsr->debugging )
152 printf("LSA Identifier: %s Length: %d\n",lsaId->name,lsaId->length-1);
153 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600154 writeLogg(__FILE__,__FUNCTION__,__LINE__,"LSA Identifier: %s Length: "
155 "%d\n",lsaId->name,lsaId->length-1);
akmhoque03004e62012-09-06 01:12:28 -0500156
akmhoquececba942013-02-25 17:33:34 -0600157 free(neighbor);
akmhoque03004e62012-09-06 01:12:28 -0500158}
159
160
akmhoque3d319d42013-02-20 11:08:32 -0600161
162/**
163* Call back function registered in ccnd to get all interest coming to NLSR
164* application
165*/
akmhoque03004e62012-09-06 01:12:28 -0500166
akmhoque59980a52012-08-09 12:36:09 -0500167enum ccn_upcall_res
168incoming_interest(struct ccn_closure *selfp,
169 enum ccn_upcall_kind kind, struct ccn_upcall_info *info)
170{
akmhoqueffacaa82012-09-13 17:48:30 -0500171
172 nlsr_lock();
173
akmhoque59980a52012-08-09 12:36:09 -0500174 switch (kind) {
175 case CCN_UPCALL_FINAL:
176 break;
177 case CCN_UPCALL_INTEREST:
akmhoque03004e62012-09-06 01:12:28 -0500178 // printing the name prefix for which it received interest
akmhoque7b791452012-10-30 11:24:56 -0500179 if ( nlsr->debugging )
180 printf("Interest Received for name: ");
181 if ( nlsr->detailed_logging )
182 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Interest Received for name: ");
183
akmhoque03004e62012-09-06 01:12:28 -0500184 struct ccn_charbuf*c;
185 c=ccn_charbuf_create();
186 ccn_uri_append(c,info->interest_ccnb,info->pi->offset[CCN_PI_E_Name],0);
akmhoque7b791452012-10-30 11:24:56 -0500187
188 if ( nlsr->debugging )
189 printf("%s\n",ccn_charbuf_as_string(c));
190 if ( nlsr->detailed_logging )
191 writeLogg(__FILE__,__FUNCTION__,__LINE__,"%s\n",ccn_charbuf_as_string(c));
192
akmhoque03004e62012-09-06 01:12:28 -0500193 ccn_charbuf_destroy(&c);
194
akmhoque1c9b92f2012-08-13 10:57:50 -0500195 process_incoming_interest(selfp, info);
akmhoque03004e62012-09-06 01:12:28 -0500196
akmhoque59980a52012-08-09 12:36:09 -0500197 break;
akmhoque03004e62012-09-06 01:12:28 -0500198
akmhoque59980a52012-08-09 12:36:09 -0500199 default:
200 break;
201 }
akmhoque03004e62012-09-06 01:12:28 -0500202
akmhoqueffacaa82012-09-13 17:48:30 -0500203 nlsr_unlock();
204
akmhoque59980a52012-08-09 12:36:09 -0500205 return CCN_UPCALL_RESULT_OK;
206}
207
akmhoque3d319d42013-02-20 11:08:32 -0600208/**
209* Function for processing incoming interest and reply with content/NACK content
210*/
akmhoque59980a52012-08-09 12:36:09 -0500211
akmhoqued79438d2012-08-27 13:31:42 -0500212void
akmhoque1c9b92f2012-08-13 10:57:50 -0500213process_incoming_interest(struct ccn_closure *selfp, struct ccn_upcall_info *info)
214{
akmhoque7b791452012-10-30 11:24:56 -0500215 if ( nlsr->debugging )
216 printf("process_incoming_interest called \n");
217 if ( nlsr->detailed_logging )
218 writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_interest called \n");
219
akmhoque1c9b92f2012-08-13 10:57:50 -0500220 const unsigned char *comp_ptr1;
221 size_t comp_size;
222 int res,i;
223 int nlsr_position=0;
224 int name_comps=(int)info->interest_comps->n;
akmhoque53f64222012-09-05 13:57:51 -0500225
akmhoque1c9b92f2012-08-13 10:57:50 -0500226 for(i=0;i<name_comps;i++)
227 {
228 res=ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,i,"nlsr");
229 if( res == 0)
230 {
akmhoqueea3603e2012-08-13 11:24:09 -0500231 nlsr_position=i;
akmhoque1c9b92f2012-08-13 10:57:50 -0500232 break;
233 }
234 }
235
akmhoque3d319d42013-02-20 11:08:32 -0600236 res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,nlsr_position+1,
237 &comp_ptr1, &comp_size);
akmhoque53f64222012-09-05 13:57:51 -0500238
akmhoque1c9b92f2012-08-13 10:57:50 -0500239
akmhoqued79438d2012-08-27 13:31:42 -0500240 if(!strcmp((char *)comp_ptr1,"info"))
241 {
242 process_incoming_interest_info(selfp,info);
243 }
akmhoqueb77b95f2013-02-08 12:28:47 -0600244
akmhoque53f64222012-09-05 13:57:51 -0500245}
246
akmhoque3d319d42013-02-20 11:08:32 -0600247/**
akmhoque7ab49a32013-02-20 11:27:51 -0600248* Processes incoming interest for "info" interest. Send back reply content back,
249* if interest comes from a neighbor with status down, NLSR will send "info"
250* ineterst to that neighbor
akmhoque3d319d42013-02-20 11:08:32 -0600251*/
252
akmhoque53f64222012-09-05 13:57:51 -0500253void
254process_incoming_interest_info(struct ccn_closure *selfp, struct ccn_upcall_info *info)
255{
akmhoque7b791452012-10-30 11:24:56 -0500256 if ( nlsr->debugging )
257 {
258 printf("process_incoming_interest_info called \n");
259 printf("Sending Info Content back.....\n");
260 }
261 if ( nlsr->detailed_logging )
262 {
akmhoque3d319d42013-02-20 11:08:32 -0600263 writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_interest_info"
264 " called \n");
akmhoque7b791452012-10-30 11:24:56 -0500265 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Sending Info Content back.....\n");
266 }
267
akmhoque53f64222012-09-05 13:57:51 -0500268
akmhoque53f64222012-09-05 13:57:51 -0500269 int res;
akmhoque6e2ba842013-03-05 19:35:26 -0600270 //struct ccn_charbuf *data=ccn_charbuf_create();
akmhoque53f64222012-09-05 13:57:51 -0500271 struct ccn_charbuf *name=ccn_charbuf_create();
akmhoquedd7a7a72013-02-20 08:25:41 -0600272
akmhoque03004e62012-09-06 01:12:28 -0500273
akmhoque3d319d42013-02-20 11:08:32 -0600274 res=ccn_charbuf_append(name, info->interest_ccnb + info->pi->offset[CCN_PI_B_Name],
275 info->pi->offset[CCN_PI_E_Name] - info->pi->offset[CCN_PI_B_Name]);
akmhoque53f64222012-09-05 13:57:51 -0500276 if (res >= 0)
277 {
akmhoquedd7a7a72013-02-20 08:25:41 -0600278
akmhoque6e2ba842013-03-05 19:35:26 -0600279 /*
akmhoquec06dcf12013-02-20 08:13:37 -0600280 struct ccn_charbuf *pubid = ccn_charbuf_create();
281 struct ccn_charbuf *pubkey = ccn_charbuf_create();
282
akmhoque7ca519b2013-02-20 09:49:43 -0600283 //pubid is the digest_result pubkey is result
284 ccn_get_public_key(nlsr->ccn, NULL, pubid, pubkey);
akmhoque4ef95e72013-03-22 09:51:54 -0500285 */
akmhoque7ca519b2013-02-20 09:49:43 -0600286
akmhoquedd7a7a72013-02-20 08:25:41 -0600287
288 struct ccn_signing_params sp=CCN_SIGNING_PARAMS_INIT;
289 sp.template_ccnb=ccn_charbuf_create();
akmhoque3d319d42013-02-20 11:08:32 -0600290
akmhoqueb63a41e2013-03-01 12:00:20 -0600291 ccn_charbuf_append_tt(sp.template_ccnb,CCN_DTAG_SignedInfo, CCN_DTAG);
akmhoque3d319d42013-02-20 11:08:32 -0600292 ccnb_tagged_putf(sp.template_ccnb, CCN_DTAG_FreshnessSeconds, "%ld", 10);
293 sp.sp_flags |= CCN_SP_TEMPL_FRESHNESS;
294 ccn_charbuf_append_closer(sp.template_ccnb);
akmhoqueb63a41e2013-03-01 12:00:20 -0600295
akmhoque4ef95e72013-03-22 09:51:54 -0500296 /*
akmhoqueb77b95f2013-02-08 12:28:47 -0600297 char *raw_data=(char *)malloc(20);
298 memset(raw_data,0,20);
akmhoque6e2ba842013-03-05 19:35:26 -0600299 sprintf(raw_data,"%s", nlsr->lsdb->lsdb_version);
300 */
akmhoque53f64222012-09-05 13:57:51 -0500301
akmhoque6e2ba842013-03-05 19:35:26 -0600302 struct ccn_charbuf *resultbuf=ccn_charbuf_create();
303
akmhoque4ef95e72013-03-22 09:51:54 -0500304 /*
akmhoque6e2ba842013-03-05 19:35:26 -0600305 res=sign_content_with_user_defined_keystore(name,
306 resultbuf,
307 "info",
308 strlen("info"),
309 nlsr->keystore_path,
310 nlsr->keystore_passphrase,
311 nlsr->root_key_prefix,
312 nlsr->site_name,
akmhoque2fafaa52013-03-22 05:10:52 -0500313 nlsr->router_name,
314 10);
akmhoque4ef95e72013-03-22 09:51:54 -0500315
316 */
317 res= ccn_sign_content(nlsr->ccn, resultbuf, name, &sp, "info",strlen("info"));
akmhoque53f64222012-09-05 13:57:51 -0500318 if(res >= 0)
akmhoque7b791452012-10-30 11:24:56 -0500319 {
320 if ( nlsr->debugging )
321 printf("Signing info Content is successful \n");
322 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600323 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Signing info Content"
324 " is successful \n");
akmhoque53f64222012-09-05 13:57:51 -0500325
akmhoque7b791452012-10-30 11:24:56 -0500326 }
akmhoque4ef95e72013-03-22 09:51:54 -0500327
328 res=ccn_put(nlsr->ccn,resultbuf->buf,resultbuf->length);
akmhoque53f64222012-09-05 13:57:51 -0500329 if(res >= 0)
akmhoque7b791452012-10-30 11:24:56 -0500330 {
331 if ( nlsr->debugging )
332 printf("Sending Info Content is successful \n");
333 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600334 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Sending info Content"
335 " is successful \n");
akmhoque7b791452012-10-30 11:24:56 -0500336 }
337
akmhoque53f64222012-09-05 13:57:51 -0500338
339
akmhoquee1dd7772013-02-24 14:21:49 -0600340 struct name_prefix *nbr=(struct name_prefix * )malloc(sizeof(struct name_prefix));
akmhoque03004e62012-09-06 01:12:28 -0500341 get_lsa_identifier(nbr,selfp,info,-1);
akmhoque7b791452012-10-30 11:24:56 -0500342
343 if ( nlsr->debugging )
akmhoque3d319d42013-02-20 11:08:32 -0600344 printf("Neighbor : %s Length : %d Status : %d\n",nbr->name,nbr->length,
345 get_adjacent_status(nbr));
akmhoque7b791452012-10-30 11:24:56 -0500346 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600347 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Neighbor : %s Length : %d"
348 " Status : %d\n",nbr->name,nbr->length,get_adjacent_status(nbr));
akmhoque03004e62012-09-06 01:12:28 -0500349
akmhoque53f64222012-09-05 13:57:51 -0500350
akmhoque3d319d42013-02-20 11:08:32 -0600351 if( get_adjacent_status(nbr) == 0 && get_timed_out_number(nbr) >=
352 nlsr->interest_retry )
akmhoque53f64222012-09-05 13:57:51 -0500353 {
akmhoqueb8195202012-09-25 11:53:23 -0500354 update_adjacent_timed_out_zero_to_adl(nbr);
akmhoque53f64222012-09-05 13:57:51 -0500355 send_info_interest_to_neighbor(nbr);
356 }
357
akmhoque83a94da2013-03-15 01:38:21 -0500358 if ( nbr->name != NULL )
359 free(nbr->name);
360 if ( nbr != NULL )
361 free(nbr);
akmhoque284056b2013-03-15 01:20:16 -0500362 ccn_charbuf_destroy(&resultbuf);
akmhoque53f64222012-09-05 13:57:51 -0500363 }
akmhoque03004e62012-09-06 01:12:28 -0500364
akmhoque6e2ba842013-03-05 19:35:26 -0600365 //ccn_charbuf_destroy(&data);
akmhoque03004e62012-09-06 01:12:28 -0500366 ccn_charbuf_destroy(&name);
akmhoque53f64222012-09-05 13:57:51 -0500367
akmhoquebf1aa832012-08-13 13:26:59 -0500368}
369
370
akmhoque7ab49a32013-02-20 11:27:51 -0600371/**
372* Call back function registered in ccnd to get all content coming to NLSR
373* application
374*/
akmhoque03004e62012-09-06 01:12:28 -0500375
akmhoque53f64222012-09-05 13:57:51 -0500376enum ccn_upcall_res incoming_content(struct ccn_closure* selfp,
377 enum ccn_upcall_kind kind, struct ccn_upcall_info* info)
akmhoqued79438d2012-08-27 13:31:42 -0500378{
379
akmhoqueffacaa82012-09-13 17:48:30 -0500380 nlsr_lock();
akmhoque03004e62012-09-06 01:12:28 -0500381
akmhoque53f64222012-09-05 13:57:51 -0500382 switch(kind) {
383 case CCN_UPCALL_FINAL:
384 break;
385 case CCN_UPCALL_CONTENT:
akmhoque7b791452012-10-30 11:24:56 -0500386 if ( nlsr->debugging )
387 printf("Content Received for Name: ");
388 if ( nlsr->detailed_logging )
389 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Content Received for Name: ");
390
akmhoque03004e62012-09-06 01:12:28 -0500391 struct ccn_charbuf*c;
392 c=ccn_charbuf_create();
393 ccn_uri_append(c,info->interest_ccnb,info->pi->offset[CCN_PI_E],0);
akmhoque7b791452012-10-30 11:24:56 -0500394 if ( nlsr->debugging )
395 printf("%s\n",ccn_charbuf_as_string(c));
396 if ( nlsr->detailed_logging )
397 writeLogg(__FILE__,__FUNCTION__,__LINE__,"%s\n",ccn_charbuf_as_string(c));
398
akmhoque03004e62012-09-06 01:12:28 -0500399 ccn_charbuf_destroy(&c);
400
401 process_incoming_content(selfp,info);
akmhoqued79438d2012-08-27 13:31:42 -0500402
akmhoque53f64222012-09-05 13:57:51 -0500403 break;
404 case CCN_UPCALL_INTEREST_TIMED_OUT:
akmhoqueedb68d92013-03-05 10:18:16 -0600405 //printf("Interest Timed Out Received for Name: ");
406 if ( nlsr->debugging )
407 printf("Interest Timed Out Received for Name: ");
408 if ( nlsr->detailed_logging )
409 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Interest Timed Out Receiv"
akmhoque3d319d42013-02-20 11:08:32 -0600410 "ed for Name: ");
akmhoque03004e62012-09-06 01:12:28 -0500411
akmhoqueedb68d92013-03-05 10:18:16 -0600412 struct ccn_charbuf*ito;
413 ito=ccn_charbuf_create();
414 ccn_uri_append(ito,info->interest_ccnb,info->pi->offset[CCN_PI_E],0);
415 if ( nlsr->debugging )
416 printf("%s\n",ccn_charbuf_as_string(ito));
417 if ( nlsr->detailed_logging )
418 writeLogg(__FILE__,__FUNCTION__,__LINE__,"%s\n",ccn_charbuf_as_string(ito));
419 ccn_charbuf_destroy(&ito);
akmhoque03004e62012-09-06 01:12:28 -0500420
akmhoqueedb68d92013-03-05 10:18:16 -0600421 process_incoming_timed_out_interest(selfp,info);
akmhoqued79438d2012-08-27 13:31:42 -0500422
akmhoque53f64222012-09-05 13:57:51 -0500423 break;
akmhoqueedb68d92013-03-05 10:18:16 -0600424
425 case CCN_UPCALL_CONTENT_UNVERIFIED:
426 if ( nlsr->debugging )
427 printf("Unverified Content Received ..Waiting for verification\n");
428 if ( nlsr->detailed_logging )
429 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Unverified Content"
430 " Received ..Waiting for verification\n");
akmhoque6e2ba842013-03-05 19:35:26 -0600431 //return CCN_UPCALL_RESULT_VERIFY;
akmhoque4637d9d2013-03-08 06:52:00 -0600432 process_incoming_content(selfp,info);
akmhoqueedb68d92013-03-05 10:18:16 -0600433 break;
434
akmhoque53f64222012-09-05 13:57:51 -0500435 default:
436 fprintf(stderr, "Unexpected response of kind %d\n", kind);
akmhoqueedb68d92013-03-05 10:18:16 -0600437 if ( nlsr->debugging )
438 printf("Unexpected response of kind %d\n", kind);
439 if ( nlsr->detailed_logging )
440 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Unexpected response of "
akmhoque3d319d42013-02-20 11:08:32 -0600441 "kind %d\n", kind);
akmhoqueffacaa82012-09-13 17:48:30 -0500442 break;
akmhoque53f64222012-09-05 13:57:51 -0500443 }
akmhoqueffacaa82012-09-13 17:48:30 -0500444
445 nlsr_unlock();
akmhoqued79438d2012-08-27 13:31:42 -0500446
akmhoque53f64222012-09-05 13:57:51 -0500447 return CCN_UPCALL_RESULT_OK;
akmhoqued79438d2012-08-27 13:31:42 -0500448}
449
akmhoque7ab49a32013-02-20 11:27:51 -0600450/**
451* process any incoming content to NLSR from ccnd
452*/
akmhoque03004e62012-09-06 01:12:28 -0500453
akmhoqued79438d2012-08-27 13:31:42 -0500454void
akmhoque53f64222012-09-05 13:57:51 -0500455process_incoming_content(struct ccn_closure *selfp, struct ccn_upcall_info* info)
akmhoqued79438d2012-08-27 13:31:42 -0500456{
akmhoque7b791452012-10-30 11:24:56 -0500457 if ( nlsr->debugging )
458 printf("process_incoming_content called \n");
459 if ( nlsr->detailed_logging )
460 writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_content called \n");
akmhoque53f64222012-09-05 13:57:51 -0500461
462 const unsigned char *comp_ptr1;
463 size_t comp_size;
464 int res,i;
465 int nlsr_position=0;
466 int name_comps=(int)info->interest_comps->n;
467
468 for(i=0;i<name_comps;i++)
469 {
470 res=ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,i,"nlsr");
471 if( res == 0)
472 {
473 nlsr_position=i;
474 break;
475 }
476 }
477
akmhoque3d319d42013-02-20 11:08:32 -0600478 res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,
479 nlsr_position+1,&comp_ptr1, &comp_size);
akmhoque53f64222012-09-05 13:57:51 -0500480
akmhoque53f64222012-09-05 13:57:51 -0500481
482 if(!strcmp((char *)comp_ptr1,"info"))
483 {
484 process_incoming_content_info(selfp,info);
485 }
akmhoque03004e62012-09-06 01:12:28 -0500486
akmhoque53f64222012-09-05 13:57:51 -0500487}
488
akmhoque7ab49a32013-02-20 11:27:51 -0600489/**
490* process any incoming "info" content to NLSR from ccnd
491*/
akmhoque03004e62012-09-06 01:12:28 -0500492
akmhoque53f64222012-09-05 13:57:51 -0500493void
akmhoque3d319d42013-02-20 11:08:32 -0600494process_incoming_content_info(struct ccn_closure *selfp,
495 struct ccn_upcall_info* info)
akmhoque53f64222012-09-05 13:57:51 -0500496{
akmhoque7b791452012-10-30 11:24:56 -0500497 if ( nlsr->debugging )
498 printf("process_incoming_content_info called \n");
499 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600500 writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_content_info"
501 " called \n");
akmhoque03004e62012-09-06 01:12:28 -0500502
akmhoque53f64222012-09-05 13:57:51 -0500503 struct name_prefix *nbr=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
504 get_nbr(nbr,selfp,info);
akmhoque03004e62012-09-06 01:12:28 -0500505
akmhoque7b791452012-10-30 11:24:56 -0500506 if ( nlsr->debugging )
akmhoque3d319d42013-02-20 11:08:32 -0600507 printf("Info Content Received For Neighbor: %s Length:%d\n",nbr->name,
508 nbr->length);
akmhoque7b791452012-10-30 11:24:56 -0500509 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600510 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Info Content Received For Nei"
511 "ghbor: %s Length:%d\n",nbr->name,nbr->length);
akmhoque03004e62012-09-06 01:12:28 -0500512
akmhoquefc7016f2013-03-08 07:17:14 -0600513
akmhoque4ef95e72013-03-22 09:51:54 -0500514 /*
akmhoque6e2ba842013-03-05 19:35:26 -0600515 if ( contain_key_name(info->content_ccnb, info->pco) == 1){
akmhoque237239c2013-03-18 10:29:26 -0500516 int res_verify=-1;
517 int key_exists=0;
518 struct ccn_charbuf *key_name=get_key_name(info->content_ccnb, info->pco);
519 struct ccn_charbuf *key_uri = ccn_charbuf_create();
520 ccn_uri_append(key_uri, key_name->buf, key_name->length, 0);
521 key_exists=does_key_exist(ccn_charbuf_as_string(key_uri));
522 int key_type=get_key_type_from_key_name(key_name);
523
524 if ( res_verify == 1 && key_type == NLSR_KEY ){
525 res_verify=0;
526 }
527 else{
528 res_verify=verify_key(info->content_ccnb,info->pco,0);
529 }
akmhoque6e2ba842013-03-05 19:35:26 -0600530
akmhoque237239c2013-03-18 10:29:26 -0500531 //int res_verify=verify_key(info->content_ccnb,info->pco,0);
akmhoque03004e62012-09-06 01:12:28 -0500532
akmhoqueb7958182013-03-11 12:03:54 -0500533 if ( res_verify != 0 ){
akmhoque1162d852013-03-15 01:07:00 -0500534 if ( nlsr->debugging )
535 printf("Error in verfiying keys !! :( \n");
akmhoque237239c2013-03-18 10:29:26 -0500536 ccn_charbuf_destroy(&key_name);
537 ccn_charbuf_destroy(&key_uri);
akmhoqueb7958182013-03-11 12:03:54 -0500538 }
539 else{
akmhoque237239c2013-03-18 10:29:26 -0500540 if ( key_exists == 0 )
541 add_key(ccn_charbuf_as_string(key_uri));
542 ccn_charbuf_destroy(&key_name);
543 ccn_charbuf_destroy(&key_uri);
akmhoque1162d852013-03-15 01:07:00 -0500544 if ( nlsr->debugging )
545 printf("Key verification is successful :)\n");
akmhoqueb7958182013-03-11 12:03:54 -0500546 update_adjacent_timed_out_zero_to_adl(nbr);
547 update_adjacent_status_to_adl(nbr,NBR_ACTIVE);
548 print_adjacent_from_adl();
akmhoque53f64222012-09-05 13:57:51 -0500549
akmhoqueb7958182013-03-11 12:03:54 -0500550 if(!nlsr->is_build_adj_lsa_sheduled){
551 if ( nlsr->debugging )
552 printf("Scheduling Build and Install Adj LSA...\n");
553 if ( nlsr->detailed_logging )
554 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Scheduling"
akmhoque6e2ba842013-03-05 19:35:26 -0600555 "Build and Install Adj LSA...\n");
akmhoqueb7958182013-03-11 12:03:54 -0500556 nlsr->event_build_adj_lsa = ccn_schedule_event(
akmhoque6e2ba842013-03-05 19:35:26 -0600557 nlsr->sched, 100000,
akmhoque3d319d42013-02-20 11:08:32 -0600558 &build_and_install_adj_lsa, NULL, 0);
akmhoqueb7958182013-03-11 12:03:54 -0500559 nlsr->is_build_adj_lsa_sheduled=1;
560 }
561 else{
562 if ( nlsr->debugging )
563 printf("Build and Install Adj LSA already scheduled\n");
564 if ( nlsr->detailed_logging )
565 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Build and Install Adj LSA"
akmhoque3d319d42013-02-20 11:08:32 -0600566 " already scheduled\n");
akmhoqueb7958182013-03-11 12:03:54 -0500567 }
akmhoque6e2ba842013-03-05 19:35:26 -0600568
akmhoqueb7958182013-03-11 12:03:54 -0500569 }
akmhoque53f64222012-09-05 13:57:51 -0500570 }
akmhoque4ef95e72013-03-22 09:51:54 -0500571 */
572
akmhoque10c9a212013-03-08 07:05:18 -0600573 update_adjacent_timed_out_zero_to_adl(nbr);
574 update_adjacent_status_to_adl(nbr,NBR_ACTIVE);
575 print_adjacent_from_adl();
576
577 if(!nlsr->is_build_adj_lsa_sheduled){
578 if ( nlsr->debugging )
579 printf("Scheduling Build and Install Adj LSA...\n");
580 if ( nlsr->detailed_logging )
581 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Scheduling"
582 "Build and Install Adj LSA...\n");
583 nlsr->event_build_adj_lsa = ccn_schedule_event(
584 nlsr->sched, 100000,
585 &build_and_install_adj_lsa, NULL, 0);
586 nlsr->is_build_adj_lsa_sheduled=1;
587 }
588 else{
589 if ( nlsr->debugging )
590 printf("Build and Install Adj LSA already scheduled\n");
591 if ( nlsr->detailed_logging )
592 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Build and Install Adj LSA"
593 " already scheduled\n");
594 }
akmhoque03004e62012-09-06 01:12:28 -0500595
akmhoque4ef95e72013-03-22 09:51:54 -0500596
akmhoque83a94da2013-03-15 01:38:21 -0500597 if ( nbr->name != NULL )
598 free(nbr->name);
599 if ( nbr != NULL )
600 free(nbr);
akmhoque03004e62012-09-06 01:12:28 -0500601
akmhoque53f64222012-09-05 13:57:51 -0500602
603}
604
akmhoque7ab49a32013-02-20 11:27:51 -0600605/**
606* process any incoming interest timed out content to NLSR from ccnd
607*/
akmhoque53f64222012-09-05 13:57:51 -0500608
akmhoque03004e62012-09-06 01:12:28 -0500609
akmhoque53f64222012-09-05 13:57:51 -0500610void
akmhoque3d319d42013-02-20 11:08:32 -0600611process_incoming_timed_out_interest(struct ccn_closure* selfp,
612 struct ccn_upcall_info* info)
akmhoque53f64222012-09-05 13:57:51 -0500613{
akmhoque3171d652012-11-13 11:44:33 -0600614
615
616 if ( nlsr->debugging )
617 printf("process_incoming_timed_out_interest called \n");
618 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600619 writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_timed_out_int"
620 "erest called \n");
akmhoque3171d652012-11-13 11:44:33 -0600621
akmhoque53f64222012-09-05 13:57:51 -0500622 int res,i;
623 int nlsr_position=0;
624 int name_comps=(int)info->interest_comps->n;
625
626 for(i=0;i<name_comps;i++)
627 {
628 res=ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,i,"nlsr");
629 if( res == 0)
630 {
631 nlsr_position=i;
632 break;
633 }
634 }
635
akmhoque3d319d42013-02-20 11:08:32 -0600636 if(ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,
637 nlsr_position+1,"info") == 0)
akmhoque53f64222012-09-05 13:57:51 -0500638 {
639 process_incoming_timed_out_interest_info(selfp,info);
640 }
641}
642
akmhoque7ab49a32013-02-20 11:27:51 -0600643/**
644* process any incoming "info" interest timed out content to NLSR from ccnd
645*/
646
akmhoque53f64222012-09-05 13:57:51 -0500647void
akmhoque3d319d42013-02-20 11:08:32 -0600648process_incoming_timed_out_interest_info(struct ccn_closure* selfp, struct
649 ccn_upcall_info* info)
akmhoque53f64222012-09-05 13:57:51 -0500650{
akmhoque3171d652012-11-13 11:44:33 -0600651
652 if ( nlsr->debugging )
653 printf("process_incoming_timed_out_interest_info called \n");
654 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600655 writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_timed_out_int"
656 "erest_info called \n");
akmhoque53f64222012-09-05 13:57:51 -0500657
658 struct name_prefix *nbr=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
659 get_nbr(nbr,selfp,info);
660
akmhoque3171d652012-11-13 11:44:33 -0600661 if ( nlsr->debugging )
akmhoque3d319d42013-02-20 11:08:32 -0600662 printf("Info Interest Timed Out for for Neighbor: %s Length:%d\n",
663 nbr->name,nbr->length);
akmhoque3171d652012-11-13 11:44:33 -0600664 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600665 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Info Interest Timed Out for"
666 " Neighbor: %s Length:%d\n",nbr->name,nbr->length);
akmhoque3171d652012-11-13 11:44:33 -0600667
akmhoque03004e62012-09-06 01:12:28 -0500668
669
akmhoque53f64222012-09-05 13:57:51 -0500670 update_adjacent_timed_out_to_adl(nbr,1);
671 print_adjacent_from_adl();
672 int timed_out=get_timed_out_number(nbr);
akmhoque03004e62012-09-06 01:12:28 -0500673
akmhoque3171d652012-11-13 11:44:33 -0600674 if ( nlsr->debugging )
akmhoque3d319d42013-02-20 11:08:32 -0600675 printf("Neighbor: %s Info Interest Timed Out: %d times\n",nbr->name,
676 timed_out);
akmhoque3171d652012-11-13 11:44:33 -0600677 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600678 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Neighbor: %s Info Interest "
679 "Timed Out: %d times\n",nbr->name,timed_out);
akmhoque3171d652012-11-13 11:44:33 -0600680
akmhoque53f64222012-09-05 13:57:51 -0500681
682 if(timed_out<nlsr->interest_retry && timed_out>0) // use configured variables
683 {
akmhoque53f64222012-09-05 13:57:51 -0500684 send_info_interest_to_neighbor(nbr);
685 }
686 else
akmhoque3171d652012-11-13 11:44:33 -0600687 {
akmhoque53f64222012-09-05 13:57:51 -0500688 update_adjacent_status_to_adl(nbr,NBR_DOWN);
689 if(!nlsr->is_build_adj_lsa_sheduled)
690 {
akmhoque3d319d42013-02-20 11:08:32 -0600691 nlsr->event_build_adj_lsa = ccn_schedule_event(nlsr->sched, 1000,
692 &build_and_install_adj_lsa, NULL, 0);
akmhoque53f64222012-09-05 13:57:51 -0500693 nlsr->is_build_adj_lsa_sheduled=1;
694 }
695 }
696
akmhoque284056b2013-03-15 01:20:16 -0500697 if ( nbr->name != NULL )
698 free(nbr->name);
699 if ( nbr != NULL )
700 free(nbr);
akmhoque03004e62012-09-06 01:12:28 -0500701
akmhoque53f64222012-09-05 13:57:51 -0500702
703}
704
akmhoque7ab49a32013-02-20 11:27:51 -0600705/**
706* send "info" interest to each and every neighbor in ADL and also schedule for
707* itself for periodical sending of "info" interest
708*/
akmhoque29c1db52012-09-07 14:47:43 -0500709
akmhoque03004e62012-09-06 01:12:28 -0500710int
akmhoque3d319d42013-02-20 11:08:32 -0600711send_info_interest(struct ccn_schedule *sched, void *clienth,
712 struct ccn_scheduled_event *ev, int flags)
akmhoque53f64222012-09-05 13:57:51 -0500713{
akmhoqueffacaa82012-09-13 17:48:30 -0500714 if(flags == CCN_SCHEDULE_CANCEL)
715 {
716 return -1;
717 }
718
719 nlsr_lock();
720
akmhoque3171d652012-11-13 11:44:33 -0600721 if ( nlsr->debugging )
722 printf("send_info_interest called \n");
723 if ( nlsr->detailed_logging )
724 writeLogg(__FILE__,__FUNCTION__,__LINE__,"send_info_interest called \n");
725
726 if ( nlsr->debugging )
727 printf("\n");
728 if ( nlsr->detailed_logging )
729 writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
akmhoqued79438d2012-08-27 13:31:42 -0500730
akmhoque53f64222012-09-05 13:57:51 -0500731 int adl_element,i;
akmhoque53f64222012-09-05 13:57:51 -0500732 struct ndn_neighbor *nbr;
733
734 struct hashtb_enumerator ee;
735 struct hashtb_enumerator *e = &ee;
736
737 hashtb_start(nlsr->adl, e);
738 adl_element=hashtb_n(nlsr->adl);
739
740 for(i=0;i<adl_element;i++)
741 {
742 nbr=e->data;
743 send_info_interest_to_neighbor(nbr->neighbor);
744 hashtb_next(e);
745 }
akmhoque53f64222012-09-05 13:57:51 -0500746 hashtb_end(e);
747
akmhoqueffacaa82012-09-13 17:48:30 -0500748 nlsr_unlock();
749
akmhoque3d319d42013-02-20 11:08:32 -0600750 nlsr->event = ccn_schedule_event(nlsr->sched, 60000000, &send_info_interest,
751 NULL, 0);
akmhoque9fa58a82012-10-05 07:56:02 -0500752
akmhoque53f64222012-09-05 13:57:51 -0500753 return 0;
754}
755
akmhoque7ab49a32013-02-20 11:27:51 -0600756
757/**
758* send "info" interest neighbor nbr
759*
760*/
761
akmhoque53f64222012-09-05 13:57:51 -0500762void
763send_info_interest_to_neighbor(struct name_prefix *nbr)
764{
akmhoque3171d652012-11-13 11:44:33 -0600765
766 if ( nlsr->debugging )
767 printf("send_info_interest_to_neighbor called \n");
768 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600769 writeLogg(__FILE__,__FUNCTION__,__LINE__,"send_info_interest_to_neighbor"
770 " called \n");
akmhoque3171d652012-11-13 11:44:33 -0600771
akmhoqued79438d2012-08-27 13:31:42 -0500772
773 int res;
akmhoque53f64222012-09-05 13:57:51 -0500774 char info_str[5];
775 char nlsr_str[5];
akmhoque53f64222012-09-05 13:57:51 -0500776
akmhoqued79438d2012-08-27 13:31:42 -0500777 memset(&nlsr_str,0,5);
778 sprintf(nlsr_str,"nlsr");
779 memset(&info_str,0,5);
780 sprintf(info_str,"info");
781
akmhoque53f64222012-09-05 13:57:51 -0500782
783 struct ccn_charbuf *name;
akmhoqued79438d2012-08-27 13:31:42 -0500784 name=ccn_charbuf_create();
akmhoqued79438d2012-08-27 13:31:42 -0500785
akmhoque3d319d42013-02-20 11:08:32 -0600786 char *int_name=(char *)malloc(strlen(nbr->name)+1+strlen(nlsr_str)+1+
787 strlen(info_str)+strlen(nlsr->router_name)+1);
788 memset(int_name,0,strlen(nbr->name)+1+strlen(nlsr_str)+1+strlen(info_str)+
789 strlen(nlsr->router_name)+1);
akmhoque53f64222012-09-05 13:57:51 -0500790 memcpy(int_name+strlen(int_name),nbr->name,strlen(nbr->name));
791 memcpy(int_name+strlen(int_name),"/",1);
792 memcpy(int_name+strlen(int_name),nlsr_str,strlen(nlsr_str));
793 memcpy(int_name+strlen(int_name),"/",1);
794 memcpy(int_name+strlen(int_name),info_str,strlen(info_str));
akmhoque03004e62012-09-06 01:12:28 -0500795 memcpy(int_name+strlen(int_name),nlsr->router_name,strlen(nlsr->router_name));
akmhoque53f64222012-09-05 13:57:51 -0500796
797
798 res=ccn_name_from_uri(name,int_name);
799 if ( res >=0 )
800 {
akmhoque53f64222012-09-05 13:57:51 -0500801 /* adding InterestLifeTime and InterestScope filter */
802
803 struct ccn_charbuf *templ;
804 templ = ccn_charbuf_create();
805
806 ccn_charbuf_append_tt(templ, CCN_DTAG_Interest, CCN_DTAG);
807 ccn_charbuf_append_tt(templ, CCN_DTAG_Name, CCN_DTAG);
808 ccn_charbuf_append_closer(templ); /* </Name> */
akmhoque03004e62012-09-06 01:12:28 -0500809 ccn_charbuf_append_tt(templ, CCN_DTAG_Scope, CCN_DTAG);
810 ccn_charbuf_append_tt(templ, 1, CCN_UDATA);
akmhoqueb77b95f2013-02-08 12:28:47 -0600811 /* Adding InterestLifeTime and InterestScope filter done */
akmhoque3d319d42013-02-20 11:08:32 -0600812 ccn_charbuf_append(templ, "2", 1); //scope of interest: 2
813 //(not further than next host)
akmhoque03004e62012-09-06 01:12:28 -0500814 ccn_charbuf_append_closer(templ); /* </Scope> */
akmhoque53f64222012-09-05 13:57:51 -0500815
816 appendLifetime(templ,nlsr->interest_resend_time);
akmhoqueb77b95f2013-02-08 12:28:47 -0600817 unsigned int face_id=get_next_hop_face_from_adl(nbr->name);
818 ccnb_tagged_putf(templ, CCN_DTAG_FaceID, "%u", face_id);
akmhoque53f64222012-09-05 13:57:51 -0500819 ccn_charbuf_append_closer(templ); /* </Interest> */
akmhoqueb77b95f2013-02-08 12:28:47 -0600820
akmhoque53f64222012-09-05 13:57:51 -0500821
akmhoque3171d652012-11-13 11:44:33 -0600822 if ( nlsr->debugging )
akmhoque3d319d42013-02-20 11:08:32 -0600823 printf("Sending info interest on name prefix : %s through Face:%u\n"
824 ,int_name,face_id);
akmhoque3171d652012-11-13 11:44:33 -0600825 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600826 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Sending info interest on"
827 "name prefix : %s through Face:%u\n",int_name,face_id);
akmhoque53f64222012-09-05 13:57:51 -0500828
829 res=ccn_express_interest(nlsr->ccn,name,&(nlsr->in_content),templ);
830
831 if ( res >= 0 )
akmhoque3171d652012-11-13 11:44:33 -0600832 {
833 if ( nlsr->debugging )
834 printf("Info interest sending Successfull .... \n");
835 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600836 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Info"
837 "interest sending Successfull .... \n");
akmhoque3171d652012-11-13 11:44:33 -0600838 }
akmhoque53f64222012-09-05 13:57:51 -0500839 ccn_charbuf_destroy(&templ);
840 }
akmhoque7adb2772013-03-05 16:30:59 -0600841
akmhoque53f64222012-09-05 13:57:51 -0500842 ccn_charbuf_destroy(&name);
843 free(int_name);
akmhoquec06dcf12013-02-20 08:13:37 -0600844}