X-Git-Url: https://git.llucax.com/z.facultad/75.74/practicos.git/blobdiff_plain/918a7b42017533f6f18edc8735d6d82a5494f055..f48d95822c7810a45daf26854de7262ccc20a940:/practicas/pipi/src/dev.h?ds=sidebyside diff --git a/practicas/pipi/src/dev.h b/practicas/pipi/src/dev.h index bae7e17..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, 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: