if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
#execute_process(COMMAND g++ --version >/dev/null 2>/dev/null)
set(CMAKE_CXX_COMPILER "/usr/bin/g++")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-unknown-pragmas -Wno-sign-compare -Woverloaded-virtual -Wwrite-strings -Wno-unused")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wwrite-strings -Wno-unknown-pragmas -Wno-sign-compare -Wno-maybe-uninitialized -Wno-unused -Wno-reorder")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
#execute_process(COMMAND clang++ --version >/dev/null 2>/dev/null)
add_definitions(-DIS_CLANG)
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-unknown-pragmas -Wno-sign-compare -Woverloaded-virtual -Wwrite-strings -Wno-unused -Wno-parentheses-equality")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wwrite-strings -Wno-unknown-pragmas -Wno-sign-compare -Wno-maybe-uninitialized -Wno-unused -Wno-reorder -Wno-parentheses-equality")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
// Load xml messages:
anna::diameter::codec::Message ccri, ccrt;
anna::diameter::codec::Avp *ccri_sessionId, *ccrt_sessionId, *ccri_framedIPAddress, *ccrt_framedIPAddress, *ccri_msisdn, *ccri_imsi;
- anna::diameter::codec::Avp *si1, *si2, *sidata1, *sidata2, *sitype1, *sitype2;
+ anna::diameter::codec::Avp *si1, *si2, *sidata1, *sidata2, *sitype1;
///////// CCR-Initial:
ccri.loadXML(ccr_i);
void eventReceiveMessage (ClientSocket &, const Message&)
throw (RuntimeException);
+protected:
+
+ using Communicator::eventBreakConnection;
+
void eventBreakConnection (const ClientSocket&) throw ();
void eventBreakConnection (Server* server) throw () {
{
CommandLine& cl (CommandLine::instantiate ());
- Network& network = Network::instantiate ();
-
/* Define el Socket para enviar las respuestas */
const comm::Device* device = Network::instantiate ().find (Device::asAddress (cl.getValue ("as")));
int port = cl.getIntegerValue ("ps");
class MyReceiver : public Receiver {
public:
+ virtual ~MyReceiver() {;}
static const char* className () throw () { return "MyReceiver"; }
private:
};
private:
+ using comm::Communicator::eventBreakConnection;
+
test::Response a_response;
test::Request a_request;
comm::INetAddress a_inetAddress;
class MyReceiver : public Receiver {
public:
+ virtual ~MyReceiver() {;}
static const char* className () throw () { return "MyReceiver"; }
private:
MyCommunicator () : Communicator (), a_avgResponseTime (0), a_rxMessageCounter (0), a_responses ("Response") {;}
private:
+ using Communicator::eventBreakConnection;
+
ThreadData <test::Response> a_responses;
int a_avgResponseTime;
int a_rxMessageCounter;
a_result = result;
- write (a_pipe [WriteChannel], &byte, sizeof (byte));
+ ssize_t r = write (a_pipe [WriteChannel], &byte, sizeof (byte));
}
// Modela al thread que recibe la respuesta correspondiente a la petición por la
CommandLine& cl (CommandLine::instantiate ());
- Statement* create;
Statement* select;
dbms::Integer n (true);
}
}
else {
- // Se asociado al parent automáticamente.
- filesystem::File* ff = new filesystem::File (parent, name);
+ //Auto association to the parent:
+ new filesystem::File (parent, name);
}
}
}
throw(anna::RuntimeException) {
LOGMETHOD(anna::TraceMethod tm("Launcher", "run", ANNA_FILE_LOCATION));
CommandLine& cl(anna::CommandLine::instantiate());
- anna::diameter::stack::Engine &stackEngine = anna::diameter::stack::Engine::instantiate();
+ anna::diameter::stack::Engine::instantiate();
// Start time:
a_start_time.setNow();
void terminate() throw();
private:
+ using anna::comm::Communicator::eventBreakConnection;
+
anna::ThreadData <MyHandler> a_contexts;
void eventReceiveMessage(anna::comm::ClientSocket&, const anna::comm::Message&) throw(anna::RuntimeException);
void eventBreakConnection(Server* server) throw();
anna::diameter::comm::Message* request = const_cast<anna::diameter::comm::Message*>(response.getRequest());
const anna::DataBlock* message = response.getMessage();
const anna::diameter::comm::ClientSession *clientSession = static_cast<const anna::diameter::comm::ClientSession *>(response.getSession());
- bool isBindResponse = (code == anna::diameter::comm::ClassCode::Bind);
- bool isApplicationMessage = (code == anna::diameter::comm::ClassCode::ApplicationMessage);
bool contextExpired = (result == anna::diameter::comm::Response::ResultCode::Timeout);
bool isUnavailable = (result == anna::diameter::comm::Response::ResultCode::DiameterUnavailable);
bool isOK = (result == anna::diameter::comm::Response::ResultCode::Success);
public:
MyDiameterEntity() {;}
+ virtual ~MyDiameterEntity() {;}
anna::diameter::codec::MessagesDeque a_reactingAnswers;
anna::diameter::codec::MessagesDeque *getReactingAnswers() throw() { return (anna::diameter::codec::MessagesDeque*)&a_reactingAnswers; }
anna::diameter::comm::Message* request = const_cast<anna::diameter::comm::Message*>(response.getRequest());
const anna::DataBlock* message = response.getMessage();
const anna::diameter::comm::ServerSession *serverSession = static_cast<const anna::diameter::comm::ServerSession *>(response.getSession());
- bool isBindResponse = (code == anna::diameter::comm::ClassCode::Bind);
- bool isApplicationMessage = (code == anna::diameter::comm::ClassCode::ApplicationMessage);
bool contextExpired = (result == anna::diameter::comm::Response::ResultCode::Timeout);
bool isUnavailable = (result == anna::diameter::comm::Response::ResultCode::DiameterUnavailable);
bool isOK = (result == anna::diameter::comm::Response::ResultCode::Success);
void eventDPA(anna::diameter::comm::ServerSession *, const anna::DataBlock&) throw(anna::RuntimeException);
public:
+ virtual ~MyLocalServer() {;}
anna::diameter::codec::MessagesDeque a_reactingAnswers;
anna::diameter::codec::MessagesDeque *getReactingAnswers() throw() { return (anna::diameter::codec::MessagesDeque*)&a_reactingAnswers; }
u_char *getPayload(const u_char* packet, int packetSize, int &payloadSize,
std::string &srcIp, std::string &dstIp, int &fragmentId, bool &dfFlag,
bool &mfFlag, int &fragmentOffset) {
- const struct sniff_ethernet *ethernet; /* The ethernet header */
const struct sniff_ip *ip; /* The IP header */
const struct sniff_tcp *tcp; /* The TCP header */
u_int size_ip;
u_int size_tcp;
- ethernet = (struct sniff_ethernet*)(packet);
ip = (struct sniff_ip*)(packet + SIZE_ETHERNET);
size_ip = IP_HL(ip) * 4; // 4 bytes per 32 bits word
// Command-line parameters:
std::string inputFile = argv[1];
- bool isHex = (inputFile.substr(inputFile.find_last_of(".") + 1) == "hex");
+ //bool isHex = (inputFile.substr(inputFile.find_last_of(".") + 1) == "hex");
std::string outputFile = inputFile; // extension will be added later
std::string optionals;
int indx = 2;
// SNIFFING //////////////////////////////////////////////////////////////////////////////////////////////7
//temporary packet buffers
- struct pcap_pkthdr header; // The header that pcap gives us
- const u_char *packet; // The actual packet
+ //struct pcap_pkthdr header; // The header that pcap gives us
+ //const u_char *packet; // The actual packet
//------------------
//open the pcap file
pcap_t *handle;
void count (const int delay) throw (RuntimeException);
private:
+ using Communicator::eventBreakConnection;
+
int a_avgResponseTime;
int a_rxMessageCounter;
MyHandler a_httpHandler;
static int messageCounter = 0;
static int successCounter = 0;
- int value;
-
CongestionController& congestionController = CongestionController::instantiate ();
messageCounter ++;
}
private:
+ using Communicator::eventBreakConnection;
+
MyHandler a_httpHandler;
http::Request a_httpRequest;
class Reactor : public comm::Receiver {
public:
Reactor () : comm::Receiver ("http4comm::Reactor") {;}
+ virtual ~Reactor() {;}
static const char* className () throw () { return "http4comm::Reactor"; }
CommandLine& commandLine (CommandLine::instantiate ());
xml::DocumentFile xmlDoc;
- const char* str;
xmlDoc.initialize (commandLine.getValue ("xml"));
cout << "Time (apply" << i << "): " << final - init << " us" << endl << endl;
if (xpath.isEmpty () == false) {
if (i == 0) {
- const xml::Node* node;
for (Node::const_child_iterator ii = xpath.node_begin (), maxii = xpath.node_end (); ii != maxii; ii ++)
cout << xmlCompiler.apply (XPath::node (ii)) << endl;
}
cout << "match: no node matching expression" << endl << endl;
xpath.apply (xmlDoc, expression, mode);
- const xml::Node* node;
for (Node::const_child_iterator ii = xpath.node_begin (), maxii = xpath.node_end (); ii != maxii; ii ++)
cout << xmlCompiler.apply (XPath::node (ii), xml::Compiler::Mode::Compact | xml::Compiler::Mode::NoNamespaces) << endl;
}
static pid_t pid(const_pid_iterator& ii) throw() { return *ii; }
private:
- bool a_running;
- std::string a_version;
const std::string a_title;
std::vector <Component*> a_components;
pid_t a_pid;
const char* a_shortName;
+ bool a_running;
+ std::string a_version;
bool a_enableGPL;
pid_container a_pids;
private:
const Socket* a_owner;
- INetAddress a_inetAddress;
std::string* a_path;
+ INetAddress a_inetAddress;
sockaddr_in a_sockaddr_in;
sockaddr_un a_sockaddr_un;
};
std::string a_name;
Resources a_resources;
bool a_isAvailable;
- Millisecond a_timeStamp;
Millisecond a_recoveryTime;
+ Millisecond a_timeStamp;
bool unsafe_recover(const Resource* resource) throw();
/**
Destructor
*/
- ~DirectTransport();
+ virtual ~DirectTransport();
/**
Devuelve el gestor de capas de transporte asociado a esta clase.
/**
Destructor.
*/
- ~LiteTransport();
+ virtual ~LiteTransport();
/**
Returns the class name literal.
const int a_remotePort;
const bool a_autoRecovery;
Services a_services;
- ClientSocket* a_clientSocket;
TransportFactory* a_transportFactory;
+ ClientSocket* a_clientSocket;
Millisecond a_msMaxConnectionDelay;
Millisecond a_msMaxWriteDelay;
ReceiverFactory* a_receiverFactory;
#define anna_comm_socket_check(a,b) \
if ((a) < 0) { \
- const int xerrno = errno; \
std::string msg (asString ()); \
msg += " | "; \
msg += b; \
/**
Destructor.
*/
- ~SureTransport();
+ virtual ~SureTransport();
/**
Class name literal
sincronizarse nunca mas.
*/
class Transport {
+
+ static const int MinOverQuotaSize = 512;
+
+ int a_overQuotaSize;
+ Message* a_inputMessage;
+
+ static Message* nullInputMessage() throw(RuntimeException);
+
public:
/**
Maximum number of bytes kept by each ClientSocket without identifying
void setInputMessage(Message* inputMessage) throw() { a_inputMessage = inputMessage; }
private:
- static const int MinOverQuotaSize = 512;
- int a_overQuotaSize;
- Message* a_inputMessage;
bool a_enableTimeout;
-
- static Message* nullInputMessage() throw(RuntimeException);
};
}
*/
class Poll {
public:
- Poll() : a_maxfd(0), a_ptrTimeout(NULL), a_minfd(INT_MAX) {
+ Poll() : a_ptrTimeout(NULL), a_minfd(INT_MAX), a_maxfd(0) {
FD_ZERO(&a_fdmask);
FD_ZERO(&a_fdset);
}
private:
fd_set a_fdmask;
fd_set a_fdset;
+ timeval* a_ptrTimeout;
int a_minfd;
int a_maxfd;
int a_pollr;
int a_ifd;
timeval a_timeout;
- timeval* a_ptrTimeout;
static int select(const int maxfd, fd_set* fdset, timeval* timeout)
throw(RuntimeException) {
/**
Destructor.
*/
- ~Semaphore();
+ virtual ~Semaphore();
/**
Notifica que desea acceder al recurso. Si se ha alcanzado la cuenta maxima de accesos
Handler a_defaultHandler; // default OAM handler
Handler *a_handler; // Handler reference
-
std::string a_name; // module description
+
bool a_counters_enabled; // Enable/Disable registered counters over this module (default is 'false')
bool a_alarms_enabled; // Enable/Disable registered alarms over this module (default is 'false')
- // dynamic modifications over alarm text
- bool a_alarms_preffix_enabled; // Show own module alarm preffix
- bool a_alarms_suffix_enabled; // Show own module alarm suffix
- std::string alarmComponentsToText(const std::vector<std::string> & components, const std::string & psL, const std::string & psS, const std::string & psR) const throw();
-
// GENERIC COUNTERS
anna::oam::CounterScope* a_active_counter_scope; // Current scope for counters generation
typedef std::map <int, anna::oam::CounterScope*> scope_container;
// GENERIC ALARMS
typedef std::map < int /*type*/, alarm_data_t > alarm_container;
alarm_container a_alarms;
-
void alarmEvent(bool activation, const int & type, va_list argList) const throw();
+ // dynamic modifications over alarm text
+ bool a_alarms_preffix_enabled; // Show own module alarm preffix
+ bool a_alarms_suffix_enabled; // Show own module alarm suffix
+ std::string alarmComponentsToText(const std::vector<std::string> & components, const std::string & psL, const std::string & psS, const std::string & psR) const throw();
+
// Counters
typedef scope_container::iterator scope_iterator;
typedef scope_container::const_iterator const_scope_iterator;
/** Constructor
@param name Logical name for the class (better use fullNaming format including namespace resolution)
*/
- Module(const std::string &name) : a_name(name),
+ Module(const std::string &name) :
a_handler(&a_defaultHandler),
+ a_name(name),
a_counters_enabled(false),
- a_counterRecorder(NULL),
- a_counterRecording(false),
a_alarms_enabled(false),
a_alarms_preffix_enabled(true),
- a_alarms_suffix_enabled(true) {;}
+ a_alarms_suffix_enabled(true),
+ a_counterRecorder(NULL),
+ a_counterRecording(false) {;}
/**
* Destructor
protected:
std::string a_name1, a_name2;
- const char* a_comment;
- char* a_value;
Argument::Type a_type;
+ const char* a_comment;
bool a_needValue;
bool a_isOn;
+ char* a_value;
};
const char **a_argv;
// private constructor
ComponentManager() {};
+ // private destructor
+ virtual ~ComponentManager() {};
+
void attach(Component*) throw(RuntimeException);
void detach(Component*) throw(RuntimeException);
private:
std::string a_name;
+ bool a_isNull;
+ const Type::_v a_type;
+ const bool a_isOwner;
+
union {
std::string* a_string;
int* a_integer;
float theFloat;
double theDouble;
} a_aux;
- const Type::_v a_type;
- const bool a_isOwner;
- bool a_isNull;
Variable(const Variable&);
Variable& operator = (const Variable&);
class ClientSessionReceiver : public anna::comm::Receiver {
public:
+ virtual ~ClientSessionReceiver() {;}
+
static const char* className() throw() { return "diameter.comm.ClientSessionReceiver"; }
void setReference(ClientSession *s) throw() { a_session = s; }
*/
Server(int maxClientSessions = 1) : a_maxClientSessions(maxClientSessions) { initialize(); }
+ /** Destructor */
+ virtual ~Server() {;}
+
/**
* Add a server to the entity and create all the client-sessions configured at #setSocketsPerDiameterServer within that server.
class ServerSessionReceiver : public anna::comm::Receiver {
public:
+ virtual ~ServerSessionReceiver() {;}
+
static const char* className() throw() { return "diameter.comm.ServerSessionReceiver"; }
void setReference(ServerSession *s) throw() { a_session = s; }
TimerManager();
TimerManager(const TimerManager&);
+ virtual ~TimerManager() {;}
Timer* createTimer(Response*) throw(anna::RuntimeException);
Timer* createTimer(Session*, const anna::diameter::comm::Timer::Type::_v type) throw(anna::RuntimeException);
/**
Destructor
*/
- ~Transport();
+ virtual ~Transport();
/**
Devuelve el gestor de capas de transporte asociado a esta clase.
/**
* Destructor
*/
- ~Avp();
+ virtual ~Avp();
// setters
public:
+ virtual ~EngineManager() {;}
+
/**
* First element iterator
*/
/**
* Destructor
*/
- ~Message();
+ virtual ~Message();
+
// Virtual destructors are useful when you can delete an instance of a derived class through a pointer to base class:
// This destructor is not virtual, then a pointer to base class (even pointing to a children one) will invoke this destructor, not the derived one.
// My current solution: virtualizing method 'clear'
*/
Address() : a_abbreviatePresentation(true) {};
+ /**
+ * Destructor
+ */
+ virtual ~Address() {;}
+
/**
* Presentation mode: abbreviate (i.e. two standard rules applied for IPv6) or expanded (i.e. groups of zeroes on IP address)
*
public:
+ virtual ~DiameterIdentity() {;}
+
// gets
std::string getFormatName() const throw() { return "DiameterIdentity"; }
public:
+ virtual ~DiameterURI() {;}
+
// gets
std::string getFormatName() const throw() { return "DiameterURI"; }
public:
+ virtual ~Enumerated() {;}
+
// gets
std::string getFormatName() const throw() { return "Enumerated"; }
public:
+ virtual ~Float32() {;}
// Class-specific ////////////////////////////////////////////////////////////////////////////////////
//
public:
+ virtual ~Float64() {;}
// Class-specific ////////////////////////////////////////////////////////////////////////////////////
//
public:
+ virtual ~IPFilterRule() {;}
+
// gets
std::string getFormatName() const throw() { return "IPFilterRule"; }
public:
+ virtual ~Integer32() {;}
// Class-specific ////////////////////////////////////////////////////////////////////////////////////
//
public:
+ virtual ~Integer64() {;}
// Class-specific ////////////////////////////////////////////////////////////////////////////////////
//
public:
+ virtual ~OctetString() {;}
// Class-specific ////////////////////////////////////////////////////////////////////////////////////
//
public:
+ virtual ~QoSFilterRule() {;}
+
// gets
std::string getFormatName() const throw() { return "QoSFilterRule"; }
public:
+ virtual ~Time() {;}
// Class-specific ////////////////////////////////////////////////////////////////////////////////////
//
public:
+ virtual ~UTF8String() {;}
+
// gets
std::string getFormatName() const throw() { return "UTF8String"; }
class Unknown : public OctetString {
public:
+
+ virtual ~Unknown() {;}
+
std::string getFormatName() const throw() { return "Unknown"; }
};
public:
+ virtual ~Unsigned32() {;}
// Class-specific ////////////////////////////////////////////////////////////////////////////////////
//
public:
+ virtual ~Unsigned64() {;}
// Class-specific ////////////////////////////////////////////////////////////////////////////////////
//
";
-
-
// Used for alarms, tracing and Failed-AVP construction:
typedef struct parent {
*/
Transport();
+ /**
+ * Destructor.
+ */
+ virtual ~Transport() {;}
+
/**
Devuelve la longitud del cuerpo del mensaje asociado.
\return la longitud del cuerpo del mensaje asociado.
TimerManager();
TimerManager(const TimerManager&);
+ virtual ~TimerManager() {;}
+
Timer* createTimer(Response*) throw(RuntimeException);
void cancel(Timer*) throw();
TestManager();
TestManager(const TestManager&);
+ virtual ~TestManager() {;}
TestTimer* createTimer(TestCaseStep*, const anna::Millisecond &, const TestTimer::Type::_v type) throw(anna::RuntimeException);
void cancelTimer(TestTimer*) throw();
/* Para evitar que se pueda crear desde el exterior */
Attribute() : Data(), a_namespace(NULL) {;}
+ virtual ~Attribute() {;}
+
void setName(const char* name) throw() { a_name = name; }
void setNamespace(const Namespace* _namespace) throw() { a_namespace = _namespace; }
private:
/* Para evitar que se pueda crear desde el exterior */
Text() : Data() {;}
+
+ virtual ~Text() {;}
friend class Node;
friend class Allocator<Text>;
comm::Socket::Notify::_v comm::ClientSocket::receive()
throw(RuntimeException) {
Notify::_v result;
- int queueLength = 0;
if (a_reader.getMaxSize() == 0) {
string msg(asString());
//-------------------------------------------------------------------------------
comm::Server* comm::Host::createServer(const ServerAllocator& serverAllocator)
throw(RuntimeException) {
- const int remotePort = serverAllocator.getRemotePort();
Server* result = serverAllocator.apply();
result->setIgnoreIncomingMessages(serverAllocator.getIgnoreIncomingMessages());
return result;
const char* src = hexString.data();
unsigned char hex;
int aux;
- int j = 0;
for(int ii = 1, maxii = hexString.length(); ii < maxii; ii += 2) {
if(isxdigit(aux = src [ii - 1]) == 0)
std::string result = "";
struct hostent *he;
struct in_addr **addr_list;
- struct in_addr ipv4addr;
char hostname[128];
gethostname(hostname, sizeof hostname);
bool filler = isupNumber.OddEven;
bool hasDigits = (isupNumber.Digits.size() > 0);
byte = filler ? 0x80 : 0x00;
- byte = byte |= isupNumber.NatureOfAddress;
+ byte |= isupNumber.NatureOfAddress;
target += byte;
if(calledOrCalling) {
byte = isupNumber.InternalNetworkNumber << 7;
- byte = byte |= (isupNumber.NumberingPlan << 4);
+ byte |= (isupNumber.NumberingPlan << 4);
} else {
byte = isupNumber.NumberIncomplete << 7;
- byte = byte |= (isupNumber.NumberingPlan << 4);
- byte = byte |= (isupNumber.AddressPresentationRestricted << 2);
- byte = byte |= isupNumber.Screening;
+ byte |= (isupNumber.NumberingPlan << 4);
+ byte |= (isupNumber.AddressPresentationRestricted << 2);
+ byte |= isupNumber.Screening;
}
target += byte;
RecordingGuard guard(this);
a_counterRecorder->open();
- Counter* counter = NULL;
CounterScope* cscope = NULL;
try {
void TraceWriter::setup(const char* fileName, const int maxSize, const bool clean)
throw() {
+ ssize_t r;
+
if(a_stream != -1) {
if(clean == false) {
string msg("\nTraces go on at: ");
msg += fileName;
msg += '\n';
- write(a_stream, msg.c_str(), msg.length());
+ r = write(a_stream, msg.c_str(), msg.length());
}
if(a_observed == true) {
if(maxSize >= (256 * 1024))
a_maxSize = maxSize;
- const char* aux = Logger::asString(Logger::getLevel());
char date [anna::functions::DateTimeSizeString + 7];
anna_strcpy(date, "- [");
anna_strcat(anna_strcat(date, getDate()), "]\n");
if(stream != ErrorStream) {
const char* aux = "\n--------------------------------------------------------------\n";
const char* aux2 = "- Current trace level: ";
- write(stream, aux, anna_strlen(aux));
- write(stream, date, anna_strlen(date));
- write(stream, aux2, anna_strlen(aux2));
+ r = write(stream, aux, anna_strlen(aux));
+ r = write(stream, date, anna_strlen(date));
+ r = write(stream, aux2, anna_strlen(aux2));
aux2 = Logger::asString(Logger::getLevel());
- write(stream, aux2, anna_strlen(aux2));
+ r = write(stream, aux2, anna_strlen(aux2));
string filesize = functions::asString("\n- Max file size : %d Kb", a_maxSize >> 10);
aux2 = filesize.c_str();
- write(stream, aux2, anna_strlen(aux2));
- write(stream, aux, anna_strlen(aux));
+ r = write(stream, aux2, anna_strlen(aux2));
+ r = write(stream, aux, anna_strlen(aux));
}
}
TextComposer* TextManager::xfind(const int composer)
throw() {
- TextComposer* result = NULL;
-
for(TextComposerVector::iterator ii = a_composers.begin(), maxii = a_composers.end(); ii != maxii; ii ++)
if((*ii)->getId() == composer) {
return (*ii);
case Data::Type::TimeStamp:
_this->codeDate(data);
break;
+ case Data::Type::Integer:
+ throw RuntimeException("anna::dbms::mysql::InputBind::code not implemented for Data::Type::Integer", ANNA_FILE_LOCATION);
+ break;
+ case Data::Type::Float:
+ throw RuntimeException("anna::dbms::mysql::InputBind::code not implemented for Data::Type::Float", ANNA_FILE_LOCATION);
+ break;
+ case Data::Type::ShortBlock:
+ throw RuntimeException("anna::dbms::mysql::InputBind::code not implemented for Data::Type::ShortBlock", ANNA_FILE_LOCATION);
+ break;
+ case Data::Type::LongBlock:
+ throw RuntimeException("anna::dbms::mysql::InputBind::code not implemented for Data::Type::LongBlock", ANNA_FILE_LOCATION);
+ break;
+
}
}
case Data::Type::TimeStamp:
_this->decodeDate(data);
break;
+ case Data::Type::Integer:
+ throw RuntimeException("anna::dbms::mysql::OutputBind::decode not implemented for Data::Type::Integer", ANNA_FILE_LOCATION);
+ break;
+ case Data::Type::ShortBlock:
+ throw RuntimeException("anna::dbms::mysql::OutputBind::decode not implemented for Data::Type::ShortBlock", ANNA_FILE_LOCATION);
+ break;
case Data::Type::LongBlock:
try {
void OutputBind::decodeLongBlob(dbms::Data& data) const
throw(RuntimeException, dbms::DatabaseException) {
const int bufferSize = a_blob->buffer.getMaxSize();
- const int pos = a_blob->pos;
st_mysql_bind& bind = a_blob->binds [a_blob->pos];
DataBlock& target = static_cast <dbms::LongBlock&>(data).getValue();
const int maxloop = *bind.length / bufferSize;
throw(RuntimeException, dbms::DatabaseException) {
LOGMETHOD(TraceMethod tm("anna::dbms::mysql::Statement", "prepare", ANNA_FILE_LOCATION));
Connection* connection(static_cast <Connection*>(dbmsConnection));
- Database& dbms(static_cast <Database&>(connection->getDatabase()));
+ //Database& dbms(static_cast <Database&>(connection->getDatabase()));
LOGDEBUG(
string msg("anna::dbms::mysql::Statement::prepare | ");
msg += asString();
dbms::ResultCode dbms::mysql::Statement::execute(dbms::Connection* dbmsConnection)
throw(RuntimeException, dbms::DatabaseException) {
- Connection* connection(static_cast <Connection*>(dbmsConnection));
+ //Connection* connection(static_cast <Connection*>(dbmsConnection));
for(input_iterator ii = input_begin(), maxii = input_end(); ii != maxii; ii ++) {
inputBind(ii)->code();
void oracle::Database::do_initialize()
throw(RuntimeException) {
LOGMETHOD(TraceMethod tm("anna::dbms::oracle::Database", "do_initialize", ANNA_FILE_LOCATION));
- int status;
if(a_env != NULL) {
Logger::write(Logger::Warning, asString(), "Already initialized", ANNA_FILE_LOCATION);
return;
switch(data.getType()) {
+ case Data::Type::String:
+ throw RuntimeException("anna::dbms::oracle::InputBind::code not implemented for Data::Type::String", ANNA_FILE_LOCATION);
+ break;
+ case Data::Type::Integer:
+ throw RuntimeException("anna::dbms::oracle::InputBind::code not implemented for Data::Type::Integer", ANNA_FILE_LOCATION);
+ break;
case Data::Type::Float:
codeFloat(data);
break;
case Data::Type::ShortBlock:
codeShortBlock(data);
break;
+ case Data::Type::LongBlock:
+ throw RuntimeException("anna::dbms::oracle::InputBind::code not implemented for Data::Type::LongBlock", ANNA_FILE_LOCATION);
+ break;
case Data::Type::Date:
case Data::Type::TimeStamp:
else
dbms::String::strip(str);
+ break;
+ case Data::Type::Integer:
+ throw RuntimeException("anna::dbms::oracle::OutputBind::decode not implemented for Data::Type::Integer", ANNA_FILE_LOCATION);
break;
case Data::Type::Float:
decodeFloat(data);
return;
}
- char* aux;
-
switch(status) {
case OCI_ERROR:
OCIErrorGet(error, (ub4) 1, (text*) 0, &errorCode, (unsigned char*) errorText, (ub4) sizeof(errorText), OCI_HTYPE_ERROR);
//------------------------------------------------------------------------------------------
bool dbos::Accesor::load(dbms::Connection* connection, const dbos::StorageArea* ssaa)
throw(RuntimeException, dbms::DatabaseException) {
- bool result = false;
if(connection == NULL) {
std::string msg(ssaa->asString());
void ClientSession::setState(State::_v state) throw() {
Session::setState(state);
// Inform father server (availability changes):
- bool changes = a_parent->refreshAvailability();
+ a_parent->refreshAvailability();
}
void ClientSession::bind() throw(anna::RuntimeException) {
setState(State::Bound);
//activateTimer(); // Ya se invoca al inicio de este metodo ::receive
// Inform father server (availability changes):
- bool changes = a_parent->refreshAvailability();
+ a_parent->refreshAvailability();
//startClock();
}
}
void ClientSession::finalize() throw() {
LOGMETHOD(anna::TraceMethod traceMethod(a_className, "finalize", ANNA_FILE_LOCATION));
Session::finalize();
- // Check deprecated entity:
- const Entity *entity = getParent() /* server */ ->getParent() /* entity */;
// Inform father server (availability changes):
- bool changes = a_parent->refreshAvailability();
+ a_parent->refreshAvailability();
// OAM
const Server *server = getParent();
bool multipleConnections = (server->getMaxClientSessions() > 1);
}
// Inform father server (availability changes):
- bool changes = a_parent->refreshAvailability();
+ a_parent->refreshAvailability();
// OAM
const Server *server = getParent();
bool multipleConnections = (server->getMaxClientSessions() > 1);
}
// Inform local server (availability changes):
- bool changes = refreshAvailability();
+ refreshAvailability();
+
// OAM
OamModule &oamModule = OamModule::instantiate();
oamModule.count(OamModule::Counter::CreatedConnectionForServerSession);
// Send:
try {
- const Response* response = a_lastUsedResource->send(message);
+ a_lastUsedResource->send(message);
return true; // no matter if response is NULL (answers, i.e.) or not.
} catch(anna::RuntimeException &ex) {
ex.trace();
bool LocalServer::broadcast(const Message* message) throw(anna::RuntimeException) {
LOGMETHOD(anna::TraceMethod tttm("diameter::comm::LocalServer", "broadcast", ANNA_FILE_LOCATION));
- const Response* response;
bool allok = true;
for(serverSession_iterator it = serverSession_begin(); it != serverSession_end(); it++) {
try {
- response = serverSession(it)->send(message);
+ serverSession(it)->send(message);
} catch(anna::RuntimeException &ex) {
ex.trace();
allok = false;
try {
// Send:
- const Response* response = a_lastUsedResource->send(message);
+ a_lastUsedResource->send(message);
return true; // no matter if response is NULL (answers, i.e.) or not.
} catch(anna::RuntimeException &ex) {
LOGDEBUG(
bool Server::broadcast(const Message* message) throw(anna::RuntimeException) {
LOGMETHOD(anna::TraceMethod tttm("diameter::comm::Server", "broadcast", ANNA_FILE_LOCATION));
assertReady();
- const Response* response;
bool allok = true;
for(std::vector<ClientSession*>::iterator it = begin(); it != end(); it++) {
try {
- response = (*it)->send(message);
+ (*it)->send(message);
} catch(anna::RuntimeException &ex) {
ex.trace();
allok = false;
}
// Inform father local server (availability changes):
- bool changes = getParent()->refreshAvailability();
+ getParent()->refreshAvailability();
// OAM
bool multipleConnections = (getParent()->getMaxConnections() > 1);
std::string socket = anna::functions::socketLiteralAsString(getAddress(), getPort());
// Messages
anna::xml::Node* messages = result->createChild("diameter.comm.Messages");
- const Response* response;
const Message* message;
for(const_response_iterator ii = response_begin(), maxii = response_end(); ii != maxii; ii ++) {
const qosProfile_t & Message::decode3GPPGPRSNegQoSProfile() throw(anna::RuntimeException) {
- const std::string & utf8 = get3GPPGPRSNegQoSProfile()->getValue();
a_qosProfile.reset();
+ //const std::string & utf8 = get3GPPGPRSNegQoSProfile()->getValue();
+ // TODO: decode here ...
return a_qosProfile;
}
result->createAttribute("SingleFailedAVP", a_singleFailedAVP ? "yes" : "no");
result->createAttribute("IgnoreFlags", a_ignoreFlags ? "yes" : "no");
result->createAttribute("FixMode", asText(a_fixMode));
- anna::xml::Node* dictionary = result->createChild("EngineImpl.ActivatedDictionary");
+ result->createChild("EngineImpl.ActivatedDictionary");
if(a_dictionary) a_dictionary->asXML(result);
// First: User will update child class members
// Auxiliary
iana_address_t address;
- int version;
std::string value;
// From message.dtd:
// [ Address ] ('<type (IANA Address Family Number)>|<value>' representation; i.e. '1|192.168.0.1'(IPv4), '8|34616279266'(E164), etc.
int pos = 1; // first avp
const char * subscriptionIdPtr;
const char * subscriptionIdDataPtr;
- int type;
// Decoded avp information:
AvpId _id;
char _flags;
#include <stdarg.h>
-
-// libxml2 Parser doesn't support default attribute value retrieving:
-// <!ATTLIST avp name CDATA #REQUIRED code CDATA #REQUIRED vendor-name CDATA #IMPLIED may-encrypt (yes | no) \"no\" v-bit (must | may | shouldnot | mustnot) \"mustnot\" m-bit (must | may | shouldnot | mustnot) \"may\" p-bit (must | may | shouldnot | mustnot) \"may\">\n\
-// This dtd sintax will be replaced by #IMPLIED attributes.
-
namespace anna {
namespace diameter {
namespace stack {
//------------------------------------------------------------------------------
std::string anna::diameter::stack::Engine::asString(bool all) const throw() {
std::string trace;
- unsigned int stackId;
if(isEmpty()) {
trace = "No diameter stacks found";
throw anna::RuntimeException("Such provided stack id has already been created. Removes it before call this method", ANNA_FILE_LOCATION);
} else { // new stack
a_stacks[stackId] = dictionary; // no need for singleton destructor
- const_stack_iterator it = a_stacks.find(stackId);
+ //const_stack_iterator it = a_stacks.find(stackId);
//result = (Dictionary *)(*it).second;
result = dictionary;
}
throw(RuntimeException) {
verify();
allocate(a_blockSize);
- const DataBlock* result = NULL;
size_t blockSize = fread((char *) getData(), 1, a_blockSize, a_file);
if(blockSize == 0)
const char* Engine::completeURL(const char* url)
throw() {
static const char* protocol = "ldap://";
- static const int protocolLen = anna_strlen(protocol);
if(anna_strstr(url, "://") == 0) {
a_auxURL = protocol;
case Scope::Base: scope = LDAP_SCOPE_BASE; break;
case Scope::OneLevel: scope = LDAP_SCOPE_ONELEVEL; break;
case Scope::SubTree: scope = LDAP_SCOPE_SUBTREE; break;
+ case Scope::None: return result; break;
}
int maxi = attribute_size() + 1;
LDAP* handle = NULL;
int aux;
ResultCode resultCode;
- Response* response(NULL);
try {
resultCode = ldap_initialize(&handle, a_url.c_str());
int error = LDAP_SUCCESS;
char **values(NULL);
ResultCode resultCode;
- bool isOk = true;
response->cancelTimer();
const int ldap_result = ldap_parse_result(handle, hmessage, &error, NULL, NULL, &values, NULL, 0);
resultCode.setValue(ldap_result, error);
result->createChild("NetworkTimeout")->createAttribute("Value", getNetworkTimeout());
xml::Node* requests = result->createChild("ldap.Requests");
- const Response* response;
const Request* request;
for(const_response_iterator ii = response_begin(), maxii = response_end(); ii != maxii; ii ++) {
// TODO: mutex the step while setting data here !!
}
+/*
void cmdRunOnThreadWithFork (TestStepCmd *step, const std::string &cmd) {
// Thread running:
step->complete();
}
}
+*/
bool decodeMessage(const anna::DataBlock &message, anna::diameter::codec::Message &messageCodec) throw() {
const int size = lseek(stream, 0, SEEK_END);
lseek(stream, 0, SEEK_SET);
char* buffer = new char [size];
- read(stream, buffer, size);
+ ssize_t r = read(stream, buffer, size);
close(stream);
const_cast <DocumentFile*>(this)->setContent(buffer, size);
delete buffer;
const xml::Node* xml::XPath::find(const Document& document, const char* expression, const int mode, const Exception::Mode::_v emode)
throw(RuntimeException) {
apply(document, expression, mode);
- const xml::Node* result = NULL;
Node::const_child_iterator ii = node_begin();
if(ii == node_end()) {
node->createText(decode(xmlNode->content));
return;
+
+ default:
+ ;
}
xmlNode = xmlNode->next;