-// ANNA - Anna is Not Nothingness Anymore
-//
-// (c) Copyright 2005-2014 Eduardo Ramos Testillano & Francisco Ruiz Rayo
-//
-// http://redmine.teslayout.com/projects/anna-suite
-//
-// 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 the copyright holder 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 //
#include <sys/ioctl.h>
void comm::ClientSocket::initialize()
-throw() {
+{
a_status = Status::None;
a_transport = NULL;
a_expectedSize = -1;
* porque ya está protegido por éste.
*/
void comm::ClientSocket::setfd(const int fd)
-throw(RuntimeException) {
+noexcept(false) {
Socket::a_fd = fd;
Socket::a_isBound = true;
activate(Status::Connected);
* invocar al metodo comm::Receiver::initialize.
*/
void comm::ClientSocket::setReceiver(comm::Receiver* receiver)
-throw(RuntimeException) {
+noexcept(false) {
if (a_receiver && Socket::a_receiverFactory)
Socket::a_receiverFactory->release(a_receiver);
// Protegido desde el Socket::close
void comm::ClientSocket::do_close()
-throw() {
+{
Socket::do_close();
if (a_transport != NULL) {
}
comm::Server* comm::ClientSocket::getServer()
-throw(RuntimeException) {
+noexcept(false) {
Guard guard(*this, "comm::ClientSocket (getServer)");
const INetAddress& remoteAddress = getRemoteAccessPoint().getINetAddress();
const Device* device = remoteAddress.getDevice(false);
// la conexión.
//_________________________________________________________________________________
void comm::ClientSocket::connect()
-throw(RuntimeException) {
+noexcept(false) {
Guard guard(*this, "comm::ClientSocket (connect)");
anna_socket_assert(isConnected() == true, "Already connected");
}
void comm::ClientSocket::send(comm::Message& message)
-throw(RuntimeException) {
+noexcept(false) {
Guard guard(*this, "comm::ClientSocket (send)");
do_write(getTransport()->code(message));
}
void comm::ClientSocket::send(comm::Message* message)
-throw(RuntimeException) {
+noexcept(false) {
if (message == NULL)
throw RuntimeException("comm::ClientSocket::send | Cannot send a NULL message", ANNA_FILE_LOCATION);
// su buffer, se cerrará.
//_______________________________________________________________________
void comm::ClientSocket::requestClose()
-throw() {
+{
Communicator* communicator = app::functions::component <Communicator> (ANNA_FILE_LOCATION);
a_status |= Status::ClosePending;
// Sólo tiene efecto real en modo ST
// Se invoca desde un entorno protegido, por lo que no hace falta SSCC.
//---------------------------------------------------------------------------------------
comm::Socket::Notify::_v comm::ClientSocket::receive()
-throw(RuntimeException) {
+noexcept(false) {
Notify::_v result;
- int queueLength = 0;
if (a_reader.getMaxSize() == 0) {
string msg(asString());
}
comm::Socket::Notify::_v comm::ClientSocket::wait(const Millisecond &timeout, const bool _receive)
-throw(RuntimeException) {
+noexcept(false) {
Guard guard(*this, "comm::ClientSocket (wait)");
if (Socket::isOpened() == false) {
// la longitud esperada => prepara el a_data para recibir el siguiente bloque.
//---------------------------------------------------------------------------------------
const DataBlock* comm::ClientSocket::fetch()
-throw(RuntimeException) {
+noexcept(false) {
if (a_status & Status::ClosePending)
return NULL;
}
void comm::ClientSocket::calculeExpectedSize(const DataBlock& data)
-throw() {
+{
try {
if ((a_expectedSize = getTransport()->calculeSize(data)) != -1) {
LOGDEBUG(
}
comm::Transport* comm::ClientSocket::reserveTransport()
-throw(RuntimeException) {
+noexcept(false) {
if (a_transport == NULL) {
if (Socket::a_transportFactory == NULL) {
string msg(asString());
}
comm::Transport* comm::ClientSocket::unsafe_reserveTransport()
-throw(RuntimeException) {
+noexcept(false) {
if (a_transport == NULL) {
if (Socket::a_transportFactory == NULL) {
string msg(asString());
}
comm::Receiver* comm::ClientSocket::reserveReceiver()
-throw(RuntimeException) {
+noexcept(false) {
if (a_receiver == NULL && Socket::a_receiverFactory != NULL) {
Guard guard(this, "comm::ClientSocket::reserveReceiver");
// Este metodo se sobre-escribira en commsec::ClientSocket para establecer la conexion mediante las
// funciones SSH
int comm::ClientSocket::do_connect(const sockaddr* s, const int len)
-throw(RuntimeException) {
+noexcept(false) {
int r;
anna_signal_shield(r, ::connect(a_fd, s, len));
return r;
// problemas de interpretación en el extremo remoto.
//----------------------------------------------------------------------------------------------------
void comm::ClientSocket::do_write(const DataBlock& message)
-throw(RuntimeException) {
+noexcept(false) {
int size = message.getSize();
const char* data = message.getData();
int r(0);
// Devuelve 0 para indicar que el Socket se ha cerrado en el extremo remoto
//----------------------------------------------------------------------------
int comm::ClientSocket::do_read(const char* data, const int maxSize)
-throw(RuntimeException) {
+noexcept(false) {
int result;
do {
}
void comm::ClientSocket::forgot()
-throw() {
+{
if (a_transport != NULL)
a_transport->clear();
// (1) Recupera el tamano para verificar que se ha podido establecer la solicitud.
//--------------------------------------------------------------------------------------
void comm::ClientSocket::getSocketOptions()
-throw(RuntimeException) {
+noexcept(false) {
if ((a_rcvBufferSize = comm::Communicator::getReceivingChunkSize()) == -1) {
socklen_t l = sizeof(int);
int fd = Socket::getfd();
}
int comm::ClientSocket::getTotalPendingBytes() const
-throw() {
+{
// El nº de bytes pendientes de procesar será lo que queda en la cola I/O + los bytes que tenemos cargados en memoria
// los bytes pendientes se obtiene al leer el chunk
return a_pendingBytes.bytesToRead + getBufferSize();
string comm::ClientSocket::asString() const
-throw() {
+{
string msg("comm::ClientSocket { ");
- if (this == NULL)
- return msg += " <freed> }";
-
msg += Socket::asString();
msg += functions::asText(" | RcvBufferSize: ", a_rcvBufferSize);
msg += " bytes | Status: ";
}
xml::Node* comm::ClientSocket::asXML(xml::Node* parent) const
-throw(RuntimeException) {
+noexcept(false) {
xml::Node* clientSocket = parent->createChild("comm.ClientSocket");
- if (this == NULL) {
- clientSocket->createAttribute("Freed", "yes");
- return clientSocket;
- }
-
Socket::asXML(clientSocket);
clientSocket->createAttribute("Status", Status::asString(a_status));
clientSocket->createAttribute("RcvBufferSize", a_rcvBufferSize);
}
string comm::ClientSocket::Status::asString(const int status)
-throw() {
+{
string result;
if (status == 0)