X-Git-Url: https://git.llucax.com/z.facultad/75.74/practicos.git/blobdiff_plain/9145fe7228349a5f457d65f33b7888d2b69b6306..5f8ce7344f3e7cba2f4c7a8dbe17471a0387e92d:/practicas/pipi/src/dev.h?ds=inline diff --git a/practicas/pipi/src/dev.h b/practicas/pipi/src/dev.h index f8bd771..f06e8b1 100644 --- a/practicas/pipi/src/dev.h +++ b/practicas/pipi/src/dev.h @@ -3,7 +3,7 @@ #include -#define DEV_DEFAULT_KEY 0x1abcdef1 +#define DEV_MAX_MTU 1500 /// Dispositivo de red (capa de enlace) struct Dev @@ -18,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 = 1500, key_t key = DEV_DEFAULT_KEY) - throw (std::runtime_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: