blob: 1cdca2543a066b3a2e05b3a96a147ebbd58a6637 [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);
285
286
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
akmhoque53f64222012-09-05 13:57:51 -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
304 res=sign_content_with_user_defined_keystore(name,
305 resultbuf,
306 "info",
307 strlen("info"),
308 nlsr->keystore_path,
309 nlsr->keystore_passphrase,
310 nlsr->root_key_prefix,
311 nlsr->site_name,
akmhoque2fafaa52013-03-22 05:10:52 -0500312 nlsr->router_name,
313 10);
akmhoque6e2ba842013-03-05 19:35:26 -0600314
315
316 //res= ccn_sign_content(nlsr->ccn, data, name, &sp, "info",strlen("info"));
akmhoque53f64222012-09-05 13:57:51 -0500317 if(res >= 0)
akmhoque7b791452012-10-30 11:24:56 -0500318 {
319 if ( nlsr->debugging )
320 printf("Signing info Content is successful \n");
321 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600322 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Signing info Content"
323 " is successful \n");
akmhoque53f64222012-09-05 13:57:51 -0500324
akmhoque7b791452012-10-30 11:24:56 -0500325 }
akmhoque6e2ba842013-03-05 19:35:26 -0600326 res=ccn_put(nlsr->ccn,resultbuf->buf,resultbuf->length);
akmhoque53f64222012-09-05 13:57:51 -0500327 if(res >= 0)
akmhoque7b791452012-10-30 11:24:56 -0500328 {
329 if ( nlsr->debugging )
330 printf("Sending Info Content is successful \n");
331 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600332 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Sending info Content"
333 " is successful \n");
akmhoque7b791452012-10-30 11:24:56 -0500334 }
335
akmhoque53f64222012-09-05 13:57:51 -0500336
337
akmhoquee1dd7772013-02-24 14:21:49 -0600338 struct name_prefix *nbr=(struct name_prefix * )malloc(sizeof(struct name_prefix));
akmhoque03004e62012-09-06 01:12:28 -0500339 get_lsa_identifier(nbr,selfp,info,-1);
akmhoque7b791452012-10-30 11:24:56 -0500340
341 if ( nlsr->debugging )
akmhoque3d319d42013-02-20 11:08:32 -0600342 printf("Neighbor : %s Length : %d Status : %d\n",nbr->name,nbr->length,
343 get_adjacent_status(nbr));
akmhoque7b791452012-10-30 11:24:56 -0500344 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600345 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Neighbor : %s Length : %d"
346 " Status : %d\n",nbr->name,nbr->length,get_adjacent_status(nbr));
akmhoque03004e62012-09-06 01:12:28 -0500347
akmhoque53f64222012-09-05 13:57:51 -0500348
akmhoque3d319d42013-02-20 11:08:32 -0600349 if( get_adjacent_status(nbr) == 0 && get_timed_out_number(nbr) >=
350 nlsr->interest_retry )
akmhoque53f64222012-09-05 13:57:51 -0500351 {
akmhoqueb8195202012-09-25 11:53:23 -0500352 update_adjacent_timed_out_zero_to_adl(nbr);
akmhoque53f64222012-09-05 13:57:51 -0500353 send_info_interest_to_neighbor(nbr);
354 }
355
akmhoque83a94da2013-03-15 01:38:21 -0500356 if ( nbr->name != NULL )
357 free(nbr->name);
358 if ( nbr != NULL )
359 free(nbr);
akmhoque284056b2013-03-15 01:20:16 -0500360 ccn_charbuf_destroy(&resultbuf);
akmhoque53f64222012-09-05 13:57:51 -0500361 }
akmhoque03004e62012-09-06 01:12:28 -0500362
akmhoque6e2ba842013-03-05 19:35:26 -0600363 //ccn_charbuf_destroy(&data);
akmhoque03004e62012-09-06 01:12:28 -0500364 ccn_charbuf_destroy(&name);
akmhoque53f64222012-09-05 13:57:51 -0500365
akmhoquebf1aa832012-08-13 13:26:59 -0500366}
367
368
akmhoque7ab49a32013-02-20 11:27:51 -0600369/**
370* Call back function registered in ccnd to get all content coming to NLSR
371* application
372*/
akmhoque03004e62012-09-06 01:12:28 -0500373
akmhoque53f64222012-09-05 13:57:51 -0500374enum ccn_upcall_res incoming_content(struct ccn_closure* selfp,
375 enum ccn_upcall_kind kind, struct ccn_upcall_info* info)
akmhoqued79438d2012-08-27 13:31:42 -0500376{
377
akmhoqueffacaa82012-09-13 17:48:30 -0500378 nlsr_lock();
akmhoque03004e62012-09-06 01:12:28 -0500379
akmhoque53f64222012-09-05 13:57:51 -0500380 switch(kind) {
381 case CCN_UPCALL_FINAL:
382 break;
383 case CCN_UPCALL_CONTENT:
akmhoque7b791452012-10-30 11:24:56 -0500384 if ( nlsr->debugging )
385 printf("Content Received for Name: ");
386 if ( nlsr->detailed_logging )
387 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Content Received for Name: ");
388
akmhoque03004e62012-09-06 01:12:28 -0500389 struct ccn_charbuf*c;
390 c=ccn_charbuf_create();
391 ccn_uri_append(c,info->interest_ccnb,info->pi->offset[CCN_PI_E],0);
akmhoque7b791452012-10-30 11:24:56 -0500392 if ( nlsr->debugging )
393 printf("%s\n",ccn_charbuf_as_string(c));
394 if ( nlsr->detailed_logging )
395 writeLogg(__FILE__,__FUNCTION__,__LINE__,"%s\n",ccn_charbuf_as_string(c));
396
akmhoque03004e62012-09-06 01:12:28 -0500397 ccn_charbuf_destroy(&c);
398
399 process_incoming_content(selfp,info);
akmhoqued79438d2012-08-27 13:31:42 -0500400
akmhoque53f64222012-09-05 13:57:51 -0500401 break;
402 case CCN_UPCALL_INTEREST_TIMED_OUT:
akmhoqueedb68d92013-03-05 10:18:16 -0600403 //printf("Interest Timed Out Received for Name: ");
404 if ( nlsr->debugging )
405 printf("Interest Timed Out Received for Name: ");
406 if ( nlsr->detailed_logging )
407 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Interest Timed Out Receiv"
akmhoque3d319d42013-02-20 11:08:32 -0600408 "ed for Name: ");
akmhoque03004e62012-09-06 01:12:28 -0500409
akmhoqueedb68d92013-03-05 10:18:16 -0600410 struct ccn_charbuf*ito;
411 ito=ccn_charbuf_create();
412 ccn_uri_append(ito,info->interest_ccnb,info->pi->offset[CCN_PI_E],0);
413 if ( nlsr->debugging )
414 printf("%s\n",ccn_charbuf_as_string(ito));
415 if ( nlsr->detailed_logging )
416 writeLogg(__FILE__,__FUNCTION__,__LINE__,"%s\n",ccn_charbuf_as_string(ito));
417 ccn_charbuf_destroy(&ito);
akmhoque03004e62012-09-06 01:12:28 -0500418
akmhoqueedb68d92013-03-05 10:18:16 -0600419 process_incoming_timed_out_interest(selfp,info);
akmhoqued79438d2012-08-27 13:31:42 -0500420
akmhoque53f64222012-09-05 13:57:51 -0500421 break;
akmhoqueedb68d92013-03-05 10:18:16 -0600422
423 case CCN_UPCALL_CONTENT_UNVERIFIED:
424 if ( nlsr->debugging )
425 printf("Unverified Content Received ..Waiting for verification\n");
426 if ( nlsr->detailed_logging )
427 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Unverified Content"
428 " Received ..Waiting for verification\n");
akmhoque6e2ba842013-03-05 19:35:26 -0600429 //return CCN_UPCALL_RESULT_VERIFY;
akmhoque4637d9d2013-03-08 06:52:00 -0600430 process_incoming_content(selfp,info);
akmhoqueedb68d92013-03-05 10:18:16 -0600431 break;
432
akmhoque53f64222012-09-05 13:57:51 -0500433 default:
434 fprintf(stderr, "Unexpected response of kind %d\n", kind);
akmhoqueedb68d92013-03-05 10:18:16 -0600435 if ( nlsr->debugging )
436 printf("Unexpected response of kind %d\n", kind);
437 if ( nlsr->detailed_logging )
438 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Unexpected response of "
akmhoque3d319d42013-02-20 11:08:32 -0600439 "kind %d\n", kind);
akmhoqueffacaa82012-09-13 17:48:30 -0500440 break;
akmhoque53f64222012-09-05 13:57:51 -0500441 }
akmhoqueffacaa82012-09-13 17:48:30 -0500442
443 nlsr_unlock();
akmhoqued79438d2012-08-27 13:31:42 -0500444
akmhoque53f64222012-09-05 13:57:51 -0500445 return CCN_UPCALL_RESULT_OK;
akmhoqued79438d2012-08-27 13:31:42 -0500446}
447
akmhoque7ab49a32013-02-20 11:27:51 -0600448/**
449* process any incoming content to NLSR from ccnd
450*/
akmhoque03004e62012-09-06 01:12:28 -0500451
akmhoqued79438d2012-08-27 13:31:42 -0500452void
akmhoque53f64222012-09-05 13:57:51 -0500453process_incoming_content(struct ccn_closure *selfp, struct ccn_upcall_info* info)
akmhoqued79438d2012-08-27 13:31:42 -0500454{
akmhoque7b791452012-10-30 11:24:56 -0500455 if ( nlsr->debugging )
456 printf("process_incoming_content called \n");
457 if ( nlsr->detailed_logging )
458 writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_content called \n");
akmhoque53f64222012-09-05 13:57:51 -0500459
460 const unsigned char *comp_ptr1;
461 size_t comp_size;
462 int res,i;
463 int nlsr_position=0;
464 int name_comps=(int)info->interest_comps->n;
465
466 for(i=0;i<name_comps;i++)
467 {
468 res=ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,i,"nlsr");
469 if( res == 0)
470 {
471 nlsr_position=i;
472 break;
473 }
474 }
475
akmhoque3d319d42013-02-20 11:08:32 -0600476 res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,
477 nlsr_position+1,&comp_ptr1, &comp_size);
akmhoque53f64222012-09-05 13:57:51 -0500478
akmhoque53f64222012-09-05 13:57:51 -0500479
480 if(!strcmp((char *)comp_ptr1,"info"))
481 {
482 process_incoming_content_info(selfp,info);
483 }
akmhoque03004e62012-09-06 01:12:28 -0500484
akmhoque53f64222012-09-05 13:57:51 -0500485}
486
akmhoque7ab49a32013-02-20 11:27:51 -0600487/**
488* process any incoming "info" content to NLSR from ccnd
489*/
akmhoque03004e62012-09-06 01:12:28 -0500490
akmhoque53f64222012-09-05 13:57:51 -0500491void
akmhoque3d319d42013-02-20 11:08:32 -0600492process_incoming_content_info(struct ccn_closure *selfp,
493 struct ccn_upcall_info* info)
akmhoque53f64222012-09-05 13:57:51 -0500494{
akmhoque7b791452012-10-30 11:24:56 -0500495 if ( nlsr->debugging )
496 printf("process_incoming_content_info called \n");
497 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600498 writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_content_info"
499 " called \n");
akmhoque03004e62012-09-06 01:12:28 -0500500
akmhoque53f64222012-09-05 13:57:51 -0500501 struct name_prefix *nbr=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
502 get_nbr(nbr,selfp,info);
akmhoque03004e62012-09-06 01:12:28 -0500503
akmhoque7b791452012-10-30 11:24:56 -0500504 if ( nlsr->debugging )
akmhoque3d319d42013-02-20 11:08:32 -0600505 printf("Info Content Received For Neighbor: %s Length:%d\n",nbr->name,
506 nbr->length);
akmhoque7b791452012-10-30 11:24:56 -0500507 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600508 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Info Content Received For Nei"
509 "ghbor: %s Length:%d\n",nbr->name,nbr->length);
akmhoque03004e62012-09-06 01:12:28 -0500510
akmhoquefc7016f2013-03-08 07:17:14 -0600511
akmhoque53f64222012-09-05 13:57:51 -0500512
akmhoque6e2ba842013-03-05 19:35:26 -0600513 if ( contain_key_name(info->content_ccnb, info->pco) == 1){
akmhoque237239c2013-03-18 10:29:26 -0500514 int res_verify=-1;
515 int key_exists=0;
516 struct ccn_charbuf *key_name=get_key_name(info->content_ccnb, info->pco);
517 struct ccn_charbuf *key_uri = ccn_charbuf_create();
518 ccn_uri_append(key_uri, key_name->buf, key_name->length, 0);
519 key_exists=does_key_exist(ccn_charbuf_as_string(key_uri));
520 int key_type=get_key_type_from_key_name(key_name);
521
522 if ( res_verify == 1 && key_type == NLSR_KEY ){
523 res_verify=0;
524 }
525 else{
526 res_verify=verify_key(info->content_ccnb,info->pco,0);
527 }
akmhoque6e2ba842013-03-05 19:35:26 -0600528
akmhoque237239c2013-03-18 10:29:26 -0500529 //int res_verify=verify_key(info->content_ccnb,info->pco,0);
akmhoque03004e62012-09-06 01:12:28 -0500530
akmhoqueb7958182013-03-11 12:03:54 -0500531 if ( res_verify != 0 ){
akmhoque1162d852013-03-15 01:07:00 -0500532 if ( nlsr->debugging )
533 printf("Error in verfiying keys !! :( \n");
akmhoque237239c2013-03-18 10:29:26 -0500534 ccn_charbuf_destroy(&key_name);
535 ccn_charbuf_destroy(&key_uri);
akmhoqueb7958182013-03-11 12:03:54 -0500536 }
537 else{
akmhoque237239c2013-03-18 10:29:26 -0500538 if ( key_exists == 0 )
539 add_key(ccn_charbuf_as_string(key_uri));
540 ccn_charbuf_destroy(&key_name);
541 ccn_charbuf_destroy(&key_uri);
akmhoque1162d852013-03-15 01:07:00 -0500542 if ( nlsr->debugging )
543 printf("Key verification is successful :)\n");
akmhoqueb7958182013-03-11 12:03:54 -0500544 update_adjacent_timed_out_zero_to_adl(nbr);
545 update_adjacent_status_to_adl(nbr,NBR_ACTIVE);
546 print_adjacent_from_adl();
akmhoque53f64222012-09-05 13:57:51 -0500547
akmhoqueb7958182013-03-11 12:03:54 -0500548 if(!nlsr->is_build_adj_lsa_sheduled){
549 if ( nlsr->debugging )
550 printf("Scheduling Build and Install Adj LSA...\n");
551 if ( nlsr->detailed_logging )
552 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Scheduling"
akmhoque6e2ba842013-03-05 19:35:26 -0600553 "Build and Install Adj LSA...\n");
akmhoqueb7958182013-03-11 12:03:54 -0500554 nlsr->event_build_adj_lsa = ccn_schedule_event(
akmhoque6e2ba842013-03-05 19:35:26 -0600555 nlsr->sched, 100000,
akmhoque3d319d42013-02-20 11:08:32 -0600556 &build_and_install_adj_lsa, NULL, 0);
akmhoqueb7958182013-03-11 12:03:54 -0500557 nlsr->is_build_adj_lsa_sheduled=1;
558 }
559 else{
560 if ( nlsr->debugging )
561 printf("Build and Install Adj LSA already scheduled\n");
562 if ( nlsr->detailed_logging )
563 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Build and Install Adj LSA"
akmhoque3d319d42013-02-20 11:08:32 -0600564 " already scheduled\n");
akmhoqueb7958182013-03-11 12:03:54 -0500565 }
akmhoque6e2ba842013-03-05 19:35:26 -0600566
akmhoqueb7958182013-03-11 12:03:54 -0500567 }
akmhoque53f64222012-09-05 13:57:51 -0500568 }
akmhoquefc7016f2013-03-08 07:17:14 -0600569 /*
akmhoque10c9a212013-03-08 07:05:18 -0600570 update_adjacent_timed_out_zero_to_adl(nbr);
571 update_adjacent_status_to_adl(nbr,NBR_ACTIVE);
572 print_adjacent_from_adl();
573
574 if(!nlsr->is_build_adj_lsa_sheduled){
575 if ( nlsr->debugging )
576 printf("Scheduling Build and Install Adj LSA...\n");
577 if ( nlsr->detailed_logging )
578 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Scheduling"
579 "Build and Install Adj LSA...\n");
580 nlsr->event_build_adj_lsa = ccn_schedule_event(
581 nlsr->sched, 100000,
582 &build_and_install_adj_lsa, NULL, 0);
583 nlsr->is_build_adj_lsa_sheduled=1;
584 }
585 else{
586 if ( nlsr->debugging )
587 printf("Build and Install Adj LSA already scheduled\n");
588 if ( nlsr->detailed_logging )
589 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Build and Install Adj LSA"
590 " already scheduled\n");
591 }
akmhoque03004e62012-09-06 01:12:28 -0500592
akmhoquefc7016f2013-03-08 07:17:14 -0600593 */
akmhoque83a94da2013-03-15 01:38:21 -0500594 if ( nbr->name != NULL )
595 free(nbr->name);
596 if ( nbr != NULL )
597 free(nbr);
akmhoque03004e62012-09-06 01:12:28 -0500598
akmhoque53f64222012-09-05 13:57:51 -0500599
600}
601
akmhoque7ab49a32013-02-20 11:27:51 -0600602/**
603* process any incoming interest timed out content to NLSR from ccnd
604*/
akmhoque53f64222012-09-05 13:57:51 -0500605
akmhoque03004e62012-09-06 01:12:28 -0500606
akmhoque53f64222012-09-05 13:57:51 -0500607void
akmhoque3d319d42013-02-20 11:08:32 -0600608process_incoming_timed_out_interest(struct ccn_closure* selfp,
609 struct ccn_upcall_info* info)
akmhoque53f64222012-09-05 13:57:51 -0500610{
akmhoque3171d652012-11-13 11:44:33 -0600611
612
613 if ( nlsr->debugging )
614 printf("process_incoming_timed_out_interest called \n");
615 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600616 writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_timed_out_int"
617 "erest called \n");
akmhoque3171d652012-11-13 11:44:33 -0600618
akmhoque53f64222012-09-05 13:57:51 -0500619 int res,i;
620 int nlsr_position=0;
621 int name_comps=(int)info->interest_comps->n;
622
623 for(i=0;i<name_comps;i++)
624 {
625 res=ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,i,"nlsr");
626 if( res == 0)
627 {
628 nlsr_position=i;
629 break;
630 }
631 }
632
akmhoque3d319d42013-02-20 11:08:32 -0600633 if(ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,
634 nlsr_position+1,"info") == 0)
akmhoque53f64222012-09-05 13:57:51 -0500635 {
636 process_incoming_timed_out_interest_info(selfp,info);
637 }
638}
639
akmhoque7ab49a32013-02-20 11:27:51 -0600640/**
641* process any incoming "info" interest timed out content to NLSR from ccnd
642*/
643
akmhoque53f64222012-09-05 13:57:51 -0500644void
akmhoque3d319d42013-02-20 11:08:32 -0600645process_incoming_timed_out_interest_info(struct ccn_closure* selfp, struct
646 ccn_upcall_info* info)
akmhoque53f64222012-09-05 13:57:51 -0500647{
akmhoque3171d652012-11-13 11:44:33 -0600648
649 if ( nlsr->debugging )
650 printf("process_incoming_timed_out_interest_info called \n");
651 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600652 writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_timed_out_int"
653 "erest_info called \n");
akmhoque53f64222012-09-05 13:57:51 -0500654
655 struct name_prefix *nbr=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
656 get_nbr(nbr,selfp,info);
657
akmhoque3171d652012-11-13 11:44:33 -0600658 if ( nlsr->debugging )
akmhoque3d319d42013-02-20 11:08:32 -0600659 printf("Info Interest Timed Out for for Neighbor: %s Length:%d\n",
660 nbr->name,nbr->length);
akmhoque3171d652012-11-13 11:44:33 -0600661 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600662 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Info Interest Timed Out for"
663 " Neighbor: %s Length:%d\n",nbr->name,nbr->length);
akmhoque3171d652012-11-13 11:44:33 -0600664
akmhoque03004e62012-09-06 01:12:28 -0500665
666
akmhoque53f64222012-09-05 13:57:51 -0500667 update_adjacent_timed_out_to_adl(nbr,1);
668 print_adjacent_from_adl();
669 int timed_out=get_timed_out_number(nbr);
akmhoque03004e62012-09-06 01:12:28 -0500670
akmhoque3171d652012-11-13 11:44:33 -0600671 if ( nlsr->debugging )
akmhoque3d319d42013-02-20 11:08:32 -0600672 printf("Neighbor: %s Info Interest Timed Out: %d times\n",nbr->name,
673 timed_out);
akmhoque3171d652012-11-13 11:44:33 -0600674 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600675 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Neighbor: %s Info Interest "
676 "Timed Out: %d times\n",nbr->name,timed_out);
akmhoque3171d652012-11-13 11:44:33 -0600677
akmhoque53f64222012-09-05 13:57:51 -0500678
679 if(timed_out<nlsr->interest_retry && timed_out>0) // use configured variables
680 {
akmhoque53f64222012-09-05 13:57:51 -0500681 send_info_interest_to_neighbor(nbr);
682 }
683 else
akmhoque3171d652012-11-13 11:44:33 -0600684 {
akmhoque53f64222012-09-05 13:57:51 -0500685 update_adjacent_status_to_adl(nbr,NBR_DOWN);
686 if(!nlsr->is_build_adj_lsa_sheduled)
687 {
akmhoque3d319d42013-02-20 11:08:32 -0600688 nlsr->event_build_adj_lsa = ccn_schedule_event(nlsr->sched, 1000,
689 &build_and_install_adj_lsa, NULL, 0);
akmhoque53f64222012-09-05 13:57:51 -0500690 nlsr->is_build_adj_lsa_sheduled=1;
691 }
692 }
693
akmhoque284056b2013-03-15 01:20:16 -0500694 if ( nbr->name != NULL )
695 free(nbr->name);
696 if ( nbr != NULL )
697 free(nbr);
akmhoque03004e62012-09-06 01:12:28 -0500698
akmhoque53f64222012-09-05 13:57:51 -0500699
700}
701
akmhoque7ab49a32013-02-20 11:27:51 -0600702/**
703* send "info" interest to each and every neighbor in ADL and also schedule for
704* itself for periodical sending of "info" interest
705*/
akmhoque29c1db52012-09-07 14:47:43 -0500706
akmhoque03004e62012-09-06 01:12:28 -0500707int
akmhoque3d319d42013-02-20 11:08:32 -0600708send_info_interest(struct ccn_schedule *sched, void *clienth,
709 struct ccn_scheduled_event *ev, int flags)
akmhoque53f64222012-09-05 13:57:51 -0500710{
akmhoqueffacaa82012-09-13 17:48:30 -0500711 if(flags == CCN_SCHEDULE_CANCEL)
712 {
713 return -1;
714 }
715
716 nlsr_lock();
717
akmhoque3171d652012-11-13 11:44:33 -0600718 if ( nlsr->debugging )
719 printf("send_info_interest called \n");
720 if ( nlsr->detailed_logging )
721 writeLogg(__FILE__,__FUNCTION__,__LINE__,"send_info_interest called \n");
722
723 if ( nlsr->debugging )
724 printf("\n");
725 if ( nlsr->detailed_logging )
726 writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
akmhoqued79438d2012-08-27 13:31:42 -0500727
akmhoque53f64222012-09-05 13:57:51 -0500728 int adl_element,i;
akmhoque53f64222012-09-05 13:57:51 -0500729 struct ndn_neighbor *nbr;
730
731 struct hashtb_enumerator ee;
732 struct hashtb_enumerator *e = &ee;
733
734 hashtb_start(nlsr->adl, e);
735 adl_element=hashtb_n(nlsr->adl);
736
737 for(i=0;i<adl_element;i++)
738 {
739 nbr=e->data;
740 send_info_interest_to_neighbor(nbr->neighbor);
741 hashtb_next(e);
742 }
akmhoque53f64222012-09-05 13:57:51 -0500743 hashtb_end(e);
744
akmhoqueffacaa82012-09-13 17:48:30 -0500745 nlsr_unlock();
746
akmhoque3d319d42013-02-20 11:08:32 -0600747 nlsr->event = ccn_schedule_event(nlsr->sched, 60000000, &send_info_interest,
748 NULL, 0);
akmhoque9fa58a82012-10-05 07:56:02 -0500749
akmhoque53f64222012-09-05 13:57:51 -0500750 return 0;
751}
752
akmhoque7ab49a32013-02-20 11:27:51 -0600753
754/**
755* send "info" interest neighbor nbr
756*
757*/
758
akmhoque53f64222012-09-05 13:57:51 -0500759void
760send_info_interest_to_neighbor(struct name_prefix *nbr)
761{
akmhoque3171d652012-11-13 11:44:33 -0600762
763 if ( nlsr->debugging )
764 printf("send_info_interest_to_neighbor called \n");
765 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600766 writeLogg(__FILE__,__FUNCTION__,__LINE__,"send_info_interest_to_neighbor"
767 " called \n");
akmhoque3171d652012-11-13 11:44:33 -0600768
akmhoqued79438d2012-08-27 13:31:42 -0500769
770 int res;
akmhoque53f64222012-09-05 13:57:51 -0500771 char info_str[5];
772 char nlsr_str[5];
akmhoque53f64222012-09-05 13:57:51 -0500773
akmhoqued79438d2012-08-27 13:31:42 -0500774 memset(&nlsr_str,0,5);
775 sprintf(nlsr_str,"nlsr");
776 memset(&info_str,0,5);
777 sprintf(info_str,"info");
778
akmhoque53f64222012-09-05 13:57:51 -0500779
780 struct ccn_charbuf *name;
akmhoqued79438d2012-08-27 13:31:42 -0500781 name=ccn_charbuf_create();
akmhoqued79438d2012-08-27 13:31:42 -0500782
akmhoque3d319d42013-02-20 11:08:32 -0600783 char *int_name=(char *)malloc(strlen(nbr->name)+1+strlen(nlsr_str)+1+
784 strlen(info_str)+strlen(nlsr->router_name)+1);
785 memset(int_name,0,strlen(nbr->name)+1+strlen(nlsr_str)+1+strlen(info_str)+
786 strlen(nlsr->router_name)+1);
akmhoque53f64222012-09-05 13:57:51 -0500787 memcpy(int_name+strlen(int_name),nbr->name,strlen(nbr->name));
788 memcpy(int_name+strlen(int_name),"/",1);
789 memcpy(int_name+strlen(int_name),nlsr_str,strlen(nlsr_str));
790 memcpy(int_name+strlen(int_name),"/",1);
791 memcpy(int_name+strlen(int_name),info_str,strlen(info_str));
akmhoque03004e62012-09-06 01:12:28 -0500792 memcpy(int_name+strlen(int_name),nlsr->router_name,strlen(nlsr->router_name));
akmhoque53f64222012-09-05 13:57:51 -0500793
794
795 res=ccn_name_from_uri(name,int_name);
796 if ( res >=0 )
797 {
akmhoque53f64222012-09-05 13:57:51 -0500798 /* adding InterestLifeTime and InterestScope filter */
799
800 struct ccn_charbuf *templ;
801 templ = ccn_charbuf_create();
802
803 ccn_charbuf_append_tt(templ, CCN_DTAG_Interest, CCN_DTAG);
804 ccn_charbuf_append_tt(templ, CCN_DTAG_Name, CCN_DTAG);
805 ccn_charbuf_append_closer(templ); /* </Name> */
akmhoque03004e62012-09-06 01:12:28 -0500806 ccn_charbuf_append_tt(templ, CCN_DTAG_Scope, CCN_DTAG);
807 ccn_charbuf_append_tt(templ, 1, CCN_UDATA);
akmhoqueb77b95f2013-02-08 12:28:47 -0600808 /* Adding InterestLifeTime and InterestScope filter done */
akmhoque3d319d42013-02-20 11:08:32 -0600809 ccn_charbuf_append(templ, "2", 1); //scope of interest: 2
810 //(not further than next host)
akmhoque03004e62012-09-06 01:12:28 -0500811 ccn_charbuf_append_closer(templ); /* </Scope> */
akmhoque53f64222012-09-05 13:57:51 -0500812
813 appendLifetime(templ,nlsr->interest_resend_time);
akmhoqueb77b95f2013-02-08 12:28:47 -0600814 unsigned int face_id=get_next_hop_face_from_adl(nbr->name);
815 ccnb_tagged_putf(templ, CCN_DTAG_FaceID, "%u", face_id);
akmhoque53f64222012-09-05 13:57:51 -0500816 ccn_charbuf_append_closer(templ); /* </Interest> */
akmhoqueb77b95f2013-02-08 12:28:47 -0600817
akmhoque53f64222012-09-05 13:57:51 -0500818
akmhoque3171d652012-11-13 11:44:33 -0600819 if ( nlsr->debugging )
akmhoque3d319d42013-02-20 11:08:32 -0600820 printf("Sending info interest on name prefix : %s through Face:%u\n"
821 ,int_name,face_id);
akmhoque3171d652012-11-13 11:44:33 -0600822 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600823 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Sending info interest on"
824 "name prefix : %s through Face:%u\n",int_name,face_id);
akmhoque53f64222012-09-05 13:57:51 -0500825
826 res=ccn_express_interest(nlsr->ccn,name,&(nlsr->in_content),templ);
827
828 if ( res >= 0 )
akmhoque3171d652012-11-13 11:44:33 -0600829 {
830 if ( nlsr->debugging )
831 printf("Info interest sending Successfull .... \n");
832 if ( nlsr->detailed_logging )
akmhoque3d319d42013-02-20 11:08:32 -0600833 writeLogg(__FILE__,__FUNCTION__,__LINE__,"Info"
834 "interest sending Successfull .... \n");
akmhoque3171d652012-11-13 11:44:33 -0600835 }
akmhoque53f64222012-09-05 13:57:51 -0500836 ccn_charbuf_destroy(&templ);
837 }
akmhoque7adb2772013-03-05 16:30:59 -0600838
akmhoque53f64222012-09-05 13:57:51 -0500839 ccn_charbuf_destroy(&name);
840 free(int_name);
akmhoquec06dcf12013-02-20 08:13:37 -0600841}