//FILE: network/network.h // //Description: this file defines the data structures and functions for SNP process // //Date: April 29,2008 #ifndef NETWORK_H #define NETWORK_H //this function is used to for the SNP process to connect to the local ON process on port OVERLAY_PORT //connection descriptor is returned if success, otherwise return -1 int connectToOverlay(); //This thread sends out route update packets every RU_INTERVAL time //In this lab this thread only broadcasts empty route update packets to all the neighbors, broadcasting is done by set the dest_nodeID in packet header as BROADCAST_NODEID void* routeupdate_daemon(void* arg); //this thread handles incoming packets from the ON process //It receives packets from the ON process by calling overlay_recvpkt() //In this lab, after receiving a packet, this thread just outputs the packet received information without handling the packet void* pkthandler(void* arg); //this function stops the SNP process //it closes all the connections and frees all the dynamically allocated memory //it is called when the SNP process receives a signal SIGINT void network_stop(); #endif