sources := ImsMonitorDiameterPort.cc
includes := .
#include "ImsMonitorSipPort.hh"
#include "sip_layer_factory.hh"
#include "loggers.hh"
namespace AtsImsIot__TestSystem {
ImsMonitorSipPort::ImsMonitorSipPort(const char *par_port_name): ImsMonitorSipPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(nullptr), _time_key("ImsMonitorSipPort::outgoing_send") {
// Nothing to do
} // End of constructor
ImsMonitorSipPort::~ImsMonitorSipPort() {
loggers::get_instance().log(">>> ImsMonitorSipPort::~ImsMonitorSipPort");
if (_layer != nullptr) {
delete _layer;
}
} // End of destructor
void ImsMonitorSipPort::set_parameter(const char * parameter_name, const char * parameter_value)
{
loggers::get_instance().log("ImsMonitorSipPort::set_parameter: %s=%s", parameter_name, parameter_value);
_cfg_params.insert(std::pair<std::string, std::string>(std::string(parameter_name), std::string(parameter_value)));
}
/*void ImsMonitorSipPort::Handle_Fd_Event(int fd, boolean is_readable,
boolean is_writable, boolean is_error) {}*/
void ImsMonitorSipPort::Handle_Fd_Event_Error(int /*fd*/)
{
}
void ImsMonitorSipPort::Handle_Fd_Event_Writable(int /*fd*/)
{
}
void ImsMonitorSipPort::Handle_Fd_Event_Readable(int /*fd*/)
{
}
/*void ImsMonitorSipPort::Handle_Timeout(double time_since_last_call) {}*/
void ImsMonitorSipPort::user_map(const char * system_port)
{
loggers::get_instance().log(">>> ImsMonitorSipPort::user_map: %s", system_port);
// Build layer stack
/*params::iterator it = _cfg_params.find(std::string("params"));
if (it != _cfg_params.end()) {
loggers::get_instance().log("ImsMonitorSipPort::user_map: %s", it->second.c_str());
// Setup parameters
params::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless
// Create layer
_layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str());
if (static_cast<sip_layer *>(_layer) == nullptr) {
loggers::get_instance().error("ImsMonitorSipPort::user_map: Invalid stack configuration: %s", it->second.c_str());
}
static_cast<sip_layer *>(_layer)->add_upper_port(this);
} else {*/
loggers::get_instance().error("ImsMonitorSipPort::user_map: No layers defined in configuration file");
/*}*/
} // End of user_map method
void ImsMonitorSipPort::user_unmap(const char * system_port)
{
loggers::get_instance().log(">>> ImsMonitorSipPort::user_unmap: %s", system_port);
// Reset layers
if (_layer != nullptr) {
delete _layer;
_layer = nullptr;
}
} // End of user_unmap method
void ImsMonitorSipPort::user_start()
{
loggers::get_instance().log(">>> ImsMonitorSipPort::user_start");
} // End of user_start method
void ImsMonitorSipPort::user_stop()
{
loggers::get_instance().log(">>> ImsMonitorSipPort::user_stop");
} // End of user_stop method
void ImsMonitorSipPort::receiveMsg (const LibSip__SIPTypesAndValues::Request& p_ind, const params& p_params) {
loggers::get_instance().log_msg(">>> ImsMonitorSipPort::receive_msg: ", p_ind);
// Sanity check
if (!p_ind.is_bound()) {
return;
}
incoming_message(p_ind);
} // End of method receiveMsg
void ImsMonitorSipPort::receiveMsg (const LibSip__SIPTypesAndValues::Response& p_ind, const params& p_params) {
loggers::get_instance().log_msg(">>> ImsMonitorSipPort::receive_msg: ", p_ind);
// Sanity check
if (!p_ind.is_bound()) {
return;
}
incoming_message(p_ind);
} // End of method receiveMsg
void ImsMonitorSipPort::receiveMsg (const LibMsrp__TypesAndValues::SEND__request& p_ind, const params& p_params) {
loggers::get_instance().log_msg(">>> ImsMonitorSipPort::receive_msg: ", p_ind);
// Sanity check
if (!p_ind.is_bound()) {
return;
}
incoming_message(p_ind);
} // End of method receiveMsg
void ImsMonitorSipPort::receiveMsg (const LibMsrp__TypesAndValues::RECEIVE__response& p_ind, const params& p_params) {
loggers::get_instance().log_msg(">>> ImsMonitorSipPort::receive_msg: ", p_ind);
// Sanity check
if (!p_ind.is_bound()) {
return;
}
incoming_message(p_ind);
} // End of method receiveMsg
}
#pragma once
#include "AtsImsIot_TestSystem.hh"
#include "LibSip_Interface.hh"
#include "LibMsrp_TypesAndValues.hh"
#include "layer.hh"
#include "params.hh"
namespace LibSip__SIPTypesAndValues {
class REGISTER__Request;
}
namespace AtsImsIot__TestSystem {
class ImsMonitorSipPort : public ImsMonitorSipPort_BASE {
params _cfg_params;
params _layer_params;
layer* _layer;
std::string _time_key;
public:
ImsMonitorSipPort(const char *par_port_name);
~ImsMonitorSipPort();
void set_parameter(const char *parameter_name, const char *parameter_value);
void receiveMsg (const LibSip__SIPTypesAndValues::Request& p_ind, const params& p_params);
void receiveMsg (const LibSip__SIPTypesAndValues::Response& p_ind, const params& p_params);
void receiveMsg (const LibMsrp__TypesAndValues::SEND__request& p_ind, const params& p_params);
void receiveMsg (const LibMsrp__TypesAndValues::RECEIVE__response& p_ind, const params& p_params);
private:
/* void Handle_Fd_Event(int fd, boolean is_readable,
boolean is_writable, boolean is_error); */
void Handle_Fd_Event_Error(int fd);
void Handle_Fd_Event_Writable(int fd);
void Handle_Fd_Event_Readable(int fd);
/* void Handle_Timeout(double time_since_last_call); */
protected:
void user_map(const char *system_port);
void user_unmap(const char *system_port);
void user_start();
void user_stop();
}; // End of class ImsMonitorSipPort
}
sources := ImsMonitorSipPort.cc
includes := .
#include "DiameterPort.hh"
#include "diameter_layer_factory.hh"
#include "loggers.hh"
namespace LibDiameter__Interface {
DiameterPort::DiameterPort(const char *par_port_name): DiameterPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(nullptr), _time_key("DiameterPort::outgoing_send") {
// Nothing to do
} // End of constructor
DiameterPort::~DiameterPort() {
loggers::get_instance().log(">>> DiameterPort::~DiameterPort");
if (_layer != nullptr) {
delete _layer;
}
} // End of destructor
void DiameterPort::set_parameter(const char * parameter_name, const char * parameter_value)
{
loggers::get_instance().log("DiameterPort::set_parameter: %s=%s", parameter_name, parameter_value);
_cfg_params.insert(std::pair<std::string, std::string>(std::string(parameter_name), std::string(parameter_value)));
}
/*void DiameterPort::Handle_Fd_Event(int fd, boolean is_readable,
boolean is_writable, boolean is_error) {}*/
void DiameterPort::Handle_Fd_Event_Error(int /*fd*/)
{
}
void DiameterPort::Handle_Fd_Event_Writable(int /*fd*/)
{
}
void DiameterPort::Handle_Fd_Event_Readable(int /*fd*/)
{
}
/*void DiameterPort::Handle_Timeout(double time_since_last_call) {}*/
void DiameterPort::user_map(const char * system_port)
{
loggers::get_instance().log(">>> DiameterPort::user_map: %s", system_port);
// Build layer stack
params::iterator it = _cfg_params.find(std::string("params"));
if (it != _cfg_params.end()) {
loggers::get_instance().log("DiameterPort::user_map: %s", it->second.c_str());
// Setup parameters
params::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless
// Create layer
_layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str());
if (static_cast<diameter_layer *>(_layer) == nullptr) {
loggers::get_instance().error("DiameterPort::user_map: Invalid stack configuration: %s", it->second.c_str());
}
static_cast<diameter_layer *>(_layer)->add_upper_port(this);
} else {
loggers::get_instance().error("DiameterPort::user_map: No layers defined in configuration file");
}
} // End of user_map method
void DiameterPort::user_unmap(const char * system_port)
{
loggers::get_instance().log(">>> DiameterPort::user_unmap: %s", system_port);
// Reset layers
if (_layer != nullptr) {
delete _layer;
_layer = nullptr;
}
} // End of user_unmap method
void DiameterPort::user_start()
{
loggers::get_instance().log(">>> DiameterPort::user_start");
} // End of user_start method
void DiameterPort::user_stop()
{
loggers::get_instance().log(">>> DiameterPort::user_stop");
} // End of user_stop method
void DiameterPort::receiveMsg (const LibDiameter__TypesAndValues::DIAMETER__MSG& p_ind, const params& p_params) {
loggers::get_instance().log_msg(">>> DiameterPort::receive_msg: ", p_ind);
// Sanity check
if (!p_ind.is_bound()) {
return;
}
incoming_message(p_ind);
} // End of method receiveMsg
void DiameterPort::outgoing_send(const LibDiameter__TypesAndValues::DIAMETER__MSG& send_par)
{
loggers::get_instance().log_msg(">>> DiameterPort::outgoing_send: ", send_par);
float duration;
loggers::get_instance().set_start_time(_time_key);
params params;
static_cast<diameter_layer*>(_layer)->sendMsg(send_par, params);
loggers::get_instance().set_stop_time(_time_key, duration);
} // End of outgoing_send
}
#pragma once
#include "LibDiameter_Interface.hh"
#include "layer.hh"
#include "params.hh"
namespace LibDiameter__Interface {
class DiameterPort : public DiameterPort_BASE {
params _cfg_params;
params _layer_params;
layer* _layer;
std::string _time_key;
public:
DiameterPort(const char *par_port_name);
~DiameterPort();
void set_parameter(const char *parameter_name, const char *parameter_value);
void receiveMsg (const LibDiameter__TypesAndValues::DIAMETER__MSG& p_ind, const params& p_params);
private:
/* void Handle_Fd_Event(int fd, boolean is_readable,
boolean is_writable, boolean is_error); */
void Handle_Fd_Event_Error(int fd);
void Handle_Fd_Event_Writable(int fd);
void Handle_Fd_Event_Readable(int fd);
/* void Handle_Timeout(double time_since_last_call); */
protected:
void user_map(const char *system_port);
void user_unmap(const char *system_port);
void user_start();
void user_stop();
protected:
virtual void outgoing_send(const LibDiameter__TypesAndValues::DIAMETER__MSG& send_par);
}; // End of class DiameterPort
}
#include "LowerLayerPPort.hh"
#include "lower_layer_pport_layer_factory.hh"
#include "loggers.hh"
namespace LibDiameter__Interface {
LowerLayerPPort::LowerLayerPPort(const char *par_port_name): LowerLayerPPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(nullptr), _time_key("LowerLayerPPort::outgoing_send") {
// Nothing to do
} // End of constructor
LowerLayerPPort::~LowerLayerPPort() {
loggers::get_instance().log(">>> LowerLayerPPort::~LowerLayerPPort");
if (_layer != nullptr) {
delete _layer;
}
} // End of destructor
void LowerLayerPPort::set_parameter(const char * parameter_name, const char * parameter_value)
{
loggers::get_instance().log("LowerLayerPPort::set_parameter: %s=%s", parameter_name, parameter_value);
_cfg_params.insert(std::pair<std::string, std::string>(std::string(parameter_name), std::string(parameter_value)));
}
/*void LowerLayerPPort::Handle_Fd_Event(int fd, boolean is_readable,
boolean is_writable, boolean is_error) {}*/
void LowerLayerPPort::Handle_Fd_Event_Error(int /*fd*/)
{
}
void LowerLayerPPort::Handle_Fd_Event_Writable(int /*fd*/)
{
}
void LowerLayerPPort::Handle_Fd_Event_Readable(int /*fd*/)
{
}
/*void LowerLayerPPort::Handle_Timeout(double time_since_last_call) {}*/
void LowerLayerPPort::user_map(const char * system_port)
{
loggers::get_instance().log(">>> LowerLayerPPort::user_map: %s", system_port);
// Build layer stack
params::iterator it = _cfg_params.find(std::string("params"));
if (it != _cfg_params.end()) {
loggers::get_instance().log("LowerLayerPPort::user_map: %s", it->second.c_str());
// Setup parameters
params::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless
// Create layer
_layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str());
if (static_cast<lower_layer_pport_layer *>(_layer) == nullptr) {
loggers::get_instance().error("LowerLayerPPort::user_map: Invalid stack configuration: %s", it->second.c_str());
}
static_cast<lower_layer_pport_layer *>(_layer)->add_upper_port(this);
} else {
loggers::get_instance().error("LowerLayerPPort::user_map: No layers defined in configuration file");
}
} // End of user_map method
void LowerLayerPPort::user_unmap(const char * system_port)
{
loggers::get_instance().log(">>> LowerLayerPPort::user_unmap: %s", system_port);
// Reset layers
if (_layer != nullptr) {
delete _layer;
_layer = nullptr;
}
} // End of user_unmap method
void LowerLayerPPort::user_start()
{
loggers::get_instance().log(">>> LowerLayerPPort::user_start");
} // End of user_start method
void LowerLayerPPort::user_stop()
{
loggers::get_instance().log(">>> LowerLayerPPort::user_stop");
} // End of user_stop method
void LowerLayerPPort::receiveMsg (const LibDiameter__TypesAndValues::Lower__Layer__Primitive& p_ind, const params& p_params) {
loggers::get_instance().log_msg(">>> LowerLayerPPort::receive_msg: ", p_ind);
// Sanity check
if (!p_ind.is_bound()) {
return;
}
incoming_message(p_ind);
} // End of method receiveMsg
void LowerLayerPPort::outgoing_send(const LibDiameter__TypesAndValues::Lower__Layer__Primitive& send_par)
{
loggers::get_instance().log_msg(">>> LowerLayerPPort::outgoing_send: ", send_par);
float duration;
loggers::get_instance().set_start_time(_time_key);
params params;
static_cast<lower_layer_pport_layer*>(_layer)->sendMsg(send_par, params);
loggers::get_instance().set_stop_time(_time_key, duration);
} // End of outgoing_send
}
#pragma once
#include "LibDiameter_Interface.hh"
#include "layer.hh"
#include "params.hh"
namespace LibDiameter__Interface {
class LowerLayerPPort : public LowerLayerPPort_BASE {
params _cfg_params;
params _layer_params;
layer* _layer;
std::string _time_key;
public:
LowerLayerPPort(const char *par_port_name);
~LowerLayerPPort();
void set_parameter(const char *parameter_name, const char *parameter_value);
void receiveMsg (const LibDiameter__TypesAndValues::Lower__Layer__Primitive& p_ind, const params& p_params);
private:
/* void Handle_Fd_Event(int fd, boolean is_readable,
boolean is_writable, boolean is_error); */
void Handle_Fd_Event_Error(int fd);
void Handle_Fd_Event_Writable(int fd);
void Handle_Fd_Event_Readable(int fd);
/* void Handle_Timeout(double time_since_last_call); */
protected:
void user_map(const char *system_port);
void user_unmap(const char *system_port);
void user_start();
void user_stop();
protected:
virtual void outgoing_send(const LibDiameter__TypesAndValues::Lower__Layer__Primitive& send_par);
}; // End of class LowerLayerPPort
}
sources := DiameterPort.cc LowerLayerPPort.cc
includes := .
#include "HttpPort.hh"
#include "http_layer_factory.hh"
#include "http_layer.hh"
#include "http_codec_emtel.hh"
#include "loggers.hh"
#include "LibHttp_TypesAndValues.hh"
namespace LibHttp__TestSystem {
HttpPort::HttpPort(const char *par_port_name): HttpPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(nullptr), _time_key("HttpPort::outgoing_send") {
// Nothing to do
} // End of constructor
HttpPort::~HttpPort() {
loggers::get_instance().log(">>> HttpPort::~HttpPort");
if (_layer != nullptr) {
delete _layer;
}
} // End of destructor
void HttpPort::set_parameter(const char * parameter_name, const char * parameter_value)
{
loggers::get_instance().log("HttpPort::set_parameter: %s=%s", parameter_name, parameter_value);
_cfg_params.insert(std::pair<std::string, std::string>(std::string(parameter_name), std::string(parameter_value)));
}
/*void HttpPort::Handle_Fd_Event(int fd, boolean is_readable,
boolean is_writable, boolean is_error) {}*/
void HttpPort::Handle_Fd_Event_Error(int /*fd*/)
{
}
void HttpPort::Handle_Fd_Event_Writable(int /*fd*/)
{
}
void HttpPort::Handle_Fd_Event_Readable(int /*fd*/)
{
}
/*void HttpPort::Handle_Timeout(double time_since_last_call) {}*/
void HttpPort::user_map(const char * system_port)
{
loggers::get_instance().log(">>> HttpPort::user_map: %s", system_port);
// Build layer stack
params::iterator it = _cfg_params.find(std::string("params"));
if (it != _cfg_params.end()) {
loggers::get_instance().log("HttpPort::user_map: %s", it->second.c_str());
// Setup parameters
params::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless
// Create layer
_layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str());
if (static_cast<http_layer*>(_layer) == nullptr) {
loggers::get_instance().error("HttpPort::user_map: Invalid stack configuration: %s", it->second.c_str());
}
if (!static_cast<http_layer*>(_layer)->set_codec(new http_codec_emtel())) {
loggers::get_instance().error("HttpPort::user_map: Null codec");
}
static_cast<http_layer *>(_layer)->add_upper_port(this);
} else {
loggers::get_instance().error("HttpPort::user_map: No layers defined in configuration file");
}
} // End of user_map method
void HttpPort::user_unmap(const char * system_port)
{
loggers::get_instance().log(">>> HttpPort::user_unmap: %s", system_port);
// Reset layers
if (_layer != nullptr) {
delete _layer;
_layer = nullptr;
}
} // End of user_unmap method
void HttpPort::user_start()
{
loggers::get_instance().log(">>> HttpPort::user_start");
} // End of user_start method
void HttpPort::user_stop()
{
loggers::get_instance().log(">>> HttpPort::user_stop");
} // End of user_stop method
void HttpPort::outgoing_send(const LibHttp__TypesAndValues::HttpMessage& send_par)
{
loggers::get_instance().log_msg(">>> HttpPort::outgoing_send: payload=", send_par);
float duration;
loggers::get_instance().set_start_time(_time_key);
params params;
static_cast<http_layer*>(_layer)->sendMsg(send_par, params);
loggers::get_instance().set_stop_time(_time_key, duration);
}
void HttpPort::receiveMsg (const LibHttp__TypesAndValues::HttpMessage& p_ind, const params& p_params) {
loggers::get_instance().log_msg(">>> HttpPort::receive_msg: ", p_ind);
// Sanity check
if (!p_ind.is_bound()) {
return;
}
incoming_message(p_ind);
}
} // End of namespace LibHttp__TestSystem
#pragma once
#include "LibHttp_TestSystem.hh"
#include "layer.hh"
#include "params.hh"
namespace LibHttp__TypesAndValues {
class HttpMessage;
}
namespace LibHttp__TestSystem {
class HttpPort : public HttpPort_BASE {
params _cfg_params;
params _layer_params;
layer* _layer;
std::string _time_key;
public:
HttpPort(const char *par_port_name);
~HttpPort();
void set_parameter(const char *parameter_name, const char *parameter_value);
void receiveMsg (const LibHttp__TypesAndValues::HttpMessage& p_ind, const params& p_params);
private:
/* void Handle_Fd_Event(int fd, boolean is_readable,
boolean is_writable, boolean is_error); */
void Handle_Fd_Event_Error(int fd);
void Handle_Fd_Event_Writable(int fd);
void Handle_Fd_Event_Readable(int fd);
/* void Handle_Timeout(double time_since_last_call); */
protected:
void user_map(const char *system_port);
void user_unmap(const char *system_port);
void user_start();
void user_stop();
protected:
void outgoing_send(const LibHttp__TypesAndValues::HttpMessage& send_par);
}; // End of class HttpPort
} // End of namespace LibHttp__TestSystem
sources := HttpPort.cc
includes := .
#include <TTCN3.hh>
#include "loggers.hh"
#include "registration.hh"
#include "AdapterConfigPort.hh"
//=============================================================================
namespace LibIot__TestInterface {
AdapterConfigPort::AdapterConfigPort(const char *par_port_name) : AdapterConfigPort_BASE(par_port_name), _params() {
loggers::get_instance().log("AdapterConfigPort::AdapterConfigPort");
}
AdapterConfigPort::~AdapterConfigPort() {}
void AdapterConfigPort::set_parameter(const char *parameter_name, const char *parameter_value) {
loggers::get_instance().log("AdapterConfigPort::set_parameter: %s=%s", parameter_name, parameter_value);
}
/*void AdapterConfigPort::Handle_Fd_Event(int fd, boolean is_readable,
boolean is_writable, boolean is_error) {}*/
void AdapterConfigPort::Handle_Fd_Event_Error(int /*fd*/) {}
void AdapterConfigPort::Handle_Fd_Event_Writable(int /*fd*/) {}
void AdapterConfigPort::Handle_Fd_Event_Readable(int /*fd*/) {}
/*void AdapterConfigPort::Handle_Timeout(double time_since_last_call) {}*/
void AdapterConfigPort::user_map(const char *system_port) { loggers::get_instance().log(">>> AdapterConfigPort::user_map: %s", system_port); }
void AdapterConfigPort::user_unmap(const char *system_port) { loggers::get_instance().log(">>> AdapterConfigPort::user_unmap: %s", system_port); }
void AdapterConfigPort::user_start() {}
void AdapterConfigPort::user_stop() {}
void AdapterConfigPort::outgoing_send(const LibIot__TypesAndValues::GeneralConfigurationReq& send_par) {
loggers::get_instance().log_msg(">>> AdapterConfigPort::outgoing_send: ", send_par);
// Register this object for AdapterConfigPort
/* geonetworking_layer *p = registration<geonetworking_layer>::get_instance().get_item(std::string("GN"));
if (p != NULL) {
loggers::get_instance().log("AdapterConfigPort::outgoing_send: Got GN layer %p", p);
LibIot__TypesAndValues::AcGnResponse response;
response.failure() = LibIot__TypesAndValues::AcGnResponseFailure(BOOLEAN(false));
if (send_par.ischosen(LibIot__TypesAndValues::AcGnPrimitive::ALT_startBeaconing)) {
loggers::get_instance().log("AdapterConfigPort::outgoing_send: Start beaconing");
p->start_beaconing(send_par.startBeaconing().beaconPacket());
// No response
return;
} else if (send_par.ischosen(LibIot__TypesAndValues::AcGnPrimitive::ALT_stopBeaconing)) {
loggers::get_instance().log("AdapterConfigPort::outgoing_send: Stop beaconing");
p->stop_beaconing();
// No response
return;
} else if (send_par.ischosen(LibIot__TypesAndValues::AcGnPrimitive::ALT_getLongPosVector)) {
loggers::get_instance().log("AdapterConfigPort::outgoing_send: Get LongPosVector");
const LibIot__TypesAndValues::LongPosVector *lpv = p->get_lpv(send_par.getLongPosVector().gnAddress());
loggers::get_instance().log("AdapterConfigPort::outgoing_send: Return value: %p", lpv);
if (lpv == nullptr) {
response.failure() = LibIot__TypesAndValues::AcGnResponseFailure(BOOLEAN(true));
} else {
response.getLongPosVector() = *lpv;
}
} else if (send_par.ischosen(LibIot__TypesAndValues::AcGnPrimitive::ALT_startPassBeaconing)) {
loggers::get_instance().log("AdapterConfigPort::outgoing_send: Start pass beaconing");
p->start_pass_beaconing(send_par.startPassBeaconing().beaconHeader());
// No response
return;
} else if (send_par.ischosen(LibIot__TypesAndValues::AcGnPrimitive::ALT_stopPassBeaconing)) {
loggers::get_instance().log("AdapterConfigPort::outgoing_send: Stop pass beaconing");
p->stop_pass_beaconing();
// No response
return;
} else {
response.failure() = LibIot__TypesAndValues::AcGnResponseFailure(BOOLEAN(true));
}
// Send response
loggers::get_instance().log_msg("AdapterConfigPort::outgoing_send: Send response: ", response);
incoming_message(response);
} else {*/
loggers::get_instance().error("AdapterConfigPort::outgoing_send: %s not registered", "geoNetworkingPort");
/*}*/
}
void AdapterConfigPort::outgoing_send(const LibIot__TypesAndValues::SetFilterReq& send_par) {
loggers::get_instance().log_msg(">>> AdapterConfigPort::outgoing_send: ", send_par);
}
void AdapterConfigPort::outgoing_send(const LibIot__TypesAndValues::StartTrafficCaptureReq& send_par) {
loggers::get_instance().log_msg(">>> AdapterConfigPort::outgoing_send: ", send_par);
}
void AdapterConfigPort::outgoing_send(const LibIot__TypesAndValues::StopTrafficCaptureReq& send_par) {
loggers::get_instance().log_msg(">>> AdapterConfigPort::outgoing_send: ", send_par);
// Register this object for AdapterConfigPort
/*geonetworking_layer *p = registration<geonetworking_layer>::get_instance().get_item(std::string("GN"));
if (p != NULL) {
loggers::get_instance().log("AdapterConfigPort::outgoing_send: Got GN layer %p", p);
LibItsCommon__TypesAndValues::AdapterControlResults response;
response.acSecResponse() = BOOLEAN(true);
if (send_par.ischosen(LibItsCommon__TypesAndValues::AcSecPrimitive::ALT_acEnableSecurity)) {
loggers::get_instance().log("AdapterConfigPort::outgoing_send: Enable secured mode");
std::string str(static_cast<const char *>(send_par.acEnableSecurity().certificateId()));
if (p->enable_secured_mode(str, send_par.acEnableSecurity().enforceSecurity()) == -1) {
response.acSecResponse() = BOOLEAN(false);
}
} else if (send_par.ischosen(LibItsCommon__TypesAndValues::AcSecPrimitive::ALT_acDisableSecurity)) {
loggers::get_instance().log("AdapterConfigPort::outgoing_send: Disable secured mode");
if (p->disable_secured_mode() == -1) {
response.acSecResponse() = BOOLEAN(false);
}
} else {
response.acSecResponse() = BOOLEAN(false);
}
// Send response
loggers::get_instance().log_msg("AdapterConfigPort::outgoing_send: Send response: ", response);
incoming_message(response);
} else {*/
loggers::get_instance().error("AdapterConfigPort::outgoing_send: %s not registered", "geoNetworkingPort");
/*}*/
}
} // namespace LibIot__TestInterface
#pragma once
#include "LibIot_TestInterface.hh"
#include "params.hh"
namespace LibIot__TestInterface {
class AdapterConfigPort : public AdapterConfigPort_BASE {
params _params;
public:
AdapterConfigPort(const char *par_port_name = NULL);
~AdapterConfigPort();
void set_parameter(const char *parameter_name, const char *parameter_value);
private:
/* void Handle_Fd_Event(int fd, boolean is_readable,
boolean is_writable, boolean is_error); */
void Handle_Fd_Event_Error(int fd);
void Handle_Fd_Event_Writable(int fd);
void Handle_Fd_Event_Readable(int fd);
/* void Handle_Timeout(double time_since_last_call); */
protected:
void user_map(const char *system_port);
void user_unmap(const char *system_port);
void user_start();
void user_stop();
void outgoing_send(const LibIot__TypesAndValues::GeneralConfigurationReq &send_par);
void outgoing_send(const LibIot__TypesAndValues::SetFilterReq &send_par);
void outgoing_send(const LibIot__TypesAndValues::StartTrafficCaptureReq &send_par);
void outgoing_send(const LibIot__TypesAndValues::StopTrafficCaptureReq &send_par);
};
} // namespace LibIot__TestInterface
#include "EquipmentAccessPort.hh"
#include "upper_tester_layer_factory.hh"
#include "loggers.hh"
namespace LibIot__TestInterface {
EquipmentAccessPort::EquipmentAccessPort(const char *par_port_name): EquipmentAccessPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(nullptr), _time_key("EquipmentAccessPort::outgoing_send") {
// Nothing to do
} // End of constructor
EquipmentAccessPort::~EquipmentAccessPort() {
loggers::get_instance().log(">>> EquipmentAccessPort::~EquipmentAccessPort");
if (_layer != nullptr) {
delete _layer;
}
} // End of destructor
void EquipmentAccessPort::set_parameter(const char * parameter_name, const char * parameter_value)
{
loggers::get_instance().log("EquipmentAccessPort::set_parameter: %s=%s", parameter_name, parameter_value);
_cfg_params.insert(std::pair<std::string, std::string>(std::string(parameter_name), std::string(parameter_value)));
}
/*void EquipmentAccessPort::Handle_Fd_Event(int fd, boolean is_readable,
boolean is_writable, boolean is_error) {}*/
void EquipmentAccessPort::Handle_Fd_Event_Error(int /*fd*/)
{
}
void EquipmentAccessPort::Handle_Fd_Event_Writable(int /*fd*/)
{
}
void EquipmentAccessPort::Handle_Fd_Event_Readable(int /*fd*/)
{
}
/*void EquipmentAccessPort::Handle_Timeout(double time_since_last_call) {}*/
void EquipmentAccessPort::user_map(const char * system_port)
{
loggers::get_instance().log(">>> EquipmentAccessPort::user_map: %s", system_port);
// Build layer stack
params::iterator it = _cfg_params.find(std::string("params"));
if (it != _cfg_params.end()) {
loggers::get_instance().log("EquipmentAccessPort::user_map: %s", it->second.c_str());
// Setup parameters
params::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless
// Create layer
_layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str());
if (static_cast<upper_tester_layer *>(_layer) == nullptr) {
loggers::get_instance().error("EquipmentAccessPort::user_map: Invalid stack configuration: %s", it->second.c_str());
}
static_cast<upper_tester_layer *>(_layer)->add_upper_port(this);
} else {
loggers::get_instance().error("EquipmentAccessPort::user_map: No layers defined in configuration file");
}
} // End of user_map method
void EquipmentAccessPort::user_unmap(const char * system_port)
{
loggers::get_instance().log(">>> EquipmentAccessPort::user_unmap: %s", system_port);
// Reset layers
if (_layer != nullptr) {
delete _layer;
_layer = nullptr;
}
} // End of user_unmap method
void EquipmentAccessPort::user_start()
{
loggers::get_instance().log(">>> EquipmentAccessPort::user_start");
} // End of user_start method
void EquipmentAccessPort::user_stop()
{
loggers::get_instance().log(">>> EquipmentAccessPort::user_stop");
} // End of user_stop method
void EquipmentAccessPort::receiveMsg (const LibUpperTester::EquipmentOperationRsp& p_ind, const params& p_params) {
loggers::get_instance().log_msg(">>> EquipmentAccessPort::receive_msg: ", p_ind);
// Sanity check
if (!p_ind.is_bound()) {
return;
}
incoming_message(p_ind);
} // End of method receiveMsg
void EquipmentAccessPort::outgoing_send(const LibUpperTester::EquipmentOperationReq& send_par)
{
loggers::get_instance().log_msg(">>> EquipmentAccessPort::outgoing_send: ", send_par);
float duration;
loggers::get_instance().set_start_time(_time_key);
params params;
static_cast<upper_tester_layer*>(_layer)->sendMsg(send_par, params);
loggers::get_instance().set_stop_time(_time_key, duration);
} // End of outgoing_send
}
#pragma once
#include "LibIot_TestInterface.hh"
#include "layer.hh"
#include "params.hh"
namespace LibIot__TestInterface {
class EquipmentAccessPort : public EquipmentAccessPort_BASE {
params _cfg_params;
params _layer_params;
layer* _layer;
std::string _time_key;
public:
EquipmentAccessPort(const char *par_port_name);
~EquipmentAccessPort();
void set_parameter(const char *parameter_name, const char *parameter_value);
void receiveMsg (const LibUpperTester::EquipmentOperationRsp& p_ind, const params& p_params);
private:
/* void Handle_Fd_Event(int fd, boolean is_readable,
boolean is_writable, boolean is_error); */
void Handle_Fd_Event_Error(int fd);
void Handle_Fd_Event_Writable(int fd);
void Handle_Fd_Event_Readable(int fd);
/* void Handle_Timeout(double time_since_last_call); */
protected:
void user_map(const char *system_port);
void user_unmap(const char *system_port);
void user_start();
void user_stop();
protected:
virtual void outgoing_send(const LibUpperTester::EquipmentOperationReq& send_par);
}; // End of class EquipmentAccessPort
}
sources := EquipmentAccessPort.cc AdapterConfigPort.cc
includes := .
#pragma once
#include "LibSip_Interface.hh"
namespace LibSip__Interface {
class OperatorPort : public OperatorPort_BASE {
public:
OperatorPort(const char *par_port_name): OperatorPort_BASE(par_port_name) { };
~OperatorPort() { };
protected:
virtual void outgoing_call(const s__SIP__conversation_call& call_par) { };
virtual void outgoing_call(const s__SIP__ringing_call& call_par) { };
virtual void outgoing_call(const s__SIP__announcementA_call& call_par) { };
virtual void outgoing_call(const s__SIP__announcementB_call& call_par) { };
virtual void outgoing_call(const s__SIP__announcement_call& call_par) { };
virtual void outgoing_call(const s__SIP__voiceMessage_call& call_par) { };
virtual void outgoing_call(const s__SIP__mediastopped_call& call_par) { };
virtual void outgoing_reply(const s__SIP__conversation_reply& reply_par) { };
virtual void outgoing_reply(const s__SIP__ringing_reply& reply_par) { };
virtual void outgoing_reply(const s__SIP__announcementA_reply& reply_par) { };
virtual void outgoing_reply(const s__SIP__announcementB_reply& reply_par) { };
virtual void outgoing_reply(const s__SIP__announcement_reply& reply_par) { };
virtual void outgoing_reply(const s__SIP__voiceMessage_reply& reply_par) { };
virtual void outgoing_reply(const s__SIP__mediastopped_reply& reply_par) { };
}; // End of class OperatorPort
}
#include "SipPort.hh"
#include "sip_layer_factory.hh"
#include "loggers.hh"
namespace LibSip__Interface {
SipPort::SipPort(const char *par_port_name): SipPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(nullptr), _time_key("SipPort::outgoing_send") {
// Nothing to do
} // End of constructor
SipPort::~SipPort() {
loggers::get_instance().log(">>> SipPort::~SipPort");
if (_layer != nullptr) {
delete _layer;
}
} // End of destructor
void SipPort::set_parameter(const char * parameter_name, const char * parameter_value)
{
loggers::get_instance().log("SipPort::set_parameter: %s=%s", parameter_name, parameter_value);
_cfg_params.insert(std::pair<std::string, std::string>(std::string(parameter_name), std::string(parameter_value)));
}
/*void SipPort::Handle_Fd_Event(int fd, boolean is_readable,
boolean is_writable, boolean is_error) {}*/
void SipPort::Handle_Fd_Event_Error(int /*fd*/)
{
}
void SipPort::Handle_Fd_Event_Writable(int /*fd*/)
{
}
void SipPort::Handle_Fd_Event_Readable(int /*fd*/)
{
}
/*void SipPort::Handle_Timeout(double time_since_last_call) {}*/
void SipPort::user_map(const char * system_port)
{
loggers::get_instance().log(">>> SipPort::user_map: %s", system_port);
// Build layer stack
params::iterator it = _cfg_params.find(std::string("params"));
if (it != _cfg_params.end()) {
loggers::get_instance().log("SipPort::user_map: %s", it->second.c_str());
// Setup parameters
params::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless
// Create layer
_layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str());
if (static_cast<sip_layer *>(_layer) == nullptr) {
loggers::get_instance().error("SipPort::user_map: Invalid stack configuration: %s", it->second.c_str());
}
static_cast<sip_layer *>(_layer)->add_upper_port(this);
} else {
loggers::get_instance().error("SipPort::user_map: No layers defined in configuration file");
}
} // End of user_map method
void SipPort::user_unmap(const char * system_port)
{
loggers::get_instance().log(">>> SipPort::user_unmap: %s", system_port);
// Reset layers
if (_layer != nullptr) {
delete _layer;
_layer = nullptr;
}
} // End of user_unmap method
void SipPort::user_start()
{
loggers::get_instance().log(">>> SipPort::user_start");
} // End of user_start method
void SipPort::user_stop()
{
loggers::get_instance().log(">>> SipPort::user_stop");
} // End of user_stop method
void SipPort::receiveMsg (const LibSip__SIPTypesAndValues::Request& p_ind, const params& p_params) {
loggers::get_instance().log_msg(">>> SipPort::receive_msg: ", p_ind);
// Sanity check
if (!p_ind.is_bound()) {
return;
}
if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::REGISTER__E) {
incoming_message(LibSip__SIPTypesAndValues::REGISTER__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
} else if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::INVITE__E) {
incoming_message(LibSip__SIPTypesAndValues::INVITE__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
} else if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::SUBSCRIBE__E) {
incoming_message(LibSip__SIPTypesAndValues::SUBSCRIBE__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
} else if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::NOTIFY__E) {
incoming_message(LibSip__SIPTypesAndValues::NOTIFY__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
} else if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::BYE__E) {
incoming_message(LibSip__SIPTypesAndValues::BYE__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
} else if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::INFO__E) {
incoming_message(LibSip__SIPTypesAndValues::INFO__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
} else if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::OPTIONS__E) {
incoming_message(LibSip__SIPTypesAndValues::OPTIONS__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
} else if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::MESSAGE__E) {
incoming_message(LibSip__SIPTypesAndValues::MESSAGE__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
} else if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::CANCEL__E) {
incoming_message(LibSip__SIPTypesAndValues::CANCEL__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
} else if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::ACK__E) {
incoming_message(LibSip__SIPTypesAndValues::ACK__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
} else {
incoming_message(p_ind);
}
} // End of method receiveMsg
void SipPort::receiveMsg (const LibSip__SIPTypesAndValues::Response& p_ind, const params& p_params) {
loggers::get_instance().log_msg(">>> SipPort::receive_msg: ", p_ind);
// Sanity check
if (!p_ind.is_bound()) {
return;
}
incoming_message(p_ind);
} // End of method receiveMsg
void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::INVITE__Request& send_par, const Address4SIP *destination_address)
{
loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
float duration;
loggers::get_instance().set_start_time(_time_key);
params params;
static_cast<sip_layer*>(_layer)->sendMsg(send_par, params);
loggers::get_instance().set_stop_time(_time_key, duration);
} // End of outgoing_send
void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::ACK__Request& send_par, const Address4SIP *destination_address)
{
loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
float duration;
loggers::get_instance().set_start_time(_time_key);
params params;
static_cast<sip_layer*>(_layer)->sendMsg(send_par, params);
loggers::get_instance().set_stop_time(_time_key, duration);
} // End of outgoing_send
void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::REGISTER__Request& send_par, const Address4SIP *destination_address) {
loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
float duration;
loggers::get_instance().set_start_time(_time_key);
params params;
static_cast<sip_layer*>(_layer)->sendMsg(send_par, params);
loggers::get_instance().set_stop_time(_time_key, duration);
}
void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::SUBSCRIBE__Request& send_par, const Address4SIP *destination_address) {
loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
float duration;
loggers::get_instance().set_start_time(_time_key);
params params;
static_cast<sip_layer*>(_layer)->sendMsg(send_par, params);
loggers::get_instance().set_stop_time(_time_key, duration);
}
void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::MESSAGE__Request& send_par, const Address4SIP *destination_address) {
loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
float duration;
loggers::get_instance().set_start_time(_time_key);
params params;
static_cast<sip_layer*>(_layer)->sendMsg(send_par, params);
loggers::get_instance().set_stop_time(_time_key, duration);
}
void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::OPTIONS__Request& send_par, const Address4SIP *destination_address) {
loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
float duration;
loggers::get_instance().set_start_time(_time_key);
params params;
static_cast<sip_layer*>(_layer)->sendMsg(send_par, params);
loggers::get_instance().set_stop_time(_time_key, duration);
}
void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::BYE__Request& send_par, const Address4SIP *destination_address) {
loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
float duration;
loggers::get_instance().set_start_time(_time_key);
params params;
static_cast<sip_layer*>(_layer)->sendMsg(send_par, params);
loggers::get_instance().set_stop_time(_time_key, duration);
}
void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::CANCEL__Request& send_par, const Address4SIP *destination_address) {
loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
float duration;
loggers::get_instance().set_start_time(_time_key);
params params;
static_cast<sip_layer*>(_layer)->sendMsg(send_par, params);
loggers::get_instance().set_stop_time(_time_key, duration);
}
void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::NOTIFY__Request& send_par, const Address4SIP *destination_address) {
loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
float duration;
loggers::get_instance().set_start_time(_time_key);
params params;
static_cast<sip_layer*>(_layer)->sendMsg(send_par, params);
loggers::get_instance().set_stop_time(_time_key, duration);
}
void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::INFO__Request& send_par, const Address4SIP *destination_address) {
loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
float duration;
loggers::get_instance().set_start_time(_time_key);
params params;
static_cast<sip_layer*>(_layer)->sendMsg(send_par, params);
loggers::get_instance().set_stop_time(_time_key, duration);
}
void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::Response& send_par, const Address4SIP *destination_address) {
loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
float duration;
loggers::get_instance().set_start_time(_time_key);
params params;
static_cast<sip_layer*>(_layer)->sendMsg(send_par, params);
loggers::get_instance().set_stop_time(_time_key, duration);
}
}
#pragma once
#include "LibSip_Interface.hh"
#include "layer.hh"
#include "params.hh"
namespace LibSip__SIPTypesAndValues {
class REGISTER__Request;
}
namespace LibSip__Interface {
class SipPort : public SipPort_BASE {
params _cfg_params;
params _layer_params;
layer* _layer;
std::string _time_key;
public:
SipPort(const char *par_port_name);
~SipPort();
void set_parameter(const char *parameter_name, const char *parameter_value);
void receiveMsg (const LibSip__SIPTypesAndValues::Request& p_ind, const params& p_params);
void receiveMsg (const LibSip__SIPTypesAndValues::Response& p_ind, const params& p_params);
private:
/* void Handle_Fd_Event(int fd, boolean is_readable,
boolean is_writable, boolean is_error); */
void Handle_Fd_Event_Error(int fd);
void Handle_Fd_Event_Writable(int fd);
void Handle_Fd_Event_Readable(int fd);
/* void Handle_Timeout(double time_since_last_call); */
protected:
void user_map(const char *system_port);
void user_unmap(const char *system_port);
void user_start();
void user_stop();
protected:
virtual void outgoing_send(const LibSip__SIPTypesAndValues::Request& send_par, const Address4SIP *destination_address) { };
void outgoing_send(const LibSip__SIPTypesAndValues::REGISTER__Request& send_par, const Address4SIP *destination_address);
void outgoing_send(const LibSip__SIPTypesAndValues::INVITE__Request& send_par, const Address4SIP *destination_address);
void outgoing_send(const LibSip__SIPTypesAndValues::OPTIONS__Request& send_par, const Address4SIP *destination_address);
void outgoing_send(const LibSip__SIPTypesAndValues::BYE__Request& send_par, const Address4SIP *destination_address);
void outgoing_send(const LibSip__SIPTypesAndValues::CANCEL__Request& send_par, const Address4SIP *destination_address);
void outgoing_send(const LibSip__SIPTypesAndValues::ACK__Request& send_par, const Address4SIP *destination_address);
virtual void outgoing_send(const LibSip__SIPTypesAndValues::PRACK__Request& send_par, const Address4SIP *destination_address) { };
void outgoing_send(const LibSip__SIPTypesAndValues::NOTIFY__Request& send_par, const Address4SIP *destination_address);
void outgoing_send(const LibSip__SIPTypesAndValues::SUBSCRIBE__Request& send_par, const Address4SIP *destination_address);
virtual void outgoing_send(const LibSip__SIPTypesAndValues::PUBLISH__Request& send_par, const Address4SIP *destination_address) { };
virtual void outgoing_send(const LibSip__SIPTypesAndValues::UPDATE__Request& send_par, const Address4SIP *destination_address) { };
virtual void outgoing_send(const LibSip__SIPTypesAndValues::REFER__Request& send_par, const Address4SIP *destination_address) { };
void outgoing_send(const LibSip__SIPTypesAndValues::MESSAGE__Request& send_par, const Address4SIP *destination_address);
void outgoing_send(const LibSip__SIPTypesAndValues::INFO__Request& send_par, const Address4SIP *destination_address);
void outgoing_send(const LibSip__SIPTypesAndValues::Response& send_par, const Address4SIP *destination_address);
virtual void outgoing_send(const CHARSTRING& send_par, const Address4SIP *destination_address) { };
}; // End of class SipPort
}