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 sch {
00046
00047 class PacketSender;
00048
00049 }
00050
00051 namespace net {
00052
00059
00060 class VirtualInterface : public utl::MultiStampable<1, address_t> {
00061 typedef VirtualInterface This;
00062 typedef utl::MultiStampable<1, address_t> Super;
00063 typedef std::set<sch::IOEvent*> events_t;
00067 explicit inline VirtualInterface();
00068 public:
00069
00074 inline VirtualInterface(const sys::VirtualInterfaceInfo& info);
00075
00076
00077
00078
00079
00084 inline VirtualInterface(const This& other);
00085
00089 inline ~VirtualInterface();
00090
00095 const address_t& addr() const { return addr_; }
00096
00101 inline unsigned mtu() const;
00102
00106 unsigned prefix() const { return prefix_; }
00107
00108 inline sch::IOEvent::p_t recv_p() const;
00109
00110 inline sch::IOEvent::p_t send_p() const;
00111
00116 inline void insert_event(sch::IOEvent* e);
00121 inline void erase_event(sch::IOEvent* e);
00122
00123 inline void destroy_all_events();
00124
00130 const sys::VirtualInterfaceInfo& info() const { return info_; }
00131
00136 inline pkt::Packet receive() const;
00141 inline void send(const pkt::Packet& p) const;
00142
00143 inline void shipout(const pkt::Packet& p);
00144
00145 unsigned queue_size() const { return queue_size_; }
00146
00152 inline bool operator<(const This& rhs) const;
00153
00159 static inline This& make_key(const address_t& a);
00160
00161 void configure() {}
00162 void unconfigure() {}
00163 private:
00164 const sys::VirtualInterfaceInfo info_;
00165 const address_t addr_;
00166 unsigned prefix_;
00167 events_t events_;
00168 sch::PacketSender* sender_;
00169 unsigned queue_size_;
00170
00171 static This dummy_for_find_;
00172 };
00173
00174 }
00175
00176 }
00177
00178 # include "virtualinterface.hxx"
00179
00180 # endif // ! QOLYESTER_DAEMON_NET_VIRTUALINTERFACE_HH
00181
00182 #endif // QOLYESTER_ENABLE_VIRTUAL