| 1 |
#ifndef _OPNET_PROTO_ROUTEMGR_ |
| 2 |
#define _OPNET_PROTO_ROUTEMGR_ |
| 3 |
|
| 4 |
#include "protoRouteMgr.h" |
| 5 |
#include "protoAddress.h" |
| 6 |
#include "opnet.h" |
| 7 |
#include <ip_addr_v4.h> |
| 8 |
#include <ip_cmn_rte_table.h> |
| 9 |
#include "ip_rte_support.h" |
| 10 |
#include "ip_rte_v4.h" |
| 11 |
|
| 12 |
/* LP - from Jim Hauser's files */ |
| 13 |
|
| 14 |
#define NETMASK_HOST 0xffffffff |
| 15 |
#define NETMASK_DEFAULT 0x0 |
| 16 |
|
| 17 |
/* end LP */ |
| 18 |
|
| 19 |
class OpnetProtoRouteMgr : public ProtoRouteMgr |
| 20 |
{ |
| 21 |
public: |
| 22 |
OpnetProtoRouteMgr(); |
| 23 |
~OpnetProtoRouteMgr(); |
| 24 |
|
| 25 |
/* LP 4-22-04 - replaced for the new ProtoRoutMgr.h |
| 26 |
bool Open(); |
| 27 |
*/ |
| 28 |
bool Open(const void* userData = NULL); |
| 29 |
|
| 30 |
// end LP |
| 31 |
|
| 32 |
bool Open(IpT_Cmn_Rte_Table *cmn_rte_table, int nodeId, IpT_Rte_Proc_Id olsr_protocol_id, IpT_Interface_Info* ip_intf_pnt); |
| 33 |
|
| 34 |
int getNodeId() {return my_node_id; } |
| 35 |
bool IsOpen() const; |
| 36 |
void Close(); |
| 37 |
bool GetAllRoutes(ProtoAddress::Type addrType, |
| 38 |
ProtoRouteTable& routeTable); |
| 39 |
|
| 40 |
bool GetRoute(const ProtoAddress& dst, |
| 41 |
unsigned int prefixLen, |
| 42 |
ProtoAddress& gw, |
| 43 |
unsigned int& ifIndex, |
| 44 |
int& metric); |
| 45 |
|
| 46 |
bool SetRoute(const ProtoAddress& dst, |
| 47 |
unsigned int prefixLen, |
| 48 |
const ProtoAddress& gw, |
| 49 |
unsigned int ifIndex, |
| 50 |
int metric); |
| 51 |
|
| 52 |
bool DeleteRoute(const ProtoAddress& dst, |
| 53 |
unsigned int prefixLen, |
| 54 |
const ProtoAddress& gw, |
| 55 |
unsigned int ifIndex); |
| 56 |
|
| 57 |
bool SetForwarding(bool state); |
| 58 |
static OpnetProtoRouteMgr* Create(); |
| 59 |
|
| 60 |
bool GetInterfaceAddressList(unsigned int ifIndex, |
| 61 |
ProtoAddress::Type addrType, |
| 62 |
ProtoAddressList& addrList); |
| 63 |
|
| 64 |
// LP 4-19-04 added due to a new ProtoRouteMgr |
| 65 |
unsigned int GetInterfaceIndex(const char* interfaceName); |
| 66 |
bool GetInterfaceName(unsigned int interfaceIndex, |
| 67 |
char* buffer, |
| 68 |
unsigned int buflen); |
| 69 |
// end LP |
| 70 |
|
| 71 |
IpT_Interface_Info * GetIntfInfoPnt() {return my_ip_interface_pnt; } |
| 72 |
int descriptor; |
| 73 |
UINT32 sequence; |
| 74 |
|
| 75 |
private: |
| 76 |
int forwardingOn; |
| 77 |
// ProtoRouteTable localTable; |
| 78 |
IpT_Cmn_Rte_Table * opnet_cmn_route_table; |
| 79 |
int my_node_id; |
| 80 |
IpT_Rte_Proc_Id my_protocol_id; |
| 81 |
IpT_Interface_Info * my_ip_interface_pnt; |
| 82 |
|
| 83 |
|
| 84 |
}; // end class OpnetProtoRouteMgr |
| 85 |
|
| 86 |
#endif // _OPNET_PROTO_ROUTEMGR_ |
| 87 |
|