#include <stdexcept>
-#define DEV_DEFAULT_KEY 0x1abcdef1
#define DEV_MAX_MTU 1500
/// Dispositivo de red (capa de enlace)
/// MTU
size_t mtu;
- /// Identificador de la cola a usar
- int que_id;
-
/// Constructor
- Dev(mac_type mac, key_t key = DEV_DEFAULT_KEY, size_t mtu = DEV_MAX_MTU)
- throw (std::runtime_error, std::logic_error);
+ Dev(mac_type mac, size_t mtu = DEV_MAX_MTU)
+ throw (std::runtime_error, std::logic_error):
+ mac(mac), mtu(mtu)
+ {
+ if (mtu > DEV_MAX_MTU)
+ throw std::logic_error("MTU más grande que DEV_MAX_MTU");
+ }
/// Envía un frame
- void transmit(const std::string& data, const mac_type& mac)
- throw (std::runtime_error, std::logic_error);
+ virtual void transmit(const std::string& data, const mac_type& mac)
+ throw (std::runtime_error, std::logic_error) = 0;
/// Recibe un frame
- std::string receive()
- throw (std::runtime_error);
+ virtual std::string receive()
+ throw (std::runtime_error) = 0;
+
+ /// Destructor virtual por si las moscas
+ virtual ~Dev() {}
// Nada de andar copiando placas...
private: