akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 1 | #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 <sys/stat.h> |
| 8 | #include <assert.h> |
| 9 | #include <sys/types.h> |
| 10 | #include <signal.h> |
| 11 | #include <sys/socket.h> |
| 12 | #include <sys/un.h> |
| 13 | #include <fcntl.h> |
| 14 | #include <sys/ioctl.h> |
| 15 | #include <netinet/in.h> |
| 16 | #include <netdb.h> |
| 17 | #include <arpa/inet.h> |
| 18 | |
| 19 | #include <ccn/ccn.h> |
| 20 | #include <ccn/uri.h> |
| 21 | #include <ccn/keystore.h> |
| 22 | #include <ccn/signing.h> |
| 23 | #include <ccn/schedule.h> |
| 24 | #include <ccn/hashtb.h> |
| 25 | #include <ccn/sync.h> |
| 26 | #include <ccn/seqwriter.h> |
| 27 | |
| 28 | #include "nlsr.h" |
| 29 | #include "nlsr_sync.h" |
| 30 | #include "nlsr_lsdb.h" |
akmhoque | 4ae1694 | 2012-12-10 11:50:43 -0600 | [diff] [blame] | 31 | #include "utility.h" |
akmhoque | 3b6c66d | 2013-01-31 15:30:23 -0600 | [diff] [blame] | 32 | |
| 33 | |
Syed Obaid Amin | 3a3864b | 2013-01-09 03:05:50 -0600 | [diff] [blame] | 34 | char * |
| 35 | hex_string(unsigned char *s, size_t l) |
| 36 | { |
| 37 | const char *hex_digits = "0123456789abcdef"; |
| 38 | char *r; |
| 39 | int i; |
| 40 | r = calloc(1, 1 + 2 * l); |
| 41 | for (i = 0; i < l; i++) { |
| 42 | r[2*i] = hex_digits[(s[i]>>4) & 0xf]; |
| 43 | r[1+2*i] = hex_digits[s[i] & 0xf]; |
| 44 | } |
| 45 | return(r); |
| 46 | } |
| 47 | |
| 48 | int |
| 49 | sync_cb(struct ccns_name_closure *nc, |
| 50 | struct ccn_charbuf *lhash, |
| 51 | struct ccn_charbuf *rhash, |
| 52 | struct ccn_charbuf *name) |
| 53 | { |
| 54 | char *hexL; |
| 55 | char *hexR; |
akmhoque | 6c2f60a | 2013-01-31 17:29:11 -0600 | [diff] [blame] | 56 | int res; |
Syed Obaid Amin | 3a3864b | 2013-01-09 03:05:50 -0600 | [diff] [blame] | 57 | struct ccn_charbuf *uri = ccn_charbuf_create(); |
| 58 | if (lhash == NULL || lhash->length == 0) { |
| 59 | hexL = strdup("none"); |
| 60 | } else |
| 61 | hexL = hex_string(lhash->buf, lhash->length); |
| 62 | if (rhash == NULL || rhash->length == 0) { |
| 63 | hexR = strdup("none"); |
| 64 | } else |
| 65 | hexR = hex_string(rhash->buf, rhash->length); |
| 66 | if (name != NULL) |
| 67 | ccn_uri_append(uri, name->buf, name->length, 1); |
| 68 | else |
| 69 | ccn_charbuf_append_string(uri, "(null)"); |
a64adam | 04be648 | 2013-01-17 11:29:32 -0600 | [diff] [blame] | 70 | |
akmhoque | 3b6c66d | 2013-01-31 15:30:23 -0600 | [diff] [blame] | 71 | |
a64adam | 04be648 | 2013-01-17 11:29:32 -0600 | [diff] [blame] | 72 | if ( nlsr->debugging ) |
akmhoque | fc5176d | 2013-01-18 09:50:12 -0600 | [diff] [blame] | 73 | printf("Response from sync in the name: %s \n",ccn_charbuf_as_string(uri)); |
| 74 | |
Syed Obaid Amin | 3a3864b | 2013-01-09 03:05:50 -0600 | [diff] [blame] | 75 | fflush(stdout); |
| 76 | free(hexL); |
| 77 | free(hexR); |
akmhoque | 3c0c95d | 2013-01-31 16:46:24 -0600 | [diff] [blame] | 78 | ccn_charbuf_destroy(&uri); |
akmhoque | d6cd61d | 2013-01-17 10:31:15 -0600 | [diff] [blame] | 79 | |
| 80 | |
akmhoque | 3b6c66d | 2013-01-31 15:30:23 -0600 | [diff] [blame] | 81 | //--Doing our thing from here |
akmhoque | 6c2f60a | 2013-01-31 17:29:11 -0600 | [diff] [blame] | 82 | struct ccn_indexbuf cid={0}; |
Syed Obaid Amin | 3a3864b | 2013-01-09 03:05:50 -0600 | [diff] [blame] | 83 | |
| 84 | struct ccn_indexbuf *components=&cid; |
akmhoque | 6c2f60a | 2013-01-31 17:29:11 -0600 | [diff] [blame] | 85 | //ccn_name_split (name, components); |
| 86 | //ccn_name_chop(name,components,-3); |
| 87 | //process_content_from_sync(name,components); |
Syed Obaid Amin | 3a3864b | 2013-01-09 03:05:50 -0600 | [diff] [blame] | 88 | |
akmhoque | acef1e6 | 2013-01-31 17:15:08 -0600 | [diff] [blame] | 89 | struct ccn_charbuf *content_name = ccn_charbuf_create(); |
akmhoque | 6c2f60a | 2013-01-31 17:29:11 -0600 | [diff] [blame] | 90 | res = ccn_name_append(content_name, name->buf, name->length); |
akmhoque | 4461c0d | 2013-01-31 17:32:13 -0600 | [diff] [blame^] | 91 | res = ccn_name_split (content_name, components); |
akmhoque | acef1e6 | 2013-01-31 17:15:08 -0600 | [diff] [blame] | 92 | |
| 93 | printf("Res = %d \n",res); |
akmhoque | acef1e6 | 2013-01-31 17:15:08 -0600 | [diff] [blame] | 94 | ccn_charbuf_destroy(&content_name); |
akmhoque | 6c2f60a | 2013-01-31 17:29:11 -0600 | [diff] [blame] | 95 | |
Syed Obaid Amin | 3a3864b | 2013-01-09 03:05:50 -0600 | [diff] [blame] | 96 | |
| 97 | return(0); |
| 98 | } |
akmhoque | 3b6c66d | 2013-01-31 15:30:23 -0600 | [diff] [blame] | 99 | |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 100 | |
| 101 | int |
| 102 | get_lsa_position(struct ccn_charbuf * ccnb, struct ccn_indexbuf *comps) |
| 103 | { |
| 104 | |
| 105 | |
| 106 | |
| 107 | int res,i; |
akmhoque | 3b6c66d | 2013-01-31 15:30:23 -0600 | [diff] [blame] | 108 | int lsa_position=0; |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 109 | int name_comps=(int)comps->n; |
| 110 | |
| 111 | for(i=0;i<name_comps;i++) |
| 112 | { |
| 113 | res=ccn_name_comp_strcmp(ccnb->buf,comps,i,"LSA"); |
| 114 | if( res == 0) |
| 115 | { |
| 116 | lsa_position=i; |
| 117 | break; |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | return lsa_position; |
| 122 | |
| 123 | } |
| 124 | |
| 125 | void |
| 126 | get_name_part(struct name_prefix *name_part,struct ccn_charbuf * interest_ccnb, struct ccn_indexbuf *interest_comps, int offset) |
| 127 | { |
| 128 | |
| 129 | |
| 130 | |
| 131 | int res,i; |
| 132 | int lsa_position=0; |
| 133 | int len=0; |
| 134 | |
akmhoque | 2ee1803 | 2013-01-22 10:01:23 -0600 | [diff] [blame] | 135 | |
| 136 | struct ccn_indexbuf cid={0}; |
| 137 | struct ccn_indexbuf *components=&cid; |
| 138 | struct ccn_charbuf *name=ccn_charbuf_create(); |
| 139 | ccn_name_from_uri(name,nlsr->slice_prefix); |
| 140 | ccn_name_split (name, components); |
| 141 | lsa_position=components->n-2; |
akmhoque | 3b6c66d | 2013-01-31 15:30:23 -0600 | [diff] [blame] | 142 | |
akmhoque | 2ee1803 | 2013-01-22 10:01:23 -0600 | [diff] [blame] | 143 | ccn_charbuf_destroy(&name); |
| 144 | |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 145 | |
| 146 | const unsigned char *comp_ptr1; |
| 147 | size_t comp_size; |
| 148 | for(i=lsa_position+1+offset;i<interest_comps->n-1;i++) |
| 149 | { |
| 150 | res=ccn_name_comp_get(interest_ccnb->buf, interest_comps,i,&comp_ptr1, &comp_size); |
| 151 | len+=1; |
| 152 | len+=(int)comp_size; |
| 153 | } |
| 154 | len++; |
| 155 | |
| 156 | char *neighbor=(char *)malloc(len); |
| 157 | memset(neighbor,0,len); |
| 158 | |
| 159 | for(i=lsa_position+1+offset; i<interest_comps->n-1;i++) |
| 160 | { |
| 161 | res=ccn_name_comp_get(interest_ccnb->buf, interest_comps,i,&comp_ptr1, &comp_size); |
| 162 | memcpy(neighbor+strlen(neighbor),"/",1); |
| 163 | memcpy(neighbor+strlen(neighbor),(char *)comp_ptr1,strlen((char *)comp_ptr1)); |
| 164 | |
| 165 | } |
| 166 | |
| 167 | name_part->name=(char *)malloc(strlen(neighbor)+1); |
| 168 | memset(name_part->name,0,strlen(neighbor)+1); |
| 169 | memcpy(name_part->name,neighbor,strlen(neighbor)+1); |
| 170 | name_part->length=strlen(neighbor)+1; |
| 171 | |
akmhoque | 3b6c66d | 2013-01-31 15:30:23 -0600 | [diff] [blame] | 172 | // Add 01/31/2013 |
| 173 | free(neighbor); |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 174 | } |
| 175 | |
akmhoque | 09c0afa | 2012-12-14 09:27:00 -0600 | [diff] [blame] | 176 | void |
| 177 | get_host_name_from_command_string(struct name_prefix *name_part,char *nbr_name_uri, int offset) |
| 178 | { |
| 179 | |
| 180 | |
| 181 | |
| 182 | int res,i; |
| 183 | int len=0; |
| 184 | const unsigned char *comp_ptr1; |
| 185 | size_t comp_size; |
| 186 | |
| 187 | struct ccn_charbuf *name=ccn_charbuf_create(); |
| 188 | name = ccn_charbuf_create(); |
| 189 | res = ccn_name_from_uri(name,nbr_name_uri); |
| 190 | if (res < 0) { |
| 191 | fprintf(stderr, "Bad ccn URI: %s\n", nbr_name_uri); |
| 192 | exit(1); |
| 193 | } |
| 194 | |
| 195 | struct ccn_indexbuf cid={0}; |
| 196 | |
| 197 | struct ccn_indexbuf *components=&cid; |
| 198 | ccn_name_split (name, components); |
| 199 | |
| 200 | for(i=components->n-2;i> (0+offset);i--) |
| 201 | { |
| 202 | res=ccn_name_comp_get(name->buf, components,i,&comp_ptr1, &comp_size); |
| 203 | len+=1; |
| 204 | len+=(int)comp_size; |
| 205 | } |
| 206 | len++; |
| 207 | |
| 208 | char *neighbor=(char *)malloc(len); |
| 209 | memset(neighbor,0,len); |
| 210 | |
| 211 | for(i=components->n-2;i> (0+offset);i--) |
| 212 | { |
| 213 | res=ccn_name_comp_get(name->buf, components,i,&comp_ptr1, &comp_size); |
| 214 | if ( i != components->n-2) |
| 215 | memcpy(neighbor+strlen(neighbor),".",1); |
| 216 | memcpy(neighbor+strlen(neighbor),(char *)comp_ptr1,strlen((char *)comp_ptr1)); |
| 217 | |
| 218 | } |
| 219 | |
| 220 | name_part->name=(char *)malloc(strlen(neighbor)+1); |
| 221 | memset(name_part->name,0,strlen(neighbor)+1); |
| 222 | memcpy(name_part->name,neighbor,strlen(neighbor)+1); |
| 223 | name_part->length=strlen(neighbor)+1; |
| 224 | |
akmhoque | 3b6c66d | 2013-01-31 15:30:23 -0600 | [diff] [blame] | 225 | // 01/31/2013 |
| 226 | free(neighbor); |
| 227 | ccn_charbuf_destroy(&name); |
akmhoque | 09c0afa | 2012-12-14 09:27:00 -0600 | [diff] [blame] | 228 | } |
| 229 | |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 230 | |
akmhoque | ed418f3 | 2013-01-30 12:25:04 -0600 | [diff] [blame] | 231 | |
soamin | 1504362 | 2013-01-15 23:10:26 -0600 | [diff] [blame] | 232 | void |
Obaid Amin | e63022a | 2013-01-15 23:36:40 -0600 | [diff] [blame] | 233 | get_content_by_content_name(char *content_name, unsigned char **content_data) |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 234 | { |
| 235 | |
soamin | 1504362 | 2013-01-15 23:10:26 -0600 | [diff] [blame] | 236 | struct ccn_charbuf *name = NULL; |
| 237 | struct ccn_charbuf *templ = NULL; |
| 238 | struct ccn_charbuf *resultbuf = NULL; |
| 239 | struct ccn_parsed_ContentObject pcobuf = { 0 }; |
| 240 | int res; |
| 241 | int allow_stale = 0; |
| 242 | int content_only = 1; |
| 243 | int scope = -1; |
| 244 | const unsigned char *ptr; |
| 245 | size_t length; |
| 246 | int resolve_version = CCN_V_HIGHEST; |
| 247 | int timeout_ms = 3000; |
| 248 | const unsigned lifetime_default = CCN_INTEREST_LIFETIME_SEC << 12; |
| 249 | unsigned lifetime_l12 = lifetime_default; |
| 250 | int get_flags = 0; |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 251 | |
soamin | 1504362 | 2013-01-15 23:10:26 -0600 | [diff] [blame] | 252 | name = ccn_charbuf_create(); |
| 253 | res = ccn_name_from_uri(name,content_name); |
| 254 | if (res < 0) { |
| 255 | fprintf(stderr, "Bad ccn URI: %s\n", content_name); |
| 256 | exit(1); |
| 257 | } |
| 258 | |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 259 | if (allow_stale || lifetime_l12 != lifetime_default || scope != -1) { |
soamin | 1504362 | 2013-01-15 23:10:26 -0600 | [diff] [blame] | 260 | templ = ccn_charbuf_create(); |
| 261 | ccn_charbuf_append_tt(templ, CCN_DTAG_Interest, CCN_DTAG); |
| 262 | ccn_charbuf_append_tt(templ, CCN_DTAG_Name, CCN_DTAG); |
| 263 | ccn_charbuf_append_closer(templ); /* </Name> */ |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 264 | if (allow_stale) { |
| 265 | ccn_charbuf_append_tt(templ, CCN_DTAG_AnswerOriginKind, CCN_DTAG); |
| 266 | ccnb_append_number(templ, |
soamin | 1504362 | 2013-01-15 23:10:26 -0600 | [diff] [blame] | 267 | CCN_AOK_DEFAULT | CCN_AOK_STALE); |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 268 | ccn_charbuf_append_closer(templ); /* </AnswerOriginKind> */ |
| 269 | } |
soamin | 1504362 | 2013-01-15 23:10:26 -0600 | [diff] [blame] | 270 | if (scope != -1) { |
| 271 | ccnb_tagged_putf(templ, CCN_DTAG_Scope, "%d", scope); |
| 272 | } |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 273 | if (lifetime_l12 != lifetime_default) { |
| 274 | /* |
| 275 | * Choose the interest lifetime so there are at least 3 |
| 276 | * expressions (in the unsatisfied case). |
| 277 | */ |
| 278 | unsigned char buf[3] = { 0 }; |
| 279 | int i; |
| 280 | for (i = sizeof(buf) - 1; i >= 0; i--, lifetime_l12 >>= 8) |
| 281 | buf[i] = lifetime_l12 & 0xff; |
| 282 | ccnb_append_tagged_blob(templ, CCN_DTAG_InterestLifetime, buf, sizeof(buf)); |
| 283 | } |
soamin | 1504362 | 2013-01-15 23:10:26 -0600 | [diff] [blame] | 284 | ccn_charbuf_append_closer(templ); /* </Interest> */ |
| 285 | } |
| 286 | resultbuf = ccn_charbuf_create(); |
| 287 | if (resolve_version != 0) { |
| 288 | res = ccn_resolve_version(nlsr->ccn, name, resolve_version, 500); |
| 289 | if (res >= 0) { |
| 290 | ccn_uri_append(resultbuf, name->buf, name->length, 1); |
soamin | 1504362 | 2013-01-15 23:10:26 -0600 | [diff] [blame] | 291 | resultbuf->length = 0; |
| 292 | } |
| 293 | } |
| 294 | res = ccn_get(nlsr->ccn, name, templ, timeout_ms, resultbuf, &pcobuf, NULL, get_flags); |
| 295 | if (res >= 0) { |
| 296 | ptr = resultbuf->buf; |
| 297 | length = resultbuf->length; |
| 298 | if (content_only){ |
| 299 | ccn_content_get_value(ptr, length, &pcobuf, &ptr, &length); |
Obaid Amin | e63022a | 2013-01-15 23:36:40 -0600 | [diff] [blame] | 300 | *content_data = (unsigned char *) calloc(length, sizeof(char *)); |
| 301 | memcpy (*content_data, ptr, length); |
soamin | 1504362 | 2013-01-15 23:10:26 -0600 | [diff] [blame] | 302 | } |
| 303 | } |
| 304 | ccn_charbuf_destroy(&resultbuf); |
| 305 | ccn_charbuf_destroy(&templ); |
| 306 | ccn_charbuf_destroy(&name); |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 307 | } |
| 308 | |
akmhoque | 4ae1694 | 2012-12-10 11:50:43 -0600 | [diff] [blame] | 309 | void |
soamin | 1504362 | 2013-01-15 23:10:26 -0600 | [diff] [blame] | 310 | process_incoming_sync_content_lsa( unsigned char *content_data) |
akmhoque | 4ae1694 | 2012-12-10 11:50:43 -0600 | [diff] [blame] | 311 | { |
| 312 | |
| 313 | |
| 314 | if ( nlsr->debugging ) |
akmhoque | ed418f3 | 2013-01-30 12:25:04 -0600 | [diff] [blame] | 315 | printf("process_incoming_sync_content_lsa called \n"); |
akmhoque | 4ae1694 | 2012-12-10 11:50:43 -0600 | [diff] [blame] | 316 | |
| 317 | char *sep="|"; |
| 318 | char *rem; |
| 319 | char *orig_router; |
| 320 | char *orl; |
| 321 | int orig_router_length; |
| 322 | char *lst; |
| 323 | int ls_type; |
| 324 | char *lsid; |
| 325 | long int ls_id; |
| 326 | char *isvld; |
| 327 | int isValid; |
| 328 | char *num_link; |
| 329 | int no_link; |
| 330 | char *np; |
| 331 | char *np_length; |
| 332 | int name_length; |
| 333 | char *data; |
| 334 | char *orig_time; |
| 335 | |
| 336 | |
| 337 | if ( nlsr->debugging ) |
| 338 | printf("LSA Data \n"); |
akmhoque | 4ae1694 | 2012-12-10 11:50:43 -0600 | [diff] [blame] | 339 | |
soamin | 1504362 | 2013-01-15 23:10:26 -0600 | [diff] [blame] | 340 | if( strlen((char *)content_data ) > 0 ) |
akmhoque | 4ae1694 | 2012-12-10 11:50:43 -0600 | [diff] [blame] | 341 | { |
| 342 | |
| 343 | orig_router=strtok_r((char *)content_data,sep,&rem); |
| 344 | orl=strtok_r(NULL,sep,&rem); |
| 345 | orig_router_length=atoi(orl); |
| 346 | |
| 347 | if ( nlsr->debugging ) |
| 348 | { |
| 349 | printf(" Orig Router Name : %s\n",orig_router); |
| 350 | printf(" Orig Router Length: %d\n",orig_router_length); |
| 351 | } |
| 352 | |
| 353 | lst=strtok_r(NULL,sep,&rem); |
| 354 | ls_type=atoi(lst); |
| 355 | |
| 356 | if ( nlsr->debugging ) |
| 357 | printf(" LS Type : %d\n",ls_type); |
| 358 | |
| 359 | if ( ls_type == LS_TYPE_NAME ) |
| 360 | { |
| 361 | lsid=strtok_r(NULL,sep,&rem); |
| 362 | ls_id=atoi(lsid); |
| 363 | orig_time=strtok_r(NULL,sep,&rem); |
| 364 | isvld=strtok_r(NULL,sep,&rem); |
| 365 | isValid=atoi(isvld); |
| 366 | np=strtok_r(NULL,sep,&rem); |
| 367 | np_length=strtok_r(NULL,sep,&rem); |
| 368 | name_length=atoi(np_length); |
| 369 | if ( nlsr->debugging ) |
| 370 | { |
| 371 | printf(" LS ID : %ld\n",ls_id); |
| 372 | printf(" isValid : %d\n",isValid); |
| 373 | printf(" Name Prefix : %s\n",np); |
| 374 | printf(" Orig Time : %s\n",orig_time); |
| 375 | printf(" Name Prefix length: %d\n",name_length); |
| 376 | } |
| 377 | |
| 378 | build_and_install_others_name_lsa(orig_router,ls_type,ls_id,orig_time,isValid,np); |
| 379 | |
| 380 | print_name_lsdb(); |
| 381 | |
| 382 | } |
| 383 | else if ( ls_type == LS_TYPE_ADJ ) |
| 384 | { |
| 385 | orig_time=strtok_r(NULL,sep,&rem); |
| 386 | num_link=strtok_r(NULL,sep,&rem); |
| 387 | no_link=atoi(num_link); |
| 388 | data=rem; |
| 389 | |
| 390 | if ( nlsr->debugging ) |
| 391 | { |
akmhoque | ed418f3 | 2013-01-30 12:25:04 -0600 | [diff] [blame] | 392 | printf(" Orig Time : %s\n",orig_time); |
akmhoque | 4ae1694 | 2012-12-10 11:50:43 -0600 | [diff] [blame] | 393 | printf(" No Link : %d\n",no_link); |
| 394 | printf(" Data : %s\n",data); |
| 395 | } |
| 396 | build_and_install_others_adj_lsa(orig_router,ls_type,orig_time,no_link,data); |
| 397 | } |
akmhoque | ed418f3 | 2013-01-30 12:25:04 -0600 | [diff] [blame] | 398 | else if ( ls_type == LS_TYPE_COR ) |
| 399 | { |
| 400 | orig_time=strtok_r(NULL,sep,&rem); |
| 401 | char *cor_r=strtok_r(NULL,sep,&rem); |
| 402 | char *cor_theta=strtok_r(NULL,sep,&rem); |
| 403 | |
| 404 | double r, theta; |
| 405 | r=strtof(cor_r,NULL); |
| 406 | theta=strtof(cor_theta,NULL); |
| 407 | |
| 408 | if ( nlsr->debugging ) |
| 409 | { |
| 410 | printf(" Orig Time : %s\n",orig_time); |
| 411 | printf(" Cor R : %f\n",r); |
| 412 | printf(" Cor Theta : %f\n",theta); |
| 413 | } |
| 414 | build_and_install_others_cor_lsa(orig_router,ls_type,orig_time, (double)r, (double)theta); |
| 415 | } |
| 416 | |
akmhoque | 4ae1694 | 2012-12-10 11:50:43 -0600 | [diff] [blame] | 417 | } |
| 418 | } |
| 419 | |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 420 | void |
| 421 | process_content_from_sync(struct ccn_charbuf *content_name, struct ccn_indexbuf *components) |
| 422 | { |
| 423 | int lsa_position; |
| 424 | int res; |
| 425 | size_t comp_size; |
| 426 | const unsigned char *lst; |
| 427 | const unsigned char *lsid; |
| 428 | const unsigned char *origtime; |
| 429 | |
| 430 | int ls_type; |
| 431 | long int ls_id=0; |
| 432 | |
soamin | 1504362 | 2013-01-15 23:10:26 -0600 | [diff] [blame] | 433 | unsigned char *content_data = NULL; |
| 434 | |
akmhoque | 4ae1694 | 2012-12-10 11:50:43 -0600 | [diff] [blame] | 435 | char *time_stamp=(char *)malloc(20); |
| 436 | memset(time_stamp,0,20); |
| 437 | get_current_timestamp_micro(time_stamp); |
| 438 | |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 439 | struct ccn_charbuf *uri = ccn_charbuf_create(); |
| 440 | ccn_uri_append(uri, content_name->buf, content_name->length, 0); |
| 441 | |
| 442 | struct name_prefix *orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix)); |
| 443 | |
akmhoque | 2ee1803 | 2013-01-22 10:01:23 -0600 | [diff] [blame] | 444 | |
| 445 | struct ccn_indexbuf cid={0}; |
| 446 | struct ccn_indexbuf *temp_components=&cid; |
| 447 | struct ccn_charbuf *name=ccn_charbuf_create(); |
| 448 | ccn_name_from_uri(name,nlsr->slice_prefix); |
| 449 | ccn_name_split (name, temp_components); |
| 450 | lsa_position=temp_components->n-2; |
akmhoque | 2ee1803 | 2013-01-22 10:01:23 -0600 | [diff] [blame] | 451 | ccn_charbuf_destroy(&name); |
| 452 | |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 453 | |
| 454 | res=ccn_name_comp_get(content_name->buf, components,lsa_position+1,&lst, &comp_size); |
| 455 | |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 456 | ls_type=atoi((char *)lst); |
| 457 | if(ls_type == LS_TYPE_NAME) |
| 458 | { |
akmhoque | 4ae1694 | 2012-12-10 11:50:43 -0600 | [diff] [blame] | 459 | |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 460 | res=ccn_name_comp_get(content_name->buf, components,lsa_position+2,&lsid, &comp_size); |
| 461 | ls_id=atoi((char *)lsid); |
| 462 | res=ccn_name_comp_get(content_name->buf, components,lsa_position+3,&origtime, &comp_size); |
| 463 | get_name_part(orig_router,content_name,components,3); |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 464 | |
akmhoque | 4ae1694 | 2012-12-10 11:50:43 -0600 | [diff] [blame] | 465 | int lsa_life_time=get_time_diff(time_stamp,(char *)origtime); |
| 466 | |
akmhoque | 4ae1694 | 2012-12-10 11:50:43 -0600 | [diff] [blame] | 467 | if ( (strcmp((char *)orig_router,nlsr->router_name) == 0 && lsa_life_time < nlsr->lsa_refresh_time) || (strcmp((char *)orig_router,nlsr->router_name) != 0 && lsa_life_time < nlsr->router_dead_interval) ) |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 468 | { |
akmhoque | 4ae1694 | 2012-12-10 11:50:43 -0600 | [diff] [blame] | 469 | int is_new_name_lsa=check_is_new_name_lsa(orig_router->name,(char *)lst,(char *)lsid,(char *)origtime); |
| 470 | if ( is_new_name_lsa == 1 ) |
| 471 | { |
a64adam | 04be648 | 2013-01-17 11:29:32 -0600 | [diff] [blame] | 472 | if ( nlsr->debugging ) |
| 473 | printf("New NAME LSA.....\n"); |
Obaid Amin | e63022a | 2013-01-15 23:36:40 -0600 | [diff] [blame] | 474 | get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data); |
a64adam | f7b051d | 2013-01-17 11:39:58 -0600 | [diff] [blame] | 475 | if ( nlsr->debugging ) |
| 476 | printf("Content Data: %s \n",content_data); |
akmhoque | 4ae1694 | 2012-12-10 11:50:43 -0600 | [diff] [blame] | 477 | process_incoming_sync_content_lsa(content_data); |
| 478 | } |
| 479 | else |
| 480 | { |
a64adam | 04be648 | 2013-01-17 11:29:32 -0600 | [diff] [blame] | 481 | if ( nlsr->debugging ) |
| 482 | printf("Name LSA / Newer Name LSA already xists in LSDB\n"); |
Obaid Amin | e63022a | 2013-01-15 23:36:40 -0600 | [diff] [blame] | 483 | get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data); |
a64adam | 04be648 | 2013-01-17 11:29:32 -0600 | [diff] [blame] | 484 | |
| 485 | if ( nlsr->debugging ) |
| 486 | printf("Content Data: %s \n",content_data); |
akmhoque | 4ae1694 | 2012-12-10 11:50:43 -0600 | [diff] [blame] | 487 | } |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 488 | } |
| 489 | else |
| 490 | { |
a64adam | 04be648 | 2013-01-17 11:29:32 -0600 | [diff] [blame] | 491 | if ( nlsr->debugging ) |
| 492 | printf("Lsa is older than Router LSA refresh time/ Dead Interval\n"); |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 493 | } |
| 494 | } |
| 495 | else if(ls_type == LS_TYPE_ADJ) |
| 496 | { |
| 497 | res=ccn_name_comp_get(content_name->buf, components,lsa_position+2,&origtime, &comp_size); |
| 498 | get_name_part(orig_router,content_name,components,2); |
a64adam | 04be648 | 2013-01-17 11:29:32 -0600 | [diff] [blame] | 499 | |
| 500 | if ( nlsr->debugging ) |
| 501 | printf("Orig Time: %s\nOrig Router: %s\n",origtime,orig_router->name); |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 502 | |
akmhoque | 4ae1694 | 2012-12-10 11:50:43 -0600 | [diff] [blame] | 503 | int lsa_life_time=get_time_diff(time_stamp,(char *)origtime); |
akmhoque | 4ae1694 | 2012-12-10 11:50:43 -0600 | [diff] [blame] | 504 | if ( (strcmp((char *)orig_router,nlsr->router_name) == 0 && lsa_life_time < nlsr->lsa_refresh_time) || (strcmp((char *)orig_router,nlsr->router_name) != 0 && lsa_life_time < nlsr->router_dead_interval) ) |
| 505 | { |
| 506 | int is_new_adj_lsa=check_is_new_adj_lsa(orig_router->name,(char *)lst,(char *)origtime); |
| 507 | if ( is_new_adj_lsa == 1 ) |
| 508 | { |
a64adam | 04be648 | 2013-01-17 11:29:32 -0600 | [diff] [blame] | 509 | if ( nlsr->debugging ) |
| 510 | printf("New Adj LSA.....\n"); |
Obaid Amin | e63022a | 2013-01-15 23:36:40 -0600 | [diff] [blame] | 511 | get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data); |
a64adam | 04be648 | 2013-01-17 11:29:32 -0600 | [diff] [blame] | 512 | |
| 513 | if ( nlsr->debugging ) |
| 514 | printf("Content Data: %s \n",content_data); |
akmhoque | 4ae1694 | 2012-12-10 11:50:43 -0600 | [diff] [blame] | 515 | process_incoming_sync_content_lsa(content_data); |
| 516 | } |
| 517 | else |
| 518 | { |
a64adam | 04be648 | 2013-01-17 11:29:32 -0600 | [diff] [blame] | 519 | if ( nlsr->debugging ) |
| 520 | printf("Adj LSA / Newer Adj LSA already exists in LSDB\n"); |
Obaid Amin | e63022a | 2013-01-15 23:36:40 -0600 | [diff] [blame] | 521 | get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data); |
a64adam | 04be648 | 2013-01-17 11:29:32 -0600 | [diff] [blame] | 522 | if ( nlsr->debugging ) |
| 523 | printf("Content Data: %s \n",content_data); |
akmhoque | 4ae1694 | 2012-12-10 11:50:43 -0600 | [diff] [blame] | 524 | } |
| 525 | } |
| 526 | else |
| 527 | { |
a64adam | 04be648 | 2013-01-17 11:29:32 -0600 | [diff] [blame] | 528 | if ( nlsr->debugging ) |
| 529 | printf("Lsa is older than Router LSA refresh time/ Dead Interval\n"); |
akmhoque | 4ae1694 | 2012-12-10 11:50:43 -0600 | [diff] [blame] | 530 | } |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 531 | } |
akmhoque | ed418f3 | 2013-01-30 12:25:04 -0600 | [diff] [blame] | 532 | else if(ls_type == LS_TYPE_COR) |
| 533 | { |
| 534 | res=ccn_name_comp_get(content_name->buf, components,lsa_position+2,&origtime, &comp_size); |
| 535 | get_name_part(orig_router,content_name,components,2); |
| 536 | |
| 537 | if ( nlsr->debugging ) |
| 538 | printf("Orig Time: %s\nOrig Router: %s\n",origtime,orig_router->name); |
| 539 | |
| 540 | int lsa_life_time=get_time_diff(time_stamp,(char *)origtime); |
| 541 | if ( (strcmp((char *)orig_router,nlsr->router_name) == 0 && lsa_life_time < nlsr->lsa_refresh_time) || (strcmp((char *)orig_router,nlsr->router_name) != 0 && lsa_life_time < nlsr->router_dead_interval) ) |
| 542 | { |
| 543 | int is_new_cor_lsa=check_is_new_cor_lsa(orig_router->name,(char *)lst,(char *)origtime); |
| 544 | if ( is_new_cor_lsa == 1 ) |
| 545 | { |
| 546 | if ( nlsr->debugging ) |
| 547 | printf("New Cor LSA.....\n"); |
| 548 | get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data); |
| 549 | |
| 550 | if ( nlsr->debugging ) |
| 551 | printf("Content Data: %s \n",content_data); |
| 552 | process_incoming_sync_content_lsa(content_data); |
| 553 | } |
| 554 | else |
| 555 | { |
| 556 | if ( nlsr->debugging ) |
| 557 | printf("Cor LSA / Newer Cor LSA already exists in LSDB\n"); |
| 558 | get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data); |
| 559 | if ( nlsr->debugging ) |
| 560 | printf("Content Data: %s \n",content_data); |
| 561 | } |
| 562 | } |
| 563 | else |
| 564 | { |
| 565 | if ( nlsr->debugging ) |
| 566 | printf("Lsa is older than Router LSA refresh time/ Dead Interval\n"); |
| 567 | } |
| 568 | |
| 569 | } |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 570 | |
Obaid Amin | e63022a | 2013-01-15 23:36:40 -0600 | [diff] [blame] | 571 | if (content_data != NULL) |
| 572 | free(content_data); |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 573 | ccn_charbuf_destroy(&uri); |
akmhoque | 3b6c66d | 2013-01-31 15:30:23 -0600 | [diff] [blame] | 574 | //01/31/2013 |
| 575 | free(time_stamp); |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 576 | } |
| 577 | |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 578 | void |
| 579 | sync_monitor(char *topo_prefix, char *slice_prefix) |
| 580 | { |
| 581 | |
| 582 | static struct ccns_name_closure nc={0}; |
| 583 | |
| 584 | nlsr->closure = &nc; |
| 585 | struct ccn_charbuf *prefix = ccn_charbuf_create(); |
| 586 | struct ccn_charbuf *roothash = NULL; |
| 587 | struct ccn_charbuf *topo = ccn_charbuf_create(); |
| 588 | nlsr->slice = ccns_slice_create(); |
| 589 | ccn_charbuf_reset(prefix); |
| 590 | ccn_charbuf_reset(topo); |
| 591 | |
| 592 | ccn_charbuf_reset(prefix); |
| 593 | ccn_name_from_uri(prefix, slice_prefix); |
| 594 | |
| 595 | ccn_charbuf_reset(topo); |
| 596 | ccn_name_from_uri(topo, topo_prefix); |
| 597 | |
| 598 | |
| 599 | ccns_slice_set_topo_prefix(nlsr->slice, topo, prefix); |
Syed Obaid Amin | 3a3864b | 2013-01-09 03:05:50 -0600 | [diff] [blame] | 600 | nlsr->closure->callback = &sync_cb; |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 601 | nlsr->ccns = ccns_open(nlsr->ccn, nlsr->slice, nlsr->closure, roothash, NULL); |
akmhoque | 3b6c66d | 2013-01-31 15:30:23 -0600 | [diff] [blame] | 602 | |
| 603 | //01/31/2013 |
| 604 | ccn_charbuf_destroy(&prefix); |
| 605 | ccn_charbuf_destroy(&topo); |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 606 | } |
| 607 | |
| 608 | struct ccn_charbuf * |
| 609 | make_template(int scope) |
| 610 | { |
| 611 | struct ccn_charbuf *templ = NULL; |
| 612 | templ = ccn_charbuf_create(); |
| 613 | ccn_charbuf_append_tt(templ, CCN_DTAG_Interest, CCN_DTAG); |
| 614 | ccn_charbuf_append_tt(templ, CCN_DTAG_Name, CCN_DTAG); |
| 615 | ccn_charbuf_append_closer(templ); /* </Name> */ |
| 616 | if (0 <= scope && scope <= 2) |
| 617 | ccnb_tagged_putf(templ, CCN_DTAG_Scope, "%d", scope); |
| 618 | ccn_charbuf_append_closer(templ); /* </Interest> */ |
| 619 | return(templ); |
| 620 | } |
| 621 | |
akmhoque | fc5176d | 2013-01-18 09:50:12 -0600 | [diff] [blame] | 622 | int |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 623 | write_data_to_repo(char *data, char *name_prefix) |
| 624 | { |
akmhoque | 260698b | 2013-01-17 03:54:09 -0600 | [diff] [blame] | 625 | if ( nlsr->debugging ) |
| 626 | { |
| 627 | printf("write_data_to_repo called\n"); |
akmhoque | 47d19d1 | 2013-01-17 04:00:32 -0600 | [diff] [blame] | 628 | printf("Content Name: %s \n",name_prefix); |
akmhoque | 260698b | 2013-01-17 03:54:09 -0600 | [diff] [blame] | 629 | printf("Content Data: %s \n",data); |
| 630 | } |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 631 | |
akmhoque | 2ee1803 | 2013-01-22 10:01:23 -0600 | [diff] [blame] | 632 | struct ccn *temp_ccn; |
| 633 | temp_ccn=ccn_create(); |
| 634 | int ccn_fd=ccn_connect(temp_ccn, NULL); |
| 635 | if(ccn_fd == -1) |
| 636 | { |
| 637 | fprintf(stderr,"Could not connect to ccnd for Data Writing\n"); |
| 638 | writeLogg(__FILE__,__FUNCTION__,__LINE__,"Could not connect to ccnd for Data Writing\n"); |
| 639 | return -1; |
| 640 | } |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 641 | struct ccn_charbuf *name = NULL; |
| 642 | struct ccn_seqwriter *w = NULL; |
akmhoque | 2ee1803 | 2013-01-22 10:01:23 -0600 | [diff] [blame] | 643 | int blocksize = 4096; |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 644 | int freshness = -1; |
| 645 | int torepo = 1; |
| 646 | int scope = 1; |
| 647 | int res; |
| 648 | size_t blockread; |
| 649 | struct ccn_charbuf *templ; |
| 650 | |
| 651 | name = ccn_charbuf_create(); |
| 652 | res = ccn_name_from_uri(name, name_prefix); |
| 653 | if (res < 0) { |
| 654 | fprintf(stderr, "bad CCN URI: %s\n",name_prefix); |
akmhoque | fc5176d | 2013-01-18 09:50:12 -0600 | [diff] [blame] | 655 | return -1; |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 656 | } |
| 657 | |
| 658 | |
akmhoque | 2ee1803 | 2013-01-22 10:01:23 -0600 | [diff] [blame] | 659 | w = ccn_seqw_create(temp_ccn, name); |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 660 | if (w == NULL) { |
| 661 | fprintf(stderr, "ccn_seqw_create failed\n"); |
akmhoque | fc5176d | 2013-01-18 09:50:12 -0600 | [diff] [blame] | 662 | return -1; |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 663 | } |
| 664 | ccn_seqw_set_block_limits(w, blocksize, blocksize); |
| 665 | if (freshness > -1) |
| 666 | ccn_seqw_set_freshness(w, freshness); |
| 667 | if (torepo) { |
| 668 | struct ccn_charbuf *name_v = ccn_charbuf_create(); |
| 669 | ccn_seqw_get_name(w, name_v); |
| 670 | ccn_name_from_uri(name_v, "%C1.R.sw"); |
| 671 | ccn_name_append_nonce(name_v); |
| 672 | templ = make_template(scope); |
akmhoque | 2ee1803 | 2013-01-22 10:01:23 -0600 | [diff] [blame] | 673 | res = ccn_get(temp_ccn, name_v, templ, 60000, NULL, NULL, NULL, 0); |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 674 | ccn_charbuf_destroy(&templ); |
| 675 | ccn_charbuf_destroy(&name_v); |
| 676 | if (res < 0) { |
| 677 | fprintf(stderr, "No response from repository\n"); |
akmhoque | fc5176d | 2013-01-18 09:50:12 -0600 | [diff] [blame] | 678 | return -1; |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 679 | } |
| 680 | } |
| 681 | |
| 682 | |
| 683 | |
| 684 | |
| 685 | blockread = 0; |
akmhoque | 260698b | 2013-01-17 03:54:09 -0600 | [diff] [blame] | 686 | |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 687 | |
| 688 | blockread=strlen(data); |
| 689 | |
| 690 | if (blockread > 0) { |
akmhoque | 2ee1803 | 2013-01-22 10:01:23 -0600 | [diff] [blame] | 691 | ccn_run(temp_ccn, 100); |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 692 | res = ccn_seqw_write(w, data, blockread); |
akmhoque | 260698b | 2013-01-17 03:54:09 -0600 | [diff] [blame] | 693 | while (res == -1) { |
akmhoque | 2ee1803 | 2013-01-22 10:01:23 -0600 | [diff] [blame] | 694 | ccn_run(temp_ccn, 100); |
akmhoque | 260698b | 2013-01-17 03:54:09 -0600 | [diff] [blame] | 695 | res = ccn_seqw_write(w, data, blockread); |
| 696 | } |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 697 | } |
| 698 | |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 699 | ccn_seqw_close(w); |
akmhoque | 2ee1803 | 2013-01-22 10:01:23 -0600 | [diff] [blame] | 700 | ccn_run(temp_ccn, 100); |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 701 | ccn_charbuf_destroy(&name); |
akmhoque | 2ee1803 | 2013-01-22 10:01:23 -0600 | [diff] [blame] | 702 | ccn_destroy(&temp_ccn); |
akmhoque | fc5176d | 2013-01-18 09:50:12 -0600 | [diff] [blame] | 703 | |
| 704 | return 0; |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 705 | } |
| 706 | |
| 707 | |
| 708 | int |
| 709 | create_sync_slice(char *topo_prefix, char *slice_prefix) |
| 710 | { |
| 711 | int res; |
| 712 | struct ccns_slice *slice; |
| 713 | struct ccn_charbuf *prefix = ccn_charbuf_create(); |
| 714 | struct ccn_charbuf *topo = ccn_charbuf_create(); |
| 715 | struct ccn_charbuf *clause = ccn_charbuf_create(); |
| 716 | struct ccn_charbuf *slice_name = ccn_charbuf_create(); |
| 717 | struct ccn_charbuf *slice_uri = ccn_charbuf_create(); |
| 718 | |
| 719 | if (prefix == NULL || topo == NULL || clause == NULL || |
| 720 | slice_name == NULL || slice_uri == NULL) { |
| 721 | fprintf(stderr, "Unable to allocate required memory.\n"); |
akmhoque | fc5176d | 2013-01-18 09:50:12 -0600 | [diff] [blame] | 722 | return -1; |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 723 | } |
| 724 | |
| 725 | |
| 726 | slice = ccns_slice_create(); |
| 727 | |
| 728 | ccn_charbuf_reset(topo); |
| 729 | ccn_name_from_uri(topo, topo_prefix); |
| 730 | ccn_charbuf_reset(prefix); |
| 731 | ccn_name_from_uri(prefix,slice_prefix ); |
| 732 | ccns_slice_set_topo_prefix(slice, topo, prefix); |
| 733 | |
| 734 | |
| 735 | res = ccns_write_slice(nlsr->ccn, slice, slice_name); |
akmhoque | 3b6c66d | 2013-01-31 15:30:23 -0600 | [diff] [blame] | 736 | |
| 737 | //01/31/2013 |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 738 | ccns_slice_destroy(&slice); |
| 739 | ccn_charbuf_destroy(&prefix); |
| 740 | ccn_charbuf_destroy(&topo); |
| 741 | ccn_charbuf_destroy(&clause); |
| 742 | ccn_charbuf_destroy(&slice_name); |
| 743 | ccn_charbuf_destroy(&slice_uri); |
akmhoque | 3442576 | 2013-01-23 09:33:29 -0600 | [diff] [blame] | 744 | |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 745 | return 0; |
| 746 | } |
| 747 | |