#ifndef BATMOBILE_OCU_H #define BATMOBILE_OCU_H /** Batmobile interface to the OCU */ #include "../../../mesh-model/include/commmodel.hpp" #include #include #include class MyOCU : public 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(ip4_t tar_ip_addr) { return 0; } /** Return the current directional throughput from n1 to n2 */ virtual throughput_t get_throughput(node* n1, node* n2) { return (rand()%101); } /** Return the current directional latency from n1 to n2 */ virtual latency_t get_latency(node*, node*) { return (rand()%101); } /** Return directional signal strength from n1 to n2.*/ virtual signal_strength_t get_signal_strength(node* n1, node* n2) { return (rand()%101); } /** Return directional weight from n1 to n2, as computed by the MESH alg'n. */ virtual weight_t get_weight(node* n1, node* n2) { return (rand()%11); } /** return a list of all nodes in the net */ virtual std::vector get_all_nodes() { int numNodes = 5; std::vector allNodes (numNodes); //node** allNodes = (node**)malloc(sizeof(node*) * numNodes); for(int i = 0; i < numNodes; i++) { node* newNode = (node*)malloc(sizeof(node)); newNode->ip_addr = i*10; //newNode->mac_addr = (mac_t*)malloc(sizeof(mac_t)); for(int j = 0; j < 6; j++) { newNode->mac_addr.addr[j] = j; } newNode->mac_addr.addr[0] = i; allNodes[i] = newNode; } //allNodes[numNodes] = NULL; return allNodes; } /** return list of node neighbors, given a node */ virtual std::vector get_neighbors(node*) { std::vector neighbors (5); return neighbors; } /** Set le target en le manet, le mem chose, n'est pas. */ virtual bool set_target(node*) { return 0; } /** Identify the ocu machine. Call set target first */ virtual bool set_ocu_machine(node*) { return 0; } /** Get the path that has been optimal computed path, per the MANET alg'm */ virtual std::vector get_preferred_path() { std::vector path (5); return path; } }; #endif