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