00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00026
00027 #include "config.hh"
00028
00029 #ifdef QOLYESTER_ENABLE_VIRTUAL
00030
00031 # include "sys/virtualinterfaceinfo.hh"
00032 # include "pkt/packet.hh"
00033
00034 # ifndef QOLYESTER_DAEMON_NET_VIRTUALINTERFACE_HH
00035 # define QOLYESTER_DAEMON_NET_VIRTUALINTERFACE_HH 1
00036
00037 # include <set>
00038 # include "utl/stampable.hh"
00039 # include "sch/scheduler.hh"
00040 # include "sys/unixsocket.hh"
00041 # include "net/ipaddress.hh"
00042
00043 namespace olsr {
00044
00045 namespace net {
00046
00053
00054 class VirtualInterface : public utl::MultiStampable<1, address_t> {
00055 typedef VirtualInterface This;
00056 typedef utl::MultiStampable<1, address_t> Super;
00057 typedef std::set<sch::IOEvent*> events_t;
00061 explicit VirtualInterface();
00062 public:
00063
00068 VirtualInterface(const sys::VirtualInterfaceInfo& info);
00069
00070
00071
00072
00073
00078 VirtualInterface(const This& other);
00079
00083 ~VirtualInterface();
00084
00089 const address_t& addr() const { return addr_; }
00090
00095 unsigned mtu() const;
00096
00100 unsigned prefix() const { return prefix_; }
00101
00102 sch::IOEvent::p_t recv_p() const;
00103
00104 sch::IOEvent::p_t send_p() const;
00105
00110 void insert_event(sch::IOEvent* e);
00115 void erase_event(sch::IOEvent* e);
00116
00117 void destroy_all_events();
00118
00124 const sys::VirtualInterfaceInfo& info() const { return info_; }
00125
00130 pkt::Packet receive() const;
00135 void send(const pkt::Packet& p) const;
00136
00142 bool operator<(const This& rhs) const;
00143
00149 static This& make_key(const address_t& a);
00150
00151 void configure() {}
00152 void unconfigure() {}
00153 private:
00154 const sys::VirtualInterfaceInfo info_;
00155 const address_t addr_;
00156 unsigned prefix_;
00157 events_t events_;
00158
00159 static This dummy_for_find_;
00160 };
00161
00162 }
00163
00164 }
00165
00166 # ifndef QOLYESTER_DONTINCLUDE_HXX
00167 # include "virtualinterface.hxx"
00168 # endif
00169
00170 # endif // ! QOLYESTER_DAEMON_NET_VIRTUALINTERFACE_HH
00171
00172 #endif // QOLYESTER_ENABLE_VIRTUAL