/* * OCU-to-MESH comm model. It provides the interface between the OCU and the * mesh. * * Created on: Jan 19, 2011 * Author: ignisphaseone * Last edit: Feb 9, 2011 */ #ifndef COMMMODEL_HPP_ #define COMMMODEL_HPP_ typedef struct node{ unsigned int ip_addr; //ip address of the node unsigned int mac_addr; //physical mac address of the node }node; typedef int latency_t; typedef int signal_strength_t; typedef int weight_t; typedef int throughput_t; 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. */ node* get_node(unsigned int tar_ip_addr); /** Return the current directional throughput from n1 to n2 */ throughput_t get_throughput(node* n1, node* n2); /** Return the current directional latency from n1 to n2 */ latency_t get_latency(node*, node*); /** Return directional signal strength from n1 to n2.*/ signal_strength_t get_signal_strength(node* n1, node* n2); /** Return directional weight from n1 to n2, as computed by the MESH alg'n. */ weight_t get_weight(node* n1, node* n2); /** return a list of all nodes in the net */ std::vector get_all_nodes(); /** return list of node neighbors, given a node */ std::vector get_neighbors(node*); /** Set le target en le manet, le mem chose, n'est pas. */ bool set_target(node*); /** Identify the ocu machine. Call set target first */ bool set_ocu_machine(node*); /** Get the path that has been optimal computed path, per the MANET alg'm */ std::vector get_preferred_path(); /** Initializes the Comm Model; starts the event thread that polls the */ static CommModel* init(void); }; #endif /* COMMMODEL_HPP_ */