00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00028
00029 #include "config.hh"
00030
00031 #ifndef QOLYESTER_ENABLE_VIRTUAL
00032
00033
00034 # include "sys/realinterfaceinfo.hh"
00035 # include "pkt/packet.hh"
00036
00037 # ifndef QOLYESTER_DAEMON_NET_REALINTERFACE_HH
00038 # define QOLYESTER_DAEMON_NET_REALINTERFACE_HH 1
00039
00040 # include <set>
00041
00042 # include "net/ipaddress.hh"
00043 # include "sch/scheduler.hh"
00044 # include "sys/socket.hh"
00045 # include "utl/stampable.hh"
00046
00047 namespace olsr {
00048
00049 namespace sch {
00050
00051 class PacketSender;
00052
00053 }
00054
00055 namespace net {
00056
00061 class RealInterface : public utl::MultiStampable<1, address_t> {
00062 typedef RealInterface This;
00063 typedef utl::MultiStampable<1, address_t> Super;
00064 typedef std::set<sch::IOEvent*> events_t;
00071 explicit RealInterface();
00072 public:
00073
00078 inline RealInterface(const sys::RealInterfaceInfo& info);
00079
00080 inline RealInterface(const sys::RealInterfaceInfo& info,
00081 const address_t& addr);
00082
00086 inline RealInterface(const This& other);
00087
00091 inline ~RealInterface();
00092
00097 const address_t& addr() const { return addr_; }
00098
00103 inline unsigned mtu() const;
00104
00105 unsigned prefix() const { return prefix_; }
00106
00107 inline sch::IOEvent::p_t recv_p() const;
00108
00109 inline sch::IOEvent::p_t send_p() const;
00110
00111 inline void insert_event(sch::IOEvent* e);
00112 inline void erase_event(sch::IOEvent* e);
00113
00114 inline void destroy_all_events();
00115
00120 const sys::RealInterfaceInfo& info() const { return info_; }
00121
00126 inline pkt::Packet receive() const;
00127
00132 inline void send(const pkt::Packet& p) const;
00133
00134 inline void shipout(const pkt::Packet& p);
00135
00136 unsigned queue_size() const { return queue_size_; }
00137
00142 inline bool operator<(const This& rhs) const;
00143
00149 static inline This& make_key(const address_t& a);
00150
00151 inline void configure();
00152 inline void unconfigure();
00153 private:
00154
00155 const sys::RealInterfaceInfo info_;
00156 const address_t addr_;
00157 unsigned prefix_;
00158 # ifdef QOLYESTER_TWO_SOCKETS
00159 sys::Socket insock_;
00160 sys::Socket outsock_;
00161 # else // !QOLYESTER_TWO_SOCKETS
00162 sys::Socket sock_;
00163 # endif
00164
00165 events_t events_;
00166 sch::PacketSender* sender_;
00167 unsigned* usecount_;
00168 sys::RealInterfaceInfo::config_t* config_;
00169 unsigned queue_size_;
00170
00171 static This dummy_for_find_;
00172 };
00173
00174 }
00175
00176 }
00177
00178 # include "realinterface.hxx"
00179
00180 # endif // ! QOLYESTER_DAEMON_NET_REALINTERFACE_HH
00181
00182 #endif // ! QOLYESTER_ENABLE_VIRTUAL