akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [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 <assert.h> |
| 8 | #ifdef HAVE_CONFIG_H |
| 9 | #include <config.h> |
| 10 | #endif |
| 11 | #include <sys/types.h> |
| 12 | #include <signal.h> |
| 13 | |
| 14 | |
| 15 | |
| 16 | #include <ccn/ccn.h> |
| 17 | #include <ccn/uri.h> |
| 18 | #include <ccn/keystore.h> |
| 19 | #include <ccn/signing.h> |
| 20 | #include <ccn/schedule.h> |
| 21 | #include <ccn/hashtb.h> |
| 22 | |
| 23 | #include "nlsr.h" |
| 24 | #include "nlsr_npt.h" |
| 25 | #include "nlsr_fib.h" |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 26 | #include "nlsr_route.h" |
akmhoque | 3cced64 | 2012-09-24 16:20:20 -0500 | [diff] [blame^] | 27 | #include "nlsr_adl.h" |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 28 | |
| 29 | int |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 30 | add_npt_entry(char *orig_router, char *name_prefix, int num_face, int *faces, int *route_costs) |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 31 | { |
| 32 | if ( strcmp(orig_router,nlsr->router_name)== 0) |
| 33 | { |
| 34 | return -1; |
| 35 | } |
akmhoque | 3cced64 | 2012-09-24 16:20:20 -0500 | [diff] [blame^] | 36 | |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 37 | struct npt_entry *ne=(struct npt_entry*)malloc(sizeof(struct npt_entry )); |
| 38 | |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 39 | int res,res_nle,res_fle; |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 40 | struct hashtb_enumerator ee; |
| 41 | struct hashtb_enumerator *e = ⅇ |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 42 | |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 43 | |
| 44 | hashtb_start(nlsr->npt, e); |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 45 | res = hashtb_seek(e, orig_router, strlen(orig_router), 0); |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 46 | |
| 47 | if(res == HT_NEW_ENTRY) |
| 48 | { |
| 49 | ne=e->data; |
| 50 | |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 51 | ne->orig_router=(char *)malloc(strlen(orig_router)+1); |
| 52 | memset(ne->orig_router,0,strlen(orig_router)+1); |
| 53 | memcpy(ne->orig_router,orig_router,strlen(orig_router)); |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 54 | |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 55 | |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 56 | |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 57 | |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 58 | struct hashtb_param param_nle = {0}; |
| 59 | ne->name_list= hashtb_create(sizeof(struct name_list_entry ), ¶m_nle); |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 60 | |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 61 | struct hashtb_enumerator eenle; |
| 62 | struct hashtb_enumerator *enle = &eenle; |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 63 | |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 64 | hashtb_start(ne->name_list, enle); |
| 65 | res_nle = hashtb_seek(enle, name_prefix, strlen(name_prefix), 0); |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 66 | |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 67 | if(res_nle == HT_NEW_ENTRY ) |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 68 | { |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 69 | struct name_list_entry *nle=(struct name_list_entry *)malloc(sizeof(struct name_list_entry)); |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 70 | nle=enle->data; |
| 71 | nle->name=(char *)malloc(strlen(name_prefix)+1); |
| 72 | memset(nle->name,0,strlen(name_prefix)+1); |
| 73 | memcpy(nle->name,name_prefix,strlen(name_prefix)); |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 74 | |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 75 | |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 76 | |
| 77 | } |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 78 | hashtb_end(enle); |
| 79 | |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 80 | struct hashtb_param param_fle = {0}; |
| 81 | ne->face_list=hashtb_create(sizeof(struct face_list_entry), ¶m_fle); |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 82 | |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 83 | if ( num_face > 0 ) |
| 84 | { |
| 85 | struct hashtb_enumerator eef; |
| 86 | struct hashtb_enumerator *ef = &eef; |
| 87 | |
| 88 | hashtb_start(ne->face_list, ef); |
| 89 | int i; |
| 90 | |
akmhoque | 3cced64 | 2012-09-24 16:20:20 -0500 | [diff] [blame^] | 91 | for ( i=0; i < num_face ; i++) |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 92 | { |
| 93 | int face=faces[i]; |
| 94 | res_fle = hashtb_seek(ef, &face, sizeof(face), 0); |
| 95 | |
| 96 | if ( res_fle == HT_NEW_ENTRY ) |
| 97 | { |
| 98 | struct face_list_entry *fle=(struct face_list_entry *)malloc(sizeof(struct face_list_entry)); |
| 99 | fle=ef->data; |
| 100 | fle->next_hop_face=face; |
| 101 | fle->route_cost=route_costs[i]; |
| 102 | } |
| 103 | |
| 104 | } |
| 105 | hashtb_end(ef); |
| 106 | } |
| 107 | |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 108 | } |
| 109 | else if (res == HT_OLD_ENTRY) |
| 110 | { |
| 111 | free(ne); |
| 112 | struct npt_entry *one; |
| 113 | |
| 114 | one=e->data; |
| 115 | |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 116 | struct hashtb_enumerator eenle; |
| 117 | struct hashtb_enumerator *enle = &eenle; |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 118 | |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 119 | hashtb_start(one->name_list, enle); |
| 120 | res_nle = hashtb_seek(enle, name_prefix, strlen(name_prefix), 0); |
| 121 | |
| 122 | if(res_nle == HT_NEW_ENTRY ) |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 123 | { |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 124 | struct name_list_entry *nle=(struct name_list_entry *)malloc(sizeof(struct name_list_entry)); |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 125 | nle=enle->data; |
| 126 | nle->name=(char *)malloc(strlen(name_prefix)+1); |
| 127 | memset(nle->name,0,strlen(name_prefix)+1); |
| 128 | memcpy(nle->name,name_prefix,strlen(name_prefix)); |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 129 | } |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 130 | else if(res_nle == HT_OLD_ENTRY ) |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 131 | { |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 132 | |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 133 | } |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 134 | hashtb_end(enle); |
| 135 | |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 136 | if ( num_face > 0 ) |
| 137 | { |
| 138 | struct hashtb_enumerator eef; |
| 139 | struct hashtb_enumerator *ef = &eef; |
| 140 | |
| 141 | hashtb_start(one->face_list, ef); |
| 142 | int i; |
| 143 | |
| 144 | for ( i=0; i< num_face ; i ++) |
| 145 | { |
| 146 | int face=faces[i]; |
| 147 | res_fle = hashtb_seek(ef, &face, sizeof(face), 0); |
| 148 | |
| 149 | if ( res_fle == HT_NEW_ENTRY ) |
| 150 | { |
| 151 | struct face_list_entry *fle=(struct face_list_entry *)malloc(sizeof(struct face_list_entry)); |
| 152 | fle=ef->data; |
| 153 | fle->next_hop_face=face; |
| 154 | fle->route_cost=route_costs[i]; |
| 155 | } |
| 156 | |
| 157 | } |
| 158 | hashtb_end(ef); |
| 159 | } |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 160 | |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 161 | |
| 162 | } |
| 163 | hashtb_end(e); |
akmhoque | 3cced64 | 2012-09-24 16:20:20 -0500 | [diff] [blame^] | 164 | |
| 165 | update_ccnd_fib_for_orig_router(orig_router); |
| 166 | |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 167 | return res; |
| 168 | } |
| 169 | |
akmhoque | 3cced64 | 2012-09-24 16:20:20 -0500 | [diff] [blame^] | 170 | void |
| 171 | update_ccnd_fib_for_orig_router(char *orig_router) |
| 172 | { |
| 173 | |
| 174 | int res; |
| 175 | struct hashtb_enumerator ee; |
| 176 | struct hashtb_enumerator *e = ⅇ |
| 177 | |
| 178 | |
| 179 | hashtb_start(nlsr->npt, e); |
| 180 | res = hashtb_seek(e, orig_router, strlen(orig_router), 0); |
| 181 | |
| 182 | if(res == HT_NEW_ENTRY) |
| 183 | { |
| 184 | hashtb_delete(e); |
| 185 | } |
| 186 | else if ( res == HT_OLD_ENTRY ) |
| 187 | { |
| 188 | struct npt_entry *ne; |
| 189 | ne=e->data; |
| 190 | int num_face=hashtb_n(ne->face_list); |
| 191 | int last_face,first_face; |
| 192 | |
| 193 | int *faces=(int *)malloc(num_face*sizeof(int)); |
| 194 | int *route_costs=(int *)malloc(num_face*sizeof(int)); |
| 195 | |
| 196 | get_all_faces_for_orig_router_from_npt(orig_router,faces,route_costs,num_face); |
| 197 | sort_faces_by_distance(faces,route_costs,0,num_face); |
| 198 | |
| 199 | |
| 200 | first_face=num_face-1; |
| 201 | |
| 202 | if ( nlsr->multi_path_face_num == 0 ) |
| 203 | { |
| 204 | last_face=first_face; |
| 205 | } |
| 206 | else |
| 207 | { |
| 208 | if ( num_face <= nlsr->multi_path_face_num) |
| 209 | { |
| 210 | last_face=0; |
| 211 | } |
| 212 | else if ( nlsr->multi_path_face_num == 0) |
| 213 | { |
| 214 | last_face=num_face-nlsr->multi_path_face_num; |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | int i,j, nl_element; |
| 219 | struct name_list_entry *nle; |
| 220 | struct hashtb_enumerator eenle; |
| 221 | struct hashtb_enumerator *enle = &eenle; |
| 222 | |
| 223 | hashtb_start(ne->name_list, enle); |
| 224 | nl_element=hashtb_n(ne->name_list); |
| 225 | |
| 226 | for (i=0;i<nl_element;i++) |
| 227 | { |
| 228 | nle=enle->data; |
| 229 | |
| 230 | for( j=first_face; j>= last_face; j--) |
| 231 | { |
| 232 | if ( j == last_face ) |
| 233 | { |
| 234 | if( is_neighbor(nle->name) == 0 ) |
| 235 | { |
| 236 | add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_REG, faces[j]); |
| 237 | } |
| 238 | } |
| 239 | else |
| 240 | { |
| 241 | if ( num_face-nlsr->multi_path_face_num > 0 && is_neighbor(orig_router) == 0 ) |
| 242 | { |
| 243 | add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_REG, faces[j]); |
| 244 | } |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | hashtb_next(enle); |
| 249 | } |
| 250 | hashtb_end(enle); |
| 251 | |
| 252 | |
| 253 | |
| 254 | free(faces); |
| 255 | free(route_costs); |
| 256 | |
| 257 | } |
| 258 | hashtb_end(e); |
| 259 | |
| 260 | } |
| 261 | |
akmhoque | ffacaa8 | 2012-09-13 17:48:30 -0500 | [diff] [blame] | 262 | int |
akmhoque | 3cced64 | 2012-09-24 16:20:20 -0500 | [diff] [blame^] | 263 | delete_npt_entry_by_router_and_name_prefix(char *orig_router, char *name_prefix) |
akmhoque | ffacaa8 | 2012-09-13 17:48:30 -0500 | [diff] [blame] | 264 | { |
| 265 | if ( strcmp(orig_router,nlsr->router_name)== 0) |
| 266 | { |
| 267 | return -1; |
| 268 | } |
| 269 | |
| 270 | struct npt_entry *ne; |
| 271 | |
| 272 | int res,res_nle; |
| 273 | struct hashtb_enumerator ee; |
| 274 | struct hashtb_enumerator *e = ⅇ |
| 275 | |
| 276 | |
| 277 | hashtb_start(nlsr->npt, e); |
| 278 | res = hashtb_seek(e, orig_router, strlen(orig_router), 0); |
| 279 | |
| 280 | if(res == HT_NEW_ENTRY) |
| 281 | { |
| 282 | hashtb_delete(e); |
| 283 | return -1; |
| 284 | } |
| 285 | else if (res == HT_OLD_ENTRY) |
| 286 | { |
| 287 | ne=e->data; |
| 288 | |
| 289 | struct hashtb_enumerator eenle; |
| 290 | struct hashtb_enumerator *enle = &eenle; |
| 291 | |
| 292 | hashtb_start(ne->name_list, enle); |
| 293 | res_nle = hashtb_seek(enle, name_prefix, strlen(name_prefix), 0); |
| 294 | |
| 295 | if(res_nle == HT_NEW_ENTRY ) |
| 296 | { |
| 297 | hashtb_delete(enle); |
| 298 | } |
| 299 | else if(res_nle == HT_OLD_ENTRY ) |
| 300 | { |
akmhoque | 3cced64 | 2012-09-24 16:20:20 -0500 | [diff] [blame^] | 301 | struct name_list_entry *nle; |
| 302 | |
| 303 | nle=enle->data; |
| 304 | |
| 305 | int j; |
| 306 | int num_face=hashtb_n(ne->face_list); |
| 307 | int last_face,first_face; |
| 308 | |
| 309 | int *faces=(int *)malloc(num_face*sizeof(int)); |
| 310 | int *route_costs=(int *)malloc(num_face*sizeof(int)); |
| 311 | |
| 312 | get_all_faces_for_orig_router_from_npt(orig_router,faces,route_costs,num_face); |
| 313 | sort_faces_by_distance(faces,route_costs,0,num_face); |
| 314 | |
| 315 | |
| 316 | first_face=num_face-1; |
| 317 | |
| 318 | if ( nlsr->multi_path_face_num == 0 ) |
akmhoque | ffacaa8 | 2012-09-13 17:48:30 -0500 | [diff] [blame] | 319 | { |
akmhoque | 3cced64 | 2012-09-24 16:20:20 -0500 | [diff] [blame^] | 320 | last_face=first_face; |
akmhoque | ffacaa8 | 2012-09-13 17:48:30 -0500 | [diff] [blame] | 321 | } |
akmhoque | 3cced64 | 2012-09-24 16:20:20 -0500 | [diff] [blame^] | 322 | else |
| 323 | { |
| 324 | if ( num_face <= nlsr->multi_path_face_num) |
| 325 | { |
| 326 | last_face=0; |
| 327 | } |
| 328 | else if ( nlsr->multi_path_face_num == 0) |
| 329 | { |
| 330 | last_face=num_face-nlsr->multi_path_face_num; |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | for( j=first_face; j>= last_face; j--) |
| 335 | { |
| 336 | if ( j == last_face ) |
| 337 | { |
| 338 | if( is_neighbor(nle->name) == 0 ) |
| 339 | { |
| 340 | add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, faces[j]); |
| 341 | } |
| 342 | } |
| 343 | else |
| 344 | { |
| 345 | if ( num_face-nlsr->multi_path_face_num > 0 && is_neighbor(orig_router) == 0 ) |
| 346 | { |
| 347 | add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, faces[j]); |
| 348 | } |
| 349 | } |
| 350 | } |
| 351 | |
| 352 | |
| 353 | |
| 354 | |
akmhoque | ffacaa8 | 2012-09-13 17:48:30 -0500 | [diff] [blame] | 355 | hashtb_delete(enle); |
| 356 | } |
| 357 | |
| 358 | hashtb_end(enle); |
akmhoque | da5b683 | 2012-09-13 22:33:55 -0500 | [diff] [blame] | 359 | |
| 360 | if ( hashtb_n(ne->name_list) == 0 ) |
| 361 | { |
| 362 | hashtb_delete(e); |
| 363 | } |
akmhoque | ffacaa8 | 2012-09-13 17:48:30 -0500 | [diff] [blame] | 364 | } |
| 365 | |
| 366 | hashtb_end(e); |
| 367 | |
| 368 | return 0; |
| 369 | } |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 370 | |
| 371 | void |
| 372 | print_npt(void) |
| 373 | { |
| 374 | printf("\n"); |
| 375 | printf("print_npt called\n\n"); |
| 376 | int i, npt_element; |
| 377 | |
| 378 | struct npt_entry *ne; |
| 379 | |
| 380 | struct hashtb_enumerator ee; |
| 381 | struct hashtb_enumerator *e = ⅇ |
| 382 | |
| 383 | hashtb_start(nlsr->npt, e); |
| 384 | npt_element=hashtb_n(nlsr->npt); |
| 385 | |
| 386 | for(i=0;i<npt_element;i++) |
| 387 | { |
| 388 | printf("\n"); |
| 389 | printf("----------NPT ENTRY %d------------------\n",i+1); |
| 390 | ne=e->data; |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 391 | printf(" Origination Router: %s \n",ne->orig_router); |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 392 | //ne->next_hop_face == NO_FACE ? printf(" Next Hop Face: NO_NEXT_HOP \n") : printf(" Next Hop Face: %d \n", ne->next_hop_face); |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 393 | |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 394 | int j, nl_element,face_list_element; |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 395 | struct name_list_entry *nle; |
| 396 | struct hashtb_enumerator eenle; |
| 397 | struct hashtb_enumerator *enle = &eenle; |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 398 | |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 399 | hashtb_start(ne->name_list, enle); |
| 400 | nl_element=hashtb_n(ne->name_list); |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 401 | |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 402 | for (j=0;j<nl_element;j++) |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 403 | { |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 404 | nle=enle->data; |
| 405 | printf(" Name Prefix: %s \n",nle->name); |
| 406 | hashtb_next(enle); |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 407 | } |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 408 | hashtb_end(enle); |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 409 | |
| 410 | struct face_list_entry *fle; |
| 411 | |
| 412 | struct hashtb_enumerator eef; |
| 413 | struct hashtb_enumerator *ef = &eef; |
| 414 | |
| 415 | hashtb_start(ne->face_list, ef); |
| 416 | face_list_element=hashtb_n(ne->face_list); |
| 417 | if ( face_list_element <= 0 ) |
| 418 | { |
| 419 | printf(" Face: No Face \n"); |
| 420 | } |
| 421 | else |
| 422 | { |
| 423 | for(j=0;j<face_list_element;j++) |
| 424 | { |
| 425 | fle=ef->data; |
| 426 | printf(" Face: %d Route_Cost: %d \n",fle->next_hop_face,fle->route_cost); |
| 427 | hashtb_next(ef); |
| 428 | } |
| 429 | } |
| 430 | hashtb_end(ef); |
| 431 | |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 432 | |
| 433 | hashtb_next(e); |
| 434 | } |
| 435 | |
| 436 | hashtb_end(e); |
| 437 | |
| 438 | printf("\n"); |
| 439 | } |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 440 | |
| 441 | void |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 442 | delete_orig_router_from_npt(char *orig_router) |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 443 | { |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 444 | int res,num_face,num_prefix; |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 445 | struct npt_entry *ne; |
| 446 | |
| 447 | struct hashtb_enumerator ee; |
| 448 | struct hashtb_enumerator *e = ⅇ |
| 449 | |
| 450 | hashtb_start(nlsr->npt, e); |
| 451 | res = hashtb_seek(e, orig_router, strlen(orig_router), 0); |
| 452 | |
| 453 | if ( res == HT_OLD_ENTRY ) |
| 454 | { |
| 455 | ne=e->data; |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 456 | num_prefix=hashtb_n(ne->name_list); |
| 457 | if ( num_prefix > 0 ) |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 458 | { |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 459 | num_face=hashtb_n(ne->face_list); |
| 460 | |
| 461 | if ( num_face > 0 ) |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 462 | { |
| 463 | int j, nl_element; |
| 464 | struct name_list_entry *nle; |
| 465 | struct hashtb_enumerator eenle; |
| 466 | struct hashtb_enumerator *enle = &eenle; |
| 467 | |
| 468 | hashtb_start(ne->name_list, enle); |
| 469 | nl_element=hashtb_n(ne->name_list); |
| 470 | |
| 471 | for (j=0;j<nl_element;j++) |
| 472 | { |
| 473 | nle=enle->data; |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 474 | |
akmhoque | 3cced64 | 2012-09-24 16:20:20 -0500 | [diff] [blame^] | 475 | delete_npt_entry_by_router_and_name_prefix(ne->orig_router,nle->name); |
| 476 | |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 477 | hashtb_next(enle); |
| 478 | } |
| 479 | hashtb_end(enle); |
| 480 | |
| 481 | } |
| 482 | |
| 483 | } |
| 484 | hashtb_destroy(&ne->name_list); |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 485 | hashtb_destroy(&ne->face_list); |
akmhoque | 810a5b5 | 2012-09-09 16:53:14 -0500 | [diff] [blame] | 486 | hashtb_delete(e); |
| 487 | } |
| 488 | else if ( res == HT_NEW_ENTRY ) |
| 489 | { |
| 490 | hashtb_delete(e); |
| 491 | } |
| 492 | hashtb_end(e); |
| 493 | } |
akmhoque | fbfd098 | 2012-09-09 20:59:03 -0500 | [diff] [blame] | 494 | |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 495 | |
| 496 | void |
| 497 | add_face_to_npt_by_face_id(char *dest_router, int face_id, int route_cost) |
| 498 | { |
| 499 | printf("add_face_to_npt_by_face_id called\n"); |
| 500 | |
| 501 | printf("Dest Router: %s Face: %d Route_cost: %d \n",dest_router, face_id, route_cost); |
| 502 | int res,res1; |
| 503 | struct npt_entry *ne; |
| 504 | |
| 505 | struct hashtb_enumerator ee; |
| 506 | struct hashtb_enumerator *e = ⅇ |
| 507 | |
| 508 | hashtb_start(nlsr->npt, e); |
| 509 | res = hashtb_seek(e, dest_router, strlen(dest_router), 0); |
| 510 | |
| 511 | if ( res == HT_OLD_ENTRY ) |
| 512 | { |
| 513 | printf("Dest Router Found \n"); |
| 514 | ne=e->data; |
| 515 | |
| 516 | struct hashtb_enumerator eef; |
| 517 | struct hashtb_enumerator *ef = &eef; |
| 518 | |
| 519 | hashtb_start(ne->face_list, ef); |
| 520 | res1=hashtb_seek(ef, &face_id, sizeof(face_id), 0); |
| 521 | |
| 522 | if ( res1 == HT_OLD_ENTRY ) |
| 523 | { |
| 524 | printf("Face Found \n"); |
| 525 | struct face_list_entry *fle;//=(struct face_list_entry *)malloc(sizeof(struct face_list_entry)); |
| 526 | fle=ef->data; |
| 527 | fle->next_hop_face=face_id; |
| 528 | fle->route_cost=route_cost; |
| 529 | } |
| 530 | else if ( res1 == HT_NEW_ENTRY ) |
| 531 | { |
| 532 | printf("Face Not Found \n"); |
| 533 | struct face_list_entry *fle=(struct face_list_entry *)malloc(sizeof(struct face_list_entry)); |
| 534 | fle=ef->data; |
| 535 | fle->next_hop_face=face_id; |
| 536 | fle->route_cost=route_cost; |
| 537 | //hashtb_delete(ef); |
| 538 | } |
| 539 | hashtb_end(ef); |
| 540 | } |
| 541 | else if (res == HT_NEW_ENTRY) |
| 542 | { |
| 543 | hashtb_delete(e); |
| 544 | } |
| 545 | |
| 546 | hashtb_end(e); |
| 547 | } |
| 548 | |
| 549 | |
| 550 | void |
akmhoque | 3cced64 | 2012-09-24 16:20:20 -0500 | [diff] [blame^] | 551 | add_new_fib_entries_to_npt(void) |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 552 | { |
| 553 | printf("add_new_fib_entries_to_npt called\n"); |
| 554 | int i,j, rt_element,face_list_element; |
| 555 | |
| 556 | struct routing_table_entry *rte; |
| 557 | |
| 558 | struct hashtb_enumerator ee; |
| 559 | struct hashtb_enumerator *e = ⅇ |
| 560 | |
| 561 | hashtb_start(nlsr->routing_table, e); |
| 562 | rt_element=hashtb_n(nlsr->routing_table); |
| 563 | |
| 564 | for(i=0;i<rt_element;i++) |
| 565 | { |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 566 | rte=e->data; |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 567 | |
| 568 | struct face_list_entry *fle; |
| 569 | |
| 570 | struct hashtb_enumerator eef; |
| 571 | struct hashtb_enumerator *ef = &eef; |
| 572 | |
| 573 | hashtb_start(rte->face_list, ef); |
| 574 | face_list_element=hashtb_n(rte->face_list); |
| 575 | if ( face_list_element <= 0 ) |
| 576 | { |
| 577 | printf(" Face: No Face \n"); |
| 578 | } |
| 579 | else |
| 580 | { |
| 581 | for(j=0;j<face_list_element;j++) |
| 582 | { |
| 583 | fle=ef->data; |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 584 | add_face_to_npt_by_face_id(rte->dest_router,fle->next_hop_face,fle->route_cost); |
| 585 | hashtb_next(ef); |
| 586 | } |
| 587 | } |
| 588 | hashtb_end(ef); |
| 589 | |
| 590 | hashtb_next(e); |
| 591 | } |
| 592 | |
| 593 | hashtb_end(e); |
| 594 | |
| 595 | } |
| 596 | |
| 597 | |
| 598 | void |
| 599 | delete_face_from_npt_by_face_id(char *dest_router, int face_id) |
| 600 | { |
| 601 | printf("delete_face_from_npt_by_face_id called\n"); |
| 602 | |
| 603 | int res,res1; |
| 604 | struct npt_entry *ne; |
| 605 | |
| 606 | struct hashtb_enumerator ee; |
| 607 | struct hashtb_enumerator *e = ⅇ |
| 608 | |
| 609 | hashtb_start(nlsr->npt, e); |
| 610 | res = hashtb_seek(e, dest_router, strlen(dest_router), 0); |
| 611 | |
| 612 | if ( res == HT_OLD_ENTRY ) |
| 613 | { |
| 614 | ne=e->data; |
| 615 | |
| 616 | struct hashtb_enumerator eef; |
| 617 | struct hashtb_enumerator *ef = &eef; |
| 618 | |
| 619 | hashtb_start(ne->face_list, ef); |
| 620 | res1=hashtb_seek(ef, &face_id, sizeof(face_id), 0); |
| 621 | |
| 622 | if ( res1 == HT_OLD_ENTRY ) |
| 623 | { |
| 624 | hashtb_delete(ef); |
| 625 | } |
| 626 | else if ( res1 == HT_NEW_ENTRY ) |
| 627 | { |
| 628 | hashtb_delete(ef); |
| 629 | } |
| 630 | hashtb_end(ef); |
| 631 | } |
| 632 | else if (res == HT_NEW_ENTRY) |
| 633 | { |
| 634 | hashtb_delete(e); |
| 635 | } |
| 636 | |
| 637 | hashtb_end(e); |
| 638 | } |
| 639 | |
| 640 | int |
| 641 | delete_old_face_from_npt(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags) |
| 642 | { |
| 643 | if(flags == CCN_SCHEDULE_CANCEL) |
| 644 | { |
| 645 | return -1; |
| 646 | } |
| 647 | |
| 648 | nlsr_lock(); |
| 649 | |
| 650 | printf("delete_old_face_from_npt called\n"); |
| 651 | if ( ev->evdata != NULL ) |
| 652 | { |
| 653 | printf("Event Data: %s \n",(char *)ev->evdata); |
| 654 | char *sep="|"; |
| 655 | char *rem; |
| 656 | char *orig_router; |
| 657 | char *faceid; |
| 658 | int face_id; |
| 659 | |
| 660 | char *face_data=(char *)malloc(strlen((char *)ev->evdata)+1); |
| 661 | memset(face_data,0,strlen((char *)ev->evdata)+1); |
| 662 | memcpy(face_data+strlen(face_data),(char *)ev->evdata,strlen((char *)ev->evdata)); |
| 663 | |
| 664 | orig_router=strtok_r(face_data,sep,&rem); |
| 665 | faceid=strtok_r(NULL,sep,&rem); |
| 666 | face_id=atoi(faceid); |
| 667 | printf("Orig Router: %s Face: %d \n",orig_router,face_id); |
| 668 | |
| 669 | delete_face_from_npt_by_face_id(orig_router,face_id); |
| 670 | } |
| 671 | |
| 672 | nlsr_unlock(); |
| 673 | |
| 674 | return 0; |
| 675 | } |
| 676 | |
| 677 | void |
akmhoque | 3cced64 | 2012-09-24 16:20:20 -0500 | [diff] [blame^] | 678 | clean_old_fib_entries_from_npt(void) |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 679 | { |
| 680 | |
| 681 | printf("clean_old_fib_entries_from_npt called\n\n"); |
| 682 | int i, npt_element; |
| 683 | |
| 684 | struct npt_entry *ne; |
| 685 | |
| 686 | struct hashtb_enumerator ee; |
| 687 | struct hashtb_enumerator *e = ⅇ |
| 688 | |
| 689 | hashtb_start(nlsr->npt, e); |
| 690 | npt_element=hashtb_n(nlsr->npt); |
| 691 | |
| 692 | for(i=0;i<npt_element;i++) |
| 693 | { |
| 694 | ne=e->data; |
| 695 | |
| 696 | int j,k, nl_element,face_list_element; |
| 697 | struct face_list_entry *fle; |
| 698 | |
| 699 | struct hashtb_enumerator eef; |
| 700 | struct hashtb_enumerator *ef = &eef; |
| 701 | |
| 702 | hashtb_start(ne->face_list, ef); |
| 703 | face_list_element=hashtb_n(ne->face_list); |
| 704 | if ( face_list_element <= 0 ) |
| 705 | { |
| 706 | printf(" Face: No Face \n"); |
| 707 | } |
| 708 | else |
| 709 | { |
| 710 | for(j=0;j<face_list_element;j++) |
| 711 | { |
| 712 | fle=ef->data; |
| 713 | int check=does_face_exist_for_router(ne->orig_router,fle->next_hop_face); |
| 714 | if ( check == 0 ) |
| 715 | { |
| 716 | struct name_list_entry *nle; |
| 717 | struct hashtb_enumerator eenle; |
| 718 | struct hashtb_enumerator *enle = &eenle; |
| 719 | |
| 720 | hashtb_start(ne->name_list, enle); |
| 721 | nl_element=hashtb_n(ne->name_list); |
| 722 | |
| 723 | for (k=0;k<nl_element;k++) |
| 724 | { |
| 725 | nle=enle->data; |
| 726 | |
akmhoque | 3cced64 | 2012-09-24 16:20:20 -0500 | [diff] [blame^] | 727 | //delete all the fib entries here |
| 728 | if( is_neighbor(nle->name) == 0 ) |
| 729 | { |
| 730 | add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, fle->next_hop_face); |
| 731 | } |
| 732 | |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 733 | |
| 734 | hashtb_next(enle); |
| 735 | } |
| 736 | hashtb_end(enle); |
| 737 | |
| 738 | char faceid[20]; |
| 739 | memset(faceid,0,20); |
| 740 | sprintf(faceid,"%d",fle->next_hop_face); |
| 741 | char *evdata=(char *)malloc(strlen(ne->orig_router)+strlen(faceid)+2); |
| 742 | memset(evdata,0,strlen(ne->orig_router)+strlen(faceid)+2); |
| 743 | memcpy(evdata+strlen(evdata),ne->orig_router,strlen(ne->orig_router)); |
| 744 | memcpy(evdata+strlen(evdata),"|",1); |
| 745 | memcpy(evdata+strlen(evdata),faceid,strlen(faceid)); |
| 746 | |
| 747 | nlsr->event = ccn_schedule_event(nlsr->sched, 1, &delete_old_face_from_npt, (void *)evdata, 0); |
| 748 | |
| 749 | } |
| 750 | |
| 751 | hashtb_next(ef); |
| 752 | } |
| 753 | } |
| 754 | hashtb_end(ef); |
| 755 | |
| 756 | |
| 757 | hashtb_next(e); |
| 758 | } |
| 759 | |
| 760 | hashtb_end(e); |
| 761 | |
| 762 | } |
| 763 | |
| 764 | void |
akmhoque | 3cced64 | 2012-09-24 16:20:20 -0500 | [diff] [blame^] | 765 | update_npt_with_new_route(void) |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 766 | { |
| 767 | clean_old_fib_entries_from_npt(); |
| 768 | add_new_fib_entries_to_npt(); |
akmhoque | 3cced64 | 2012-09-24 16:20:20 -0500 | [diff] [blame^] | 769 | |
| 770 | int i, npt_element; |
| 771 | |
| 772 | struct npt_entry *ne; |
| 773 | |
| 774 | struct hashtb_enumerator ee; |
| 775 | struct hashtb_enumerator *e = ⅇ |
| 776 | |
| 777 | hashtb_start(nlsr->npt, e); |
| 778 | npt_element=hashtb_n(nlsr->npt); |
| 779 | |
| 780 | for(i=0;i<npt_element;i++) |
| 781 | { |
| 782 | |
| 783 | ne=e->data; |
| 784 | update_ccnd_fib_for_orig_router(ne->orig_router); |
| 785 | hashtb_next(e); |
| 786 | } |
| 787 | |
| 788 | hashtb_end(e); |
| 789 | } |
| 790 | |
| 791 | |
| 792 | |
| 793 | void |
| 794 | sort_faces_by_distance(int *faces,int *route_costs,int start,int element) |
| 795 | { |
| 796 | int i,j; |
| 797 | int temp_cost; |
| 798 | int temp_face; |
| 799 | |
| 800 | for ( i=start ; i < element ; i ++) |
| 801 | { |
| 802 | for( j=i+1; j<element; j ++) |
| 803 | { |
| 804 | if (route_costs[j] < route_costs[i] ) |
| 805 | { |
| 806 | temp_cost=route_costs[j]; |
| 807 | route_costs[j]=route_costs[i]; |
| 808 | route_costs[i]=temp_cost; |
| 809 | |
| 810 | temp_face=faces[j]; |
| 811 | faces[j]=faces[i]; |
| 812 | faces[i]=temp_face; |
| 813 | } |
| 814 | } |
| 815 | } |
| 816 | |
| 817 | } |
| 818 | |
| 819 | void |
| 820 | get_all_faces_for_orig_router_from_npt(char *orig_router, int *faces, int *route_costs, int num_faces) |
| 821 | { |
| 822 | |
| 823 | int res,face_list_element,j; |
| 824 | struct hashtb_enumerator ee; |
| 825 | struct hashtb_enumerator *e = ⅇ |
| 826 | |
| 827 | |
| 828 | hashtb_start(nlsr->npt, e); |
| 829 | res = hashtb_seek(e, orig_router, strlen(orig_router), 0); |
| 830 | |
| 831 | if(res == HT_NEW_ENTRY) |
| 832 | { |
| 833 | hashtb_delete(e); |
| 834 | } |
| 835 | else if ( res == HT_OLD_ENTRY ) |
| 836 | { |
| 837 | struct npt_entry *ne; |
| 838 | ne=e->data; |
| 839 | |
| 840 | struct face_list_entry *fle; |
| 841 | |
| 842 | struct hashtb_enumerator eef; |
| 843 | struct hashtb_enumerator *ef = &eef; |
| 844 | |
| 845 | hashtb_start(ne->face_list, ef); |
| 846 | face_list_element=hashtb_n(ne->face_list); |
| 847 | for(j=0;j<face_list_element;j++) |
| 848 | { |
| 849 | fle=ef->data; |
| 850 | faces[j]=fle->next_hop_face; |
| 851 | route_costs[j]=fle->route_cost; |
| 852 | hashtb_next(ef); |
| 853 | } |
| 854 | hashtb_end(ef); |
| 855 | |
| 856 | |
| 857 | } |
| 858 | hashtb_end(e); |
| 859 | |
| 860 | } |
| 861 | |
| 862 | void |
| 863 | destroy_faces_by_orig_router(char *orig_router) |
| 864 | { |
| 865 | |
| 866 | int res; |
| 867 | struct hashtb_enumerator ee; |
| 868 | struct hashtb_enumerator *e = ⅇ |
| 869 | |
| 870 | |
| 871 | hashtb_start(nlsr->npt, e); |
| 872 | res = hashtb_seek(e, orig_router, strlen(orig_router), 0); |
| 873 | |
| 874 | if(res == HT_NEW_ENTRY) |
| 875 | { |
| 876 | hashtb_delete(e); |
| 877 | } |
| 878 | else if ( res == HT_OLD_ENTRY ) |
| 879 | { |
| 880 | struct npt_entry *ne; |
| 881 | ne=e->data; |
| 882 | int num_face=hashtb_n(ne->face_list); |
| 883 | int last_face,first_face; |
| 884 | |
| 885 | int *faces=(int *)malloc(num_face*sizeof(int)); |
| 886 | int *route_costs=(int *)malloc(num_face*sizeof(int)); |
| 887 | |
| 888 | get_all_faces_for_orig_router_from_npt(orig_router,faces,route_costs,num_face); |
| 889 | sort_faces_by_distance(faces,route_costs,0,num_face); |
| 890 | |
| 891 | |
| 892 | first_face=num_face-1; |
| 893 | |
| 894 | if ( nlsr->multi_path_face_num == 0 ) |
| 895 | { |
| 896 | last_face=first_face; |
| 897 | } |
| 898 | else |
| 899 | { |
| 900 | if ( num_face <= nlsr->multi_path_face_num) |
| 901 | { |
| 902 | last_face=0; |
| 903 | } |
| 904 | else if ( nlsr->multi_path_face_num == 0) |
| 905 | { |
| 906 | last_face=num_face-nlsr->multi_path_face_num; |
| 907 | } |
| 908 | } |
| 909 | |
| 910 | int i,j, nl_element; |
| 911 | struct name_list_entry *nle; |
| 912 | struct hashtb_enumerator eenle; |
| 913 | struct hashtb_enumerator *enle = &eenle; |
| 914 | |
| 915 | hashtb_start(ne->name_list, enle); |
| 916 | nl_element=hashtb_n(ne->name_list); |
| 917 | |
| 918 | for (i=0;i<nl_element;i++) |
| 919 | { |
| 920 | nle=enle->data; |
| 921 | |
| 922 | for( j=first_face; j>= last_face; j--) |
| 923 | { |
| 924 | if ( j == last_face ) |
| 925 | { |
| 926 | if( is_neighbor(nle->name) == 0 ) |
| 927 | { |
| 928 | add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, faces[j]); |
| 929 | } |
| 930 | } |
| 931 | else |
| 932 | { |
| 933 | if ( num_face-nlsr->multi_path_face_num > 0 && is_neighbor(orig_router) == 0 ) |
| 934 | { |
| 935 | add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, faces[j]); |
| 936 | } |
| 937 | } |
| 938 | } |
| 939 | |
| 940 | hashtb_next(enle); |
| 941 | } |
| 942 | hashtb_end(enle); |
| 943 | |
| 944 | |
| 945 | |
| 946 | free(faces); |
| 947 | free(route_costs); |
| 948 | |
| 949 | } |
| 950 | hashtb_end(e); |
| 951 | |
akmhoque | de61ba9 | 2012-09-20 22:19:12 -0500 | [diff] [blame] | 952 | } |
| 953 | |
akmhoque | fbfd098 | 2012-09-09 20:59:03 -0500 | [diff] [blame] | 954 | void |
| 955 | destroy_all_face_by_nlsr(void) |
| 956 | { |
| 957 | int i, npt_element; |
| 958 | |
| 959 | struct npt_entry *ne; |
| 960 | |
| 961 | struct hashtb_enumerator ee; |
| 962 | struct hashtb_enumerator *e = ⅇ |
| 963 | |
| 964 | hashtb_start(nlsr->npt, e); |
| 965 | npt_element=hashtb_n(nlsr->npt); |
| 966 | |
| 967 | for(i=0;i<npt_element;i++) |
| 968 | { |
akmhoque | fbfd098 | 2012-09-09 20:59:03 -0500 | [diff] [blame] | 969 | ne=e->data; |
akmhoque | 3cced64 | 2012-09-24 16:20:20 -0500 | [diff] [blame^] | 970 | destroy_faces_by_orig_router(ne->orig_router); |
akmhoque | fbfd098 | 2012-09-09 20:59:03 -0500 | [diff] [blame] | 971 | hashtb_next(e); |
| 972 | } |
| 973 | |
| 974 | hashtb_end(e); |
| 975 | |
| 976 | printf("\n"); |
| 977 | } |