Commit d9c05bd8 authored by garciay's avatar garciay
Browse files

STF525: Test AtsCAM/AtsDENM in secured mode

parent 9dc581fd
......@@ -52,6 +52,8 @@ public: //! \publicsection
static const std::string& longitude; //! Test system Longitude parameter name
static const std::string& expiry; //! Test system GeoNetworking Lifetime parameter name (in ms)
static const std::string& station_id; //! To indicate to the peer ITS_Container::stationID
static const std::string& device_mode; //! To indicate to the lower layer to act as a standalone device
static const std::string& secured_mode; //! To indicate to the lower layer to apply signature on message exchanges as defined in IEEE 1609.2 & ETSI TS 102 965
static const std::string& encrypted_mode; //! To indicate to the lower layer to apply encryption on message exchanges as defined in IEEE 1609.2 & ETSI TS 102 965
......
......@@ -45,6 +45,8 @@ const std::string& params::longitude = std::string("longitude");
const std::string& params::ll_address = std::string("ll_address");
const std::string& params::expiry = std::string("expiry");
const std::string& params::station_id = std::string("station_id");
const std::string& params::device_mode = std::string("device_mode");
const std::string& params::secured_mode = std::string("secured_mode");
const std::string& params::encrypted_mode = std::string("encrypted_mode");
......
......@@ -14,7 +14,7 @@ btp_layer::btp_layer(const std::string & p_type, const std::string & param) : t_
// Sanity check
params::const_iterator it = _params.find(params::btp_type);
if (it == _params.cend()) {
_params[params::btp_type] = std::string("btpA");
_params[params::btp_type] = std::string("btpB");
}
it = _params.find(params::btp_destination_port);
if (it == _params.cend()) {
......
......@@ -131,10 +131,10 @@ void geonetworking_layer::init(const std::string & p_type, const std::string & p
}
// Automatic beaconing mode
fill_beacon(ll_address, station_type, country, type_of_address);
params::const_iterator i = _params.find(params::beaconing);
if ((i != _params.cend()) && (i->second.compare("1") == 0)) { // Immediate beaconing was requested
// Prepare beaconing operation
fill_beacon(ll_address, station_type, country, type_of_address);
start_beaconing();
}
......
......@@ -8,38 +8,60 @@ uppertester_cam_layer::uppertester_cam_layer(const std::string & p_type, const s
loggers::get_instance().log(">>> uppertester_cam_layer::uppertester_cam_layer: %s, %s", to_string().c_str(), param.c_str());
// Setup parameters
params::convert(_params, param);
params::const_iterator it = _params.find(params::loopback);
if (it == _params.cend()) {
_params.insert(std::pair<std::string, std::string>(params::loopback, "0"));
}
}
void uppertester_cam_layer::sendMsg(const LibItsCam__TypesAndValues::UtCamInitialize& send_par, params& p_params){
loggers::get_instance().log_msg(">>> uppertester_cam_layer::sendMsg", send_par);
// Encode UpperTester PDU
OCTETSTRING data;
_codec.encode((const Record_Type &)send_par, data);
// Update parameters
send_data(data, p_params);
if (_params[params::loopback].compare("1") == 0) {
LibItsCam__TypesAndValues::UtCamResults ut_cam_results;
ut_cam_results.utCamInitializeResult() = BOOLEAN(true);
to_all_upper_ports(ut_cam_results, p_params);
} else {
// Encode UpperTester PDU
OCTETSTRING data;
_codec.encode((const Record_Type &)send_par, data);
// Update parameters
send_data(data, p_params);
}
}
void uppertester_cam_layer::sendMsg(const LibItsCam__TypesAndValues::UtCamChangePosition& send_par, params& p_params)
{
loggers::get_instance().log_msg(">>> uppertester_cam_layer::sendMsg", send_par);
// Encode UpperTester PDU
OCTETSTRING data;
_codec.encode((const Record_Type &)send_par, data);
// Update parameters
send_data(data, p_params);
if (_params[params::loopback].compare("1") == 0) {
LibItsCam__TypesAndValues::UtCamResults ut_cam_results;
ut_cam_results.utCamChangePositionResult() = BOOLEAN(true);
to_all_upper_ports(ut_cam_results, p_params);
} else {
// Encode UpperTester PDU
OCTETSTRING data;
_codec.encode((const Record_Type &)send_par, data);
// Update parameters
send_data(data, p_params);
}
}
void uppertester_cam_layer::sendMsg(const LibItsCam__TypesAndValues::UtCamTrigger& send_par, params& p_params)
{
loggers::get_instance().log_msg(">>> uppertester_cam_layer::sendMsg", send_par);
// Encode UpperTester PDU
OCTETSTRING data;
_codec.encode(send_par, data);
// Update parameters
send_data(data, p_params);
if (_params[params::loopback].compare("1") == 0) {
LibItsCam__TypesAndValues::UtCamResults ut_cam_results;
ut_cam_results.utCamTriggerResult() = BOOLEAN(true);
to_all_upper_ports(ut_cam_results, p_params);
} else {
// Encode UpperTester PDU
OCTETSTRING data;
_codec.encode(send_par, data);
// Update parameters
send_data(data, p_params);
}
}
void uppertester_cam_layer::send_data(OCTETSTRING& data, params& p_params) {
......
......@@ -8,71 +8,118 @@ uppertester_denm_layer::uppertester_denm_layer(const std::string & p_type, const
loggers::get_instance().log(">>> uppertester_denm_layer::uppertester_denm_layer: %s, %s", to_string().c_str(), param.c_str());
// Setup parameters
params::convert(_params, param);
}
params::const_iterator it = _params.find(params::loopback);
if (it == _params.cend()) {
_params.insert(std::pair<std::string, std::string>(params::loopback, "0"));
}
it = _params.find(params::station_id);
if (it == _params.cend()) {
_params.insert(std::pair<std::string, std::string>(params::station_id, "12345"));
}
} // End of ctor
void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmInitialize& send_par, params& p_params){
loggers::get_instance().log_msg(">>> uppertester_denm_layer::sendMsg", send_par);
// Encode UpperTester PDU
OCTETSTRING data;
_codec.encode((const Record_Type &)send_par, data);
// Update parameters
send_data(data, p_params);
if (_params[params::loopback].compare("1") == 0) {
LibItsDenm__TypesAndValues::UtDenmResults ut_denm_results;
ut_denm_results.utDenmInitializeResult() = BOOLEAN(true);
to_all_upper_ports(ut_denm_results, p_params);
} else {
// Encode UpperTester PDU
OCTETSTRING data;
_codec.encode((const Record_Type &)send_par, data);
// Update parameters
send_data(data, p_params);
}
}
void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmChangePosition& send_par, params& p_params)
{
loggers::get_instance().log_msg(">>> uppertester_denm_layer::sendMsg", send_par);
// Encode UpperTester PDU
OCTETSTRING data;
_codec.encode((const Record_Type &)send_par, data);
// Update parameters
send_data(data, p_params);
if (_params[params::loopback].compare("1") == 0) {
LibItsDenm__TypesAndValues::UtDenmResults ut_denm_results;
ut_denm_results.utDenmChangePositionResult() = BOOLEAN(true);
to_all_upper_ports(ut_denm_results, p_params);
} else {
// Encode UpperTester PDU
OCTETSTRING data;
_codec.encode((const Record_Type &)send_par, data);
// Update parameters
send_data(data, p_params);
}
}
void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmChangePseudonym& send_par, params& p_params)
{
loggers::get_instance().log_msg(">>> uppertester_denm_layer::sendMsg", send_par);
// Encode UpperTester PDU
OCTETSTRING data;
_codec.encode((const Record_Type &)send_par, data);
// Update parameters
send_data(data, p_params);
if (_params[params::loopback].compare("1") == 0) {
LibItsDenm__TypesAndValues::UtDenmResults ut_denm_results;
ut_denm_results.utDenmChangePseudonymResult() = BOOLEAN(true);
to_all_upper_ports(ut_denm_results, p_params);
} else {
// Encode UpperTester PDU
OCTETSTRING data;
_codec.encode((const Record_Type &)send_par, data);
// Update parameters
send_data(data, p_params);
}
}
void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmTrigger& send_par, params& p_params)
{
loggers::get_instance().log_msg(">>> uppertester_denm_layer::sendMsg", send_par);
// Encode UpperTester PDU
OCTETSTRING data;
_codec.encode((const Record_Type &)send_par, data);
// Update parameters
send_data(data, p_params);
if (_params[params::loopback].compare("1") == 0) {
LibItsDenm__TypesAndValues::UtDenmTriggerResult trigger_result(true, ITS__Container::ActionID(std::stoi(_params[params::station_id]), 1));
LibItsDenm__TypesAndValues::UtDenmResults ut_denm_results;
ut_denm_results.utDenmTriggerResult() = trigger_result;
to_all_upper_ports(ut_denm_results, p_params);
} else {
// Encode UpperTester PDU
OCTETSTRING data;
_codec.encode((const Record_Type &)send_par, data);
// Update parameters
send_data(data, p_params);
}
}
void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmUpdate& send_par, params& p_params)
{
loggers::get_instance().log_msg(">>> uppertester_denm_layer::sendMsg", send_par);
// Encode UpperTester PDU
OCTETSTRING data;
_codec.encode((const Record_Type &)send_par, data);
// Update parameters
send_data(data, p_params);
if (_params[params::loopback].compare("1") == 0) {
LibItsDenm__TypesAndValues::UtDenmUpdateResult update_result(true, ITS__Container::ActionID(std::stoi(_params[params::station_id]), 1));
LibItsDenm__TypesAndValues::UtDenmResults ut_denm_results;
ut_denm_results.utDenmUpdateResult() = update_result;
to_all_upper_ports(ut_denm_results, p_params);
} else {
// Encode UpperTester PDU
OCTETSTRING data;
_codec.encode((const Record_Type &)send_par, data);
// Update parameters
send_data(data, p_params);
}
}
void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmTermination& send_par, params& p_params)
{
loggers::get_instance().log_msg(">>> uppertester_denm_layer::sendMsg", send_par);
// Encode UpperTester PDU
OCTETSTRING data;
_codec.encode((const Record_Type &)send_par, data);
// Update parameters
send_data(data, p_params);
if (_params[params::loopback].compare("1") == 0) {
LibItsDenm__TypesAndValues::UtDenmResults ut_denm_results;
ut_denm_results.utDenmTerminationResult() = BOOLEAN(true);
to_all_upper_ports(ut_denm_results, p_params);
} else {
// Encode UpperTester PDU
OCTETSTRING data;
_codec.encode((const Record_Type &)send_par, data);
// Update parameters
send_data(data, p_params);
}
}
void uppertester_denm_layer::send_data(OCTETSTRING& data, params& p_params) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment