Commit de8ff769 authored by garciay's avatar garciay
Browse files

STF545: Review TPlan

parent 5534c135
......@@ -377,6 +377,7 @@ int http_codec::decode_header(CHARSTRING& header_line, LibItsHttp__TypesAndValue
int http_codec::encode_body(const LibItsHttp__MessageBodyTypes::HttpMessageBody& p_message_body, OCTETSTRING& p_encoding_buffer, const std::string& p_content_type) {
loggers::get_instance().log_msg(">>> http_codec::encode_body: ", (const Base_Type&)p_message_body);
loggers::get_instance().log("http_codec::encode_body: # of codecs=%d - %p", _codecs.size(), this);
// Sanity check
if (p_content_type.empty()) {
......@@ -391,12 +392,11 @@ int http_codec::encode_body(const LibItsHttp__MessageBodyTypes::HttpMessageBody&
} else {
std::map<std::string, std::unique_ptr<codec<Record_Type, Record_Type> > >::const_iterator it;
bool processed = false;
loggers::get_instance().log("http_codec::encode_body: # of codecs=%d - %p", _codecs.size(), this);
if (p_content_type.find("x-its") != std::string::npos) {
loggers::get_instance().log("http_codec::encode_body: Find x-its");
it = _codecs.find("http_its"); // TODO Use params
if (it != _codecs.cend()) {
loggers::get_instance().log("http_codec::encode_body: Call 'http_etsi_ieee1609dot2_codec'");
loggers::get_instance().log("http_codec::encode_body: Call '%s'", it->first.c_str());
_codecs["http_its"]->encode((Record_Type&)binary_body.ieee1609dot2__data(), p_encoding_buffer); // TODO Use params
processed = true;
}
......@@ -417,7 +417,6 @@ int http_codec::encode_body(const LibItsHttp__MessageBodyTypes::HttpMessageBody&
} else {
std::map<std::string, std::unique_ptr<codec<Record_Type, Record_Type> > >::const_iterator it;
bool processed = false;
loggers::get_instance().log("http_codec::encode_body: # of codecs=%d - %p", _codecs.size(), this);
loggers::get_instance().log("http_codec::encode_body: Content-type:'%s'", p_content_type.c_str());
if (p_content_type.find("held") != std::string::npos) {
it = _codecs.find("held"); // TODO Use params
......@@ -453,6 +452,7 @@ int http_codec::encode_body(const LibItsHttp__MessageBodyTypes::HttpMessageBody&
int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBodyTypes::HttpMessageBody& message_body, const std::string& p_content_type) {
loggers::get_instance().log(">>> http_codec::decode_body");
loggers::get_instance().log_to_hexa("http_codec::decode_body", decoding_buffer);
loggers::get_instance().log("http_codec::decode_body: # of codecs=%d - %p", _codecs.size(), this);
loggers::get_instance().log("http_codec::decode_body: Content-Type=%s", p_content_type.c_str());
// Sanity checks
......@@ -505,28 +505,32 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod
LibItsHttp__MessageBodyTypes::HttpMessageBody v;
if (_dc.is_binary == 0x01) {
LibItsHttp__BinaryMessageBodyTypes::BinaryBody binary_body;
std::map<std::string, std::unique_ptr<codec<Record_Type, Record_Type> > >::const_iterator it;
bool processed = false;
// TODO To be refined adding a string identifier to check which codec to use. E.g. held_code.id() returns "xmlns=\"urn:ietf:params:xml:ns:geopriv:held\">"
if (p_content_type.find("x-its") != std::string::npos) {
loggers::get_instance().log("http_codec::decode_body: Find 'x-its'");
/***
FIXME:
This code generate a codedump, I don't undertsand the reason.
The same code works file for Ng112 HELD & LOST codec. Ununderstandable!!!!
==> Use a patch
if (_codecs["http_its"].get() != nullptr) {
loggers::get_instance().log("http_codec::decode_body: Call 'http_etsi_ieee1609dot2_codec'");
if (_codecs["http_its"]->decode(body, (Record_Type&)binary_body) == 0) {
it = _codecs.cbegin();//_codecs.find("http_its");
if (it != _codecs.cend()) {
/***
FIXME:
This code generate a codedump, I don't undertsand the reason.
The same code works file for Ng112 HELD & LOST codec. Ununderstandable!!!!
==> Use a patch
if (_codecs["http_its"].get() != nullptr) {
loggers::get_instance().log("http_codec::decode_body: Call 'http_etsi_ieee1609dot2_codec'");
if (_codecs["http_its"]->decode(body, (Record_Type&)binary_body) == 0) {
processed = true;
}
}*/
loggers::get_instance().log("http_codec::decode_body: Call '%s'", it->first.c_str());
http_etsi_ieee1609dot2_codec* codec = new http_etsi_ieee1609dot2_codec();
if (codec->decode(body, binary_body.ieee1609dot2__data()) == 0) {
message_body.binary__body() = binary_body;
processed = true;
}
}*/
loggers::get_instance().log("http_codec::decode_body: Call 'http_etsi_ieee1609dot2_codec'");
http_etsi_ieee1609dot2_codec* codec = new http_etsi_ieee1609dot2_codec();
if (codec->decode(body, binary_body.ieee1609dot2__data()) == 0) {
message_body.binary__body() = binary_body;
processed = true;
delete codec;
}
delete codec;
} // TODO Add new HTTP message codec here
if (!processed) {
loggers::get_instance().warning("http_codec::decode_body: Unsupported HTTP codec, use raw field as default");
......
......@@ -46,7 +46,7 @@ LibItsHttp__TypesAndValues::HttpMessage>
std::map<std::string, std::unique_ptr<codec<Record_Type, Record_Type> > > _codecs;
public:
explicit http_codec() : codec<LibItsHttp__TypesAndValues::HttpMessage, LibItsHttp__TypesAndValues::HttpMessage>(), _ec(), _dc(), _codecs() { };
virtual ~http_codec() { };
virtual ~http_codec() { _codecs.clear(); };
virtual int encode (const LibItsHttp__TypesAndValues::HttpMessage&, OCTETSTRING& data);
virtual int decode (const OCTETSTRING& data, LibItsHttp__TypesAndValues::HttpMessage&, params* params = NULL);
......
......@@ -2,10 +2,19 @@
[MODULE_PARAMETERS]
# This section shall contain the values of all parameters that are defined in your TTCN-3 modules.
# IUT Station ID
LibItsCommon_Pixits.PX_IUT_STATION_ID := 2533729309
# The GeoNetworking address of the IUT.
LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := { typeOfAddress := e_manual,
stationType := e_passengerCar,
stationCountryCode := 0,
mid := '000000000001'O
# typeOfAddress := e_initial,
# stationType := e_unknown, #e_roadSideUnit,
# stationCountryCode := 0, #33,
# mid := '4C5E0C14D2EA'O
}
LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB
LibItsGeoNetworking_Pixits.PX_NEIGHBOUR_DISCOVERY_DELAY := 2.0
LibItsHttp_Pics.PICS_HEADER_HOST := "127.0.0.1" #"ptsv2.com"
LibItsHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request"
......@@ -104,7 +113,7 @@ LogEventTypes:= Yes
# save_mode : 1 to save sent packet, 0 otherwise
# Single GeoNetworking component port
#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,beaconing=!)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=eth2,filter=and ether proto 0x8947)"
system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=eth2)"
#system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=ptsv2.com,use_ssl=0)"
system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(server=127.0.0.1,port=8000,use_ssl=0)"
system.pkiPort.params := "PKI/HTTP(device_mode=1,uri=/its/inner_ec_request,host=httpbin.org,content_type=application/x-its-request)/TCP(server=127.0.0.1,port=8000,use_ssl=0)"
......@@ -113,9 +122,10 @@ system.pkiPort.params := "PKI/HTTP(device_mode=1,uri=/its/inner_ec_request,host=
system.utPort.params := "UT_CAM/UDP(dst_ip=172.23.0.1,dst_port=8000)"
[EXECUTE]
#ItsPki_TestCases.TC_SEC_PKI_ITSS_ENR_BV_01
ItsPki_TestCases.TC_SEC_PKI_ITSS_ENR_BV_01
#ItsPki_TestCases.TC_SEC_PKI_SND_EA_BV_01
ItsPki_TestCases.TC_SEC_PKI_SND_EA_BV_02
#ItsPki_TestCases.TC_SEC_PKI_SND_EA_BV_02
#ItsPki_TestCases.TC_SEC_PKI_SND_EA_BV_03
[MAIN_CONTROLLER]
# The options herein control the behavior of MC.
......
This diff is collapsed.
Subproject commit 919a3f4268398c424b892ce4b7bc79f88f3baa3f
Subproject commit 82720e1582ec32c60abcbb99d5ac0db17a8c93e5
Supports Markdown
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