void reboot_node(CnetEvent ev, CnetTimer timer, CnetData data) { /* Indicate our interest in EV_DEBUG1, EV_DEBUG2 and EV_PHYSICALREADY events */ CHECK(CNET_set_handler(EV_PHYSICALREADY, frame_arrived, 0)); CHECK(CNET_set_handler(EV_DEBUG1, send_reliable, 0)); CHECK(CNET_set_debug_string( EV_DEBUG1, "Reliable")); CHECK(CNET_set_handler(EV_DEBUG2, send_unreliable, 0)); CHECK(CNET_set_debug_string( EV_DEBUG2, "Unreliable")); }
void reboot_NL_table(void) { CHECK(CNET_set_handler(EV_DEBUG0, show_NL_table, 0)); CHECK(CNET_set_debug_string(EV_DEBUG0, "NL info")); NL_table = calloc(NL_table_increment, sizeof(NLTABLE)); NL_table_capacity = NL_table_increment; NL_table_size = 0; }
void init_NL_table(int basic) { if(nodeinfo.nlinks > 31) { fprintf(stderr,"Too many links for this routing table to support\n"); exit(1); } table = (NL_TABLE *)malloc(sizeof(NL_TABLE)); table_size = 0; if(basic) { CHECK(CNET_set_handler(EV_DEBUG1, show_basic, 0)); } else { CHECK(CNET_set_handler(EV_DEBUG1, show_detailed, 0)); } CHECK(CNET_set_debug_string( EV_DEBUG1, "NL info")); }
void reboot_NL_table(void) { CHECK(CNET_set_handler(EV_DEBUG0, show_NL_table, 0)); CHECK(CNET_set_debug_string(EV_DEBUG0, "NL info")); int i,j; for (i = 0; i < 2; i++) { for (j = 0; j < (NNODES+1); j++) NL_routingtable[i][j] = MAX_INT; } for (i = 0; i < (NNODES+1); i++) { for (j = 0; j < (NNODES+1); j++) { NL_fullroutingtable[i][j] = MAX_INT; } } NL_routingtable[0][nodeinfo.nodenumber] = 0; NL_routingtable[1][nodeinfo.nodenumber] = nodeinfo.nodenumber; NL_table = calloc(1, sizeof(NLTABLE)); NL_table_size = 0; }
void reboot_node(CnetEvent ev, CnetTimer timer, CnetData data) { if(nodeinfo.nlinks > 32) { fprintf(stderr,"selective flooding will not work here\n"); exit(1); } CHECK(CNET_set_handler(EV_APPLICATIONREADY, down_to_transport, 0)); CHECK(CNET_set_handler(EV_PHYSICALREADY, up_to_datalink, 0)); CHECK(CNET_set_handler(EV_DEBUG1, show_table, 0)); CHECK(CNET_set_debug_string( EV_DEBUG1, "NL info")); init_DLL(); init_NL(); CNET_enable_application(ALLNODES); /* added a timer to sending stuff from queue */ CNET_set_handler(EV_TIMER1, fire_queue, 0); }