/* * OCU-to-MESH comm model. It provides the interface between the OCU and the * mesh. * * Created on: Jan 19, 2011 * Author: CSC 405 Class * Last edit: Feb 18, 2011 */ #ifndef NODE_HPP_ #define NODE_HPP_ #include #include typedef uint32_t ip4_t; typedef int latency_t; typedef int signal_strength_t; typedef int weight_t; typedef int throughput_t; typedef int inactive_t; struct mac_t { uint8_t addr[6]; }; struct node { ip4_t ip_addr; //ip address of the node mac_t mac_addr; //physical mac address of the node }; class CommModel { public: /** This function attempts to communicate with a target node. If successful, it * returns specific information about the node. Otherwise, it returns a null * pointer. */ virtual node* get_node(mac_t tar_mac_addr) = 0; /** Return the current directional throughput from n1 to n2 */ virtual throughput_t get_throughput(node* n1, node* n2) = 0; /** Return the current directional latency from n1 to n2 */ virtual latency_t get_latency(node*, node*) = 0; /** Return directional signal strength from n1 to n2.*/ virtual signal_strength_t get_signal_strength(node* n1, node* n2) = 0; /** Return directional weight from n1 to n2, as computed by the MESH alg'n. */ virtual weight_t get_weight(node* n1, node* n2) = 0; /** get inactive time between two nodes */ virtual inactive_t get_inactive_time(node *n1, node *n2) { return -1;} /** return a list of all nodes in the net */ virtual std::vector get_all_nodes() = 0; /** return list of node neighbors, given a node */ virtual std::vector get_neighbors(node*) = 0; /** Set le target en le manet, le mem chose, n'est pas. */ virtual bool set_target(node*) = 0; /** Identify the ocu machine. Call set target first */ virtual bool set_ocu_machine(node*) = 0; /** Get the path that has been optimal computed path, per the MANET alg'm. * Nodes are returned in order from source to target */ virtual std::vector get_preferred_path() = 0; /** Initializes the Comm Model; starts the event thread that polls the */ static CommModel* init(void); }; #endif /* NODE_HPP_ */