X-Git-Url: https://git.llucax.com/z.facultad/75.74/practicos.git/blobdiff_plain/49f488eb5e757db401a81bc40a30a84d1abcaf88..15d27049e86bc6f836ff6163ea78a8a3e40b3c59:/practicas/pipi/src/dev.h?ds=inline diff --git a/practicas/pipi/src/dev.h b/practicas/pipi/src/dev.h index 129f78f..f06e8b1 100644 --- a/practicas/pipi/src/dev.h +++ b/practicas/pipi/src/dev.h @@ -3,7 +3,6 @@ #include -#define DEV_DEFAULT_KEY 0x1abcdef1 #define DEV_MAX_MTU 1500 /// Dispositivo de red (capa de enlace) @@ -19,20 +18,25 @@ struct Dev /// MTU size_t mtu; - /// Identificador de la cola a usar - int que_id; - /// Constructor - Dev(mac_type mac, size_t mtu = DEV_MAX_MTU, key_t key = DEV_DEFAULT_KEY) - 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: