#ifndef __CONSTANTS_H__ #define __CONSTANTS_H__ #include //_syscall2(int, add_routable_node, unsigned int, arg1, int, arg2); typedef enum {FALSE, TRUE} BOOL; typedef enum {INACTIVE, UNCLUSTERED, ORPHAN, PARENT, CHILD} STATE; typedef enum {SET, UNSET} FLAGS; // added a new event, CHG_CLUSTER, to reflect any change to the cluster // by addition of new orphans or new unclustered nodes typedef enum {NODE_ACTIVATION, RCV_JOIN_REQUEST, RCV_JOIN_RESPONSE, \ RCV_ADOPT_REQUEST, RCV_ADOPT_RESPONSE, JOIN_TIMER_EXPIRATION, \ ADOPT_TIMER_EXPIRATION, HELLO_TIMER_EXPIRATION, CLUSTER_DISCONNECTION, \ CLUSTER_PARTITION, CLUSTER_EXPANSION, RCV_JOIN_CLUSTER, \ RCV_HELLO_MSG, RCV_MAX_CLUSTER, RCV_GATEWAY, \ RCV_NOT_GATEWAY, NO_EVENT} EVENT; typedef enum {JOIN_REQUEST, JOIN_RESPONSE, ADOPT_REQUEST, ADOPT_RESPONSE, JOIN_CLUSTER/*the final confirmation between child and parent*/, HELLO_MSG, GATEWAY, MAX_CLUSTER, NOT_GATEWAY} MSG_TYPE; typedef enum {JOIN_TIMER, ADOPT_TIMER, HELLO_TIMER} TIMER;//for the which portion of setTimer typedef enum {RREQ, RREP} ROUTING_PKT_TYPE; typedef enum {PKT_DDCA, PKT_ROUTING, PKT_QRY} DDCA_PROTO; typedef enum {NO_GATEWAY, IS_GATEWAY} NODE_STATUS; typedef enum {DELETE_GW, ADD_GW, CHG_STATE, DELETE_RT, ADD_RT, RET_STATE} PROC_ENTRIES; const int CLOCK_PRECISON = 10; const int IPPROTO_DDCA = 65;//our ddca protocol number const char BCAST_ADDR [] = "255.255.255.255"; const int IP_HEADER_LENGTH = 20; //fixed length of the IP packet const int DDCA_LEN = 36; // length of DDCA packet excluding 20 bytes of ip header const int MAX_CLUSTER_SIZE = 2;//maximum nodes in a cluster const int RTENTRY_ALIVE_LIMIT = 2; // number of hello expirations for a // routing entry to be alive const int REPLY_TIMEOUT = 100; const int MIN_GRANULARITY = 1; #endif /*__CONSTANTS_H__*/