-// ANNA - Anna is Not 'N' 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_functions_hpp
#define anna_comm_functions_hpp
-#include <netinet/in.h>
-
#include <vector>
#include <anna/app/functions.hpp>
class Service;
/**
- functions - Metodos y variables
+ functions - Methods and variables
*/
struct functions : public anna::app::functions {
/**
- Devuelve el nombre de la maquina sobre la que estamos ejecutando.
- \return El nombre de la maquina sobre la que estamos ejecutando.
- */
- static std::string getHostName() throw(RuntimeException);
-
-
- /**
- * Helper de uso externo que resuelve el nombre de la maquina recibido como parametro y devuelve
- * la primera IP resuelta por el sistema. Tracea los aliases y sus direcciones IP, asi como el
- * nombre oficial de la maquina.
- *
- * \param hostname Nombre logico del servidor que sera usado para resolver. Podria ser una cadena
- * de la forma www.gopher.net
- *
- * \return Primera direccion IP retornadas por el sistema
- *
- * \see man gethostbyname.
- */
- static std::string resolveIP(const char* hostname) throw(RuntimeException); // EDU Nov 2012
-
- /**
- Devuelve la referencia de la instancia de nuestra aplicación para trabajar en la
- capa anna.comm
- @return La referencia de la instancia de nuestra aplicación para trabajar en la
- capa anna.comm
+ Returns the host name over which we are executing our process.
+ @return host name over which we are executing our process.
*/
- static comm::Application& getApp() throw(RuntimeException);
+ static std::string getHostName() noexcept(false);
- /**
- Codifica un entero de 32 bits en buffer que debe tener, al menos, 4 bytes de longitud.
- @param result Buffer donde vamos a codificar el número.
- @param n Nmero a codificar.
- \return El buffer que contiene el número aplanado.
- */
- static const char* codeInteger(char* result, const int n) throw();
/**
- Codifica un entero de 16 bits en buffer que debe tener 2 bytes de longitud.
- @param result Buffer donde vamos a codificar el número.
- @param n Nmero a codificar.
- \return El buffer que contiene el número aplanado.
- */
- static const char* codeShort(char* result, const short int n) throw();
+ Resolves the host name provided with the first IP returned by the system.
+ Aliases and their addresses are traced as well as the official host name.
- /**
- Codifica un entero de 64 bits en buffer que debe tener, al menos, 8 bytes de longitud.
- @param result Buffer donde vamos a codificar el numero.
- @param n numero a codificar.
- \return El buffer que contiene el numero aplanado.
- */
- static const char* codeInteger64(char* result, const Integer64 n) throw();
+ @param hostname Logical name for the server used to resolve (could be www.gopher.net i.e.).
- /**
- * Codifica un número en coma flotante de 32 bits según el estandard IEEE-754, en un buffer
- * que debe tener, al menos, 4 bytes de longitud.
- * @param result Buffer donde vamos a codificar el número.
- * @param n Nmero a codificar.
- * \return El buffer que contiene el número aplanado.
- */
- static const char* codeFloat(char* result, const float n) throw();
+ @return First IP address returned by the system.
- /**
- * Codifica un número en coma flotante de 64 bits según el estandard IEEE-754, en un buffer
- * que debe tener, al menos, 8 bytes de longitud.
- * @param result Buffer donde vamos a codificar el número.
- * @param n Nmero a codificar.
- * \return El buffer que contiene el número aplanado.
+ \see man gethostbyname.
*/
- static const char* codeDouble(char* result, const double n) throw();
-
- /**
- Decodifica un numero entero de 32 bits contenido en un buffer de 4 bytes.
- @param data Buffer que contiene el numero aplanado.
- @return El valor del numero contenido en el buffer.
- */
- static int decodeInteger(const char* data) throw();
-
- /**
- Decodifica un numero entero de 16 bits contenido en un buffer de 2 bytes.
- @param data Buffer que contiene el numero aplanado.
- @return El valor del numero contenido en el buffer.
- */
- static short int decodeShort(const char* data) throw();
-
- /**
- Decodifica un numero entero de 64 bits contenido en un buffer de 8 bytes.
- @param data Buffer que contiene el numero aplanado.
- @return El valor del numero contenido en el buffer.
- */
- static Integer64 decodeInteger64(const char* data) throw();
-
- /**
- Decodifica un numero en coma flotante de 32 bits contenido en un buffer de 4 bytes, y codificado
- según el estandard IEEE-754.
- @param data Buffer que contiene el numero aplanado.
- @return El valor del numero contenido en el buffer.
- */
- static float decodeFloat(const char* data) throw();
+ static std::string resolveIP(const char* hostname) noexcept(false);
/**
- Decodifica un numero en coma flotante de 64 bits contenido en un buffer de 8 bytes, y codificado
- según el estandard IEEE-754.
- @param data Buffer que contiene el numero aplanado.
- @return El valor del numero contenido en el buffer.
+ Returns our application instance on anna.comm layer.
+ @return Reference to our application instance on anna.comm layer.
*/
- static double decodeDouble(const char* data) throw();
+ static comm::Application& getApp() noexcept(false);
};
}