19 /// Dispositivo de red
22 /// Cola para forwardear paquetes
25 /// Indica si es un router
28 /// Indica si hace forwarding
31 /// Dispositivo de logging
34 /// Buffers de recepción
40 BufferKey(const IPHeader& h):
41 id(h.id), src(h.src), dst(h.dst), proto(h.proto)
43 bool operator< (const BufferKey& b) const
44 { return id < b.id && src < b.src && dst < b.dst && proto < b.proto; }
46 typedef std::map< uint16_t, std::string > offsetmap_type;
47 typedef std::map< BufferKey, offsetmap_type > buffer_type;
50 /// Buffers de paquetes completos
56 BufferPkt(const IPAddr& dst, const std::string& data):
57 dst(dst), data(data) {}
59 typedef std::map< IPAddr, BufferPkt > srcmap_type;
60 typedef std::map< uint8_t, srcmap_type > buffer_complete_type;
61 buffer_complete_type buffer_complete;
64 IPIn(const IPAddr& ip, Dev& dev, Dev& forward_que, bool router = false,
65 bool forward = false, std::ostream& log = std::cout);
67 /// Descarta un paquete
68 void drop(const std::string& msg, const std::string& buf);
69 void drop(const std::string& msg, const IPHeader& iph);
71 /// Recibe un paquete IP
72 std::string recv(uint8_t proto, IPAddr& src, IPAddr& dst,
74 throw (std::runtime_error);
76 // Nada de andar copiando placas...
79 IPIn& operator=(const IPIn&);
85 // vim: set et sw=4 sts=4 :