X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=include%2Fanna%2Fcomm%2FSocket.hpp;h=b00ff2a9abe6cd97405fbb91611de4e5e0799e2a;hb=5a6cba5fde2b2f538a7515f8293cc0a8d9589dfa;hp=ffb6e56929edbd02e20de2f128d3aa8f672b25ef;hpb=3e258840b15577cb8bda3cdedd0b9b88e16404b3;p=anna.git diff --git a/include/anna/comm/Socket.hpp b/include/anna/comm/Socket.hpp index ffb6e56..b00ff2a 100644 --- a/include/anna/comm/Socket.hpp +++ b/include/anna/comm/Socket.hpp @@ -1,37 +1,9 @@ -// ANNA - Anna is Not Nothingness Anymore -// -// (c) Copyright 2005-2014 Eduardo Ramos Testillano & Francisco Ruiz Rayo -// -// https://bitbucket.org/testillano/anna -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Authors: eduardo.ramos.testillano@gmail.com -// cisco.tierra@gmail.com +// ANNA - Anna is Not Nothingness Anymore // +// // +// (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo // +// // +// See project site at http://redmine.teslayout.com/projects/anna-suite // +// See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE // #ifndef anna_comm_Socket_hpp @@ -98,25 +70,25 @@ public: Devuelve el descriptor de fichero asociado a este socket. @return El descriptor de fichero asociado a este socke. Si el socket no ha sido creado devolver�-1. */ - int getfd() const throw() { return a_fd; } + int getfd() const { return a_fd; } /** Devuelve el tipo de socket. \return El tipo de socket. */ - Type::_v getType() const throw() { return a_type; } + Type::_v getType() const { return a_type; } /** Devuelve el dominio de este socket. \return El dominio de este socket. */ - Domain::_v getDomain() const throw() { return a_domain; } + Domain::_v getDomain() const { return a_domain; } /** Devuelve la categoria asociada a este socket. \return La categoria asociada a este socket. */ - int getCategory() const throw() { return a_category; } + int getCategory() const { return a_category; } /** Informa sobre si el socket es capaz de procesar un determinado protocolo de transporte. @@ -126,20 +98,20 @@ public: \return \em true si soporta el nombre de protocolo recibido como parametro o \em false en otro caso. */ - bool support(const char* transportClassName) const throw(); + bool support(const char* transportClassName) const ; /** Devuelve el estado de la conexion de este socket. @return \em true si el servidor de socket ha sido conectado o \em false en otro caso. */ - bool isBound() const throw() { return a_isBound; } + bool isBound() const { return a_isBound; } /** Devuelve el estado del socket. @return \em true si el socket este abierto o \em false en otro caso. */ - bool isOpened() const throw() { return a_fd != -1; } + bool isOpened() const { return a_fd != -1; } /** * Devuelve \em false si el socket usa un protocolo de comunicaciones seguro o \em false @@ -147,32 +119,32 @@ public: * \return \em false si el socket usa un protocolo de comunicaciones seguro o \em false * en otro caso. */ - virtual bool isSecure() const throw() { return false; } + virtual bool isSecure() const { return false; } /** Devuelve la direccion local del socket. \return La direccion local del socket. */ - const AccessPoint& getLocalAccessPoint() const throw() { return a_localAccessPoint; } + const AccessPoint& getLocalAccessPoint() const { return a_localAccessPoint; } /** Devuelve la factoria de la capa de transporte usada en este socket. \return la factoria de la capa de transporte usada en este socket. */ - TransportFactory* getTransportFactory() const throw() { return a_transportFactory; } + TransportFactory* getTransportFactory() const { return a_transportFactory; } /** Devuelve la factoria de receptores usada en este socket. \return la factoria de receptores usada en este socket. */ - ReceiverFactory* getReceiverFactory() throw() { return a_receiverFactory; } + ReceiverFactory* getReceiverFactory() { return a_receiverFactory; } /** Activa o desactiva el modo de bloqueo. \param blockingMode \em true si queremos activar el bloqueo o \em false en otro caso. @return El modo de bloqueo establecido antes de invocar este masodo. */ - bool setBlockingMode(const bool blockingMode) throw(RuntimeException); + bool setBlockingMode(const bool blockingMode) noexcept(false); /** Activa o desactiva el modo de reuso de la direccion. @@ -181,19 +153,19 @@ public: halla dejado de funcionar. \return El modo de reuso establecido antes de invocar a este metodo. */ - bool setReuseMode(const bool reuseMode) throw(RuntimeException); + bool setReuseMode(const bool reuseMode) noexcept(false); /** Establece la capa de transporte usada en este socket. \warning Exclusivamente uso interno. */ - void setTransportFactory(TransportFactory* transportFactory) throw() { a_transportFactory = transportFactory; } + void setTransportFactory(TransportFactory* transportFactory) { a_transportFactory = transportFactory; } /** Establece la factoria de receptores usada por este socket. \param receiverFactory Factoria de receptores desde la que obtener el receptor asociado a este Socket. */ - void setReceiverFactory(ReceiverFactory& receiverFactory) throw() { a_receiverFactory = &receiverFactory; } + void setReceiverFactory(ReceiverFactory& receiverFactory) { a_receiverFactory = &receiverFactory; } /** Establece la categoria de este socket. @@ -202,30 +174,30 @@ public: a partir de un anna::comm::ServerSocket comparten su misma categoria. \param category Categoria asociada a este socket. */ - void setCategory(const int category) throw() { a_category = category; } + void setCategory(const int category) { a_category = category; } /** Cierra este socket. Si el socket no ha sido creado no tendra ningn efecto. */ - void close() throw(); + void close() ; /** Intenta la asociar este socket con los parametros indicados en el constructor. */ - virtual void bind() throw(RuntimeException); + virtual void bind() noexcept(false); /** Devuelve una cadena con la informacion referente a este socket. @return Una cadena con la informacion referente a este socket. */ - virtual std::string asString() const throw(); + virtual std::string asString() const ; /** Devuelve un nodo XML con la informacion referente a este objeto. \param parent Nodo XML a partir del cual introducir la informacion. \return Un nodo XML con la informacion referente a este objeto. */ - virtual xml::Node* asXML(xml::Node* parent) const throw(RuntimeException); + virtual xml::Node* asXML(xml::Node* parent) const noexcept(false); protected: const Domain::_v a_domain; @@ -272,25 +244,25 @@ protected: /** Abre el socket. */ - void open() throw(RuntimeException); + void open() noexcept(false); /** Cierra este socket. Si el socket no ha sido creado no tendra ningn efecto. */ - virtual void do_close() throw() { ::close(a_fd); } + virtual void do_close() { ::close(a_fd); } /** Asocia este Socket a la direccion recibida como parametro. \warning Exclusivamente uso interno. */ - virtual int do_bind(const struct sockaddr*, const int) throw(RuntimeException); + virtual int do_bind(const struct sockaddr*, const int) noexcept(false); /** Devuelve la cadena correspondiente a la notificacion recibida como parametro. \param v Codigo de notificacion. \return La cadena correspondiente a la notificacion recibida como parametro. */ - static const char* asText(const Notify::_v v) throw(); + static const char* asText(const Notify::_v v) ; private: bool a_reuseMode; @@ -306,7 +278,6 @@ private: #define anna_comm_socket_check(a,b) \ if ((a) < 0) { \ - const int xerrno = errno; \ std::string msg (asString ()); \ msg += " | "; \ msg += b; \