Commit 62900816 authored by Yann Garcia's avatar Yann Garcia
Browse files

Unify changes from ITS

parent 611ff673
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
#include "loggers.hh" #include "loggers.hh"
#include "converter.hh"
#include "LibItsHttp_TypesAndValues.hh" #include "LibItsHttp_TypesAndValues.hh"
#include "LibItsHttp_MessageBodyTypes.hh" #include "LibItsHttp_MessageBodyTypes.hh"
#include "LibItsHttp_XmlMessageBodyTypes.hh" #include "LibItsHttp_XmlMessageBodyTypes.hh"
...@@ -80,7 +78,7 @@ int http_codec::decode (const OCTETSTRING& data, LibItsHttp__TypesAndValues::Htt ...@@ -80,7 +78,7 @@ int http_codec::decode (const OCTETSTRING& data, LibItsHttp__TypesAndValues::Htt
response.version__minor() = std::stoi(m[2].str().c_str()); response.version__minor() = std::stoi(m[2].str().c_str());
response.statuscode() = std::stoi(m[3].str().c_str()); response.statuscode() = std::stoi(m[3].str().c_str());
response.statustext() = CHARSTRING(m[4].str().c_str()); response.statustext() = CHARSTRING(m[4].str().c_str());
LibItsHttp__TypesAndValues::HeaderLines headers; LibItsHttp__TypesAndValues::Headers headers;
std::string content_type; std::string content_type;
decode_headers(decoding_buffer, headers, content_type); decode_headers(decoding_buffer, headers, content_type);
response.header() = headers; response.header() = headers;
...@@ -105,7 +103,7 @@ int http_codec::decode (const OCTETSTRING& data, LibItsHttp__TypesAndValues::Htt ...@@ -105,7 +103,7 @@ int http_codec::decode (const OCTETSTRING& data, LibItsHttp__TypesAndValues::Htt
request.uri() = CHARSTRING(m[2].str().c_str()); request.uri() = CHARSTRING(m[2].str().c_str());
request.version__major() = std::stoi(m[3].str().c_str()); request.version__major() = std::stoi(m[3].str().c_str());
request.version__minor() = std::stoi(m[4].str().c_str()); request.version__minor() = std::stoi(m[4].str().c_str());
LibItsHttp__TypesAndValues::HeaderLines headers; LibItsHttp__TypesAndValues::Headers headers;
std::string content_type; std::string content_type;
decode_headers(decoding_buffer, headers, content_type); decode_headers(decoding_buffer, headers, content_type);
request.header() = headers; request.header() = headers;
...@@ -142,10 +140,10 @@ int http_codec::encode_request(const LibItsHttp__TypesAndValues::Request& p_requ ...@@ -142,10 +140,10 @@ int http_codec::encode_request(const LibItsHttp__TypesAndValues::Request& p_requ
p_encoding_buffer.put_cs("\r\n"); p_encoding_buffer.put_cs("\r\n");
// Encode headers excepeted the Content-Length // Encode headers excepeted the Content-Length
const LibItsHttp__TypesAndValues::HeaderLines& headers = p_request.header(); const LibItsHttp__TypesAndValues::Headers& headers = p_request.header();
std::string content_type; std::string content_type;
for (int i = 0; i < headers.size_of(); i++) { for (int i = 0; i < headers.size_of(); i++) {
const LibItsHttp__TypesAndValues::HeaderLine& header = headers[i]; const LibItsHttp__TypesAndValues::Header& header = headers[i];
loggers::get_instance().log_msg("http_codec::encode_request: Processing header ", header.header__name()); loggers::get_instance().log_msg("http_codec::encode_request: Processing header ", header.header__name());
if (std::string(static_cast<const char*>(header.header__name())).compare("Content-Length") == 0) { // Skip it, processed later if (std::string(static_cast<const char*>(header.header__name())).compare("Content-Length") == 0) { // Skip it, processed later
loggers::get_instance().log("http_codec::encode_request: Skip it"); loggers::get_instance().log("http_codec::encode_request: Skip it");
...@@ -203,12 +201,13 @@ int http_codec::encode_request(const LibItsHttp__TypesAndValues::Request& p_requ ...@@ -203,12 +201,13 @@ int http_codec::encode_request(const LibItsHttp__TypesAndValues::Request& p_requ
p_encoding_buffer.put_cs("Content-Length: "); p_encoding_buffer.put_cs("Content-Length: ");
if (_ec.length != 0) { if (_ec.length != 0) {
loggers::get_instance().log("http_codec::encode_request: Content-Length: %s", static_cast<const char*>(int2str(_ec.length + 2/*Stand for the last CRLF*/))); loggers::get_instance().log("http_codec::encode_request: Content-Length: %s", static_cast<const char*>(int2str(_ec.length + 2/*Stand for the last CRLF*/)));
p_encoding_buffer.put_cs(static_cast<const char*>(int2str(_ec.length + 2/*Stand for the last CRLF*/))); p_encoding_buffer.put_cs(static_cast<const char*>(int2str(_ec.length)));
_ec.is_content_length_present = 0x01; _ec.is_content_length_present = 0x01;
} else { } else {
p_encoding_buffer.put_cs("0"); p_encoding_buffer.put_cs("0");
_ec.is_content_length_present = 0x00; _ec.is_content_length_present = 0x00;
} }
loggers::get_instance().log("http_codec::encode_request: Content-Length: %d - %x", _ec.length, _ec.is_content_length_present);
p_encoding_buffer.put_cs("\r\n"); p_encoding_buffer.put_cs("\r\n");
// Add message body // Add message body
...@@ -216,7 +215,7 @@ int http_codec::encode_request(const LibItsHttp__TypesAndValues::Request& p_requ ...@@ -216,7 +215,7 @@ int http_codec::encode_request(const LibItsHttp__TypesAndValues::Request& p_requ
if (_ec.is_content_length_present == 0x01) { if (_ec.is_content_length_present == 0x01) {
loggers::get_instance().log_msg("http_codec::encode_request: Add body ", os); loggers::get_instance().log_msg("http_codec::encode_request: Add body ", os);
p_encoding_buffer.put_os(os); p_encoding_buffer.put_os(os);
p_encoding_buffer.put_cs("\r\n"); //p_encoding_buffer.put_cs("\r\n");
} }
loggers::get_instance().log_to_hexa("<<< http_codec::encode_request: ", p_encoding_buffer); loggers::get_instance().log_to_hexa("<<< http_codec::encode_request: ", p_encoding_buffer);
...@@ -239,11 +238,11 @@ int http_codec::encode_response (const LibItsHttp__TypesAndValues::Response& p_r ...@@ -239,11 +238,11 @@ int http_codec::encode_response (const LibItsHttp__TypesAndValues::Response& p_r
} }
p_encoding_buffer.put_cs("\r\n"); p_encoding_buffer.put_cs("\r\n");
// Encode headers excepted the Content-Length // Encode headers excepeted the Content-Length
const LibItsHttp__TypesAndValues::HeaderLines& headers = p_response.header(); const LibItsHttp__TypesAndValues::Headers& headers = p_response.header();
std::string content_type; std::string content_type;
for (int i = 0; i < headers.size_of(); i++) { for (int i = 0; i < headers.size_of(); i++) {
const LibItsHttp__TypesAndValues::HeaderLine& header = headers[i]; const LibItsHttp__TypesAndValues::Header& header = headers[i];
loggers::get_instance().log_msg("http_codec::encode_response: Processing header ", header.header__name()); loggers::get_instance().log_msg("http_codec::encode_response: Processing header ", header.header__name());
p_encoding_buffer.put_cs(header.header__name()); p_encoding_buffer.put_cs(header.header__name());
p_encoding_buffer.put_cs(": "); p_encoding_buffer.put_cs(": ");
...@@ -256,7 +255,8 @@ int http_codec::encode_response (const LibItsHttp__TypesAndValues::Response& p_r ...@@ -256,7 +255,8 @@ int http_codec::encode_response (const LibItsHttp__TypesAndValues::Response& p_r
if (v.size_of() > 0) { if (v.size_of() > 0) {
loggers::get_instance().log_msg("http_codec::encode_response: Processing value ", v[0]); loggers::get_instance().log_msg("http_codec::encode_response: Processing value ", v[0]);
if (std::string(static_cast<const char*>(header.header__name())).compare("Content-Type") == 0) { // Store it for HTTP body payload encoding if (std::string(static_cast<const char*>(header.header__name())).compare("Content-Type") == 0) { // Store it for HTTP body payload encoding
int j = 1; loggers::get_instance().log("http_codec::encode_response: Storing Content-Type");
int j = 0;
while (j < v.size_of()) { while (j < v.size_of()) {
content_type += v[j++]; content_type += v[j++];
} // End of 'while' statement } // End of 'while' statement
...@@ -266,7 +266,7 @@ int http_codec::encode_response (const LibItsHttp__TypesAndValues::Response& p_r ...@@ -266,7 +266,7 @@ int http_codec::encode_response (const LibItsHttp__TypesAndValues::Response& p_r
while (j < v.size_of()) { while (j < v.size_of()) {
p_encoding_buffer.put_cs(", "); p_encoding_buffer.put_cs(", ");
loggers::get_instance().log_msg("http_codec::encode_response: Processing value ", v[j]); loggers::get_instance().log_msg("http_codec::encode_response: Processing value ", v[j]);
p_encoding_buffer.put_cs(v[j]); p_encoding_buffer.put_cs(v[j++]);
j += 1; j += 1;
} // End of 'while' statement } // End of 'while' statement
} }
...@@ -288,34 +288,39 @@ int http_codec::encode_response (const LibItsHttp__TypesAndValues::Response& p_r ...@@ -288,34 +288,39 @@ int http_codec::encode_response (const LibItsHttp__TypesAndValues::Response& p_r
_ec.length = os.lengthof(); _ec.length = os.lengthof();
_ec.is_content_length_present = 0x01; _ec.is_content_length_present = 0x01;
} }
loggers::get_instance().log("http_codec::encode_request: length=%d", _ec.length); loggers::get_instance().log("http_codec::encode_response: length=%d", _ec.length);
} else { } else {
loggers::get_instance().log("http_codec::encode_request: HTTP body field not present"); loggers::get_instance().log("http_codec::encode_response: HTTP body field not present");
_ec.length = 0; _ec.length = 0;
_ec.is_content_length_present = 0x00; _ec.is_content_length_present = 0x00;
} }
// Encode Content-Length header // Encode Content-Length header
p_encoding_buffer.put_cs("Content-Length: ");
if (_ec.length != 0) { if (_ec.length != 0) {
p_encoding_buffer.put_cs(int2str(_ec.length + 2/*Stand for the last CRLF*/)); loggers::get_instance().log("http_codec::encode_request: Content-Length: %s", static_cast<const char*>(int2str(_ec.length + 2/*Stand for the last CRLF*/)));
p_encoding_buffer.put_cs(static_cast<const char*>(int2str(_ec.length)));
_ec.is_content_length_present = 0x01; _ec.is_content_length_present = 0x01;
} else { } else {
p_encoding_buffer.put_cs("0"); p_encoding_buffer.put_cs("0");
_ec.is_content_length_present = 0x00; _ec.is_content_length_present = 0x00;
} }
loggers::get_instance().log("http_codec::encode_response: Content-Length: %d - %x", _ec.length, _ec.is_content_length_present); loggers::get_instance().log("http_codec::encode_request: Content-Length: %d - %x", _ec.length, _ec.is_content_length_present);
p_encoding_buffer.put_cs("\r\n"); p_encoding_buffer.put_cs("\r\n");
// Add message body
p_encoding_buffer.put_cs("\r\n"); p_encoding_buffer.put_cs("\r\n");
if (_ec.length != 0) { if (_ec.is_content_length_present == 0x01) {
loggers::get_instance().log_msg("http_codec::encode_request: Add body ", os);
p_encoding_buffer.put_os(os); p_encoding_buffer.put_os(os);
p_encoding_buffer.put_cs("\r\n"); // p_encoding_buffer.put_cs("\r\n");
} }
loggers::get_instance().log_to_hexa("<<< http_codec::encode_response: ", p_encoding_buffer);
return 0; return 0;
} }
int http_codec::decode_headers(TTCN_Buffer& decoding_buffer, LibItsHttp__TypesAndValues::HeaderLines& headers, std::string& p_content_type) { int http_codec::decode_headers(TTCN_Buffer& decoding_buffer, LibItsHttp__TypesAndValues::Headers& headers, std::string& p_content_type) {
loggers::get_instance().log(">>> http_codec::decode_headers"); loggers::get_instance().log(">>> http_codec::decode_headers");
loggers::get_instance().log_to_hexa("http_codec::decode_headers", decoding_buffer); loggers::get_instance().log_to_hexa("http_codec::decode_headers", decoding_buffer);
...@@ -325,7 +330,7 @@ int http_codec::decode_headers(TTCN_Buffer& decoding_buffer, LibItsHttp__TypesAn ...@@ -325,7 +330,7 @@ int http_codec::decode_headers(TTCN_Buffer& decoding_buffer, LibItsHttp__TypesAn
switch(get_line(decoding_buffer, cstr, true)) { switch(get_line(decoding_buffer, cstr, true)) {
case 0: { case 0: {
loggers::get_instance().log_msg("http_codec::decode_headers: ", cstr); loggers::get_instance().log_msg("http_codec::decode_headers: ", cstr);
LibItsHttp__TypesAndValues::HeaderLine header; LibItsHttp__TypesAndValues::Header header;
if (decode_header(cstr, header) == -1) { if (decode_header(cstr, header) == -1) {
loggers::get_instance().warning("http_codec::decode_headers: Failed to decode header %s", static_cast<const char*>(cstr)); loggers::get_instance().warning("http_codec::decode_headers: Failed to decode header %s", static_cast<const char*>(cstr));
return -1; return -1;
...@@ -351,7 +356,7 @@ int http_codec::decode_headers(TTCN_Buffer& decoding_buffer, LibItsHttp__TypesAn ...@@ -351,7 +356,7 @@ int http_codec::decode_headers(TTCN_Buffer& decoding_buffer, LibItsHttp__TypesAn
} // End of 'while' statement } // End of 'while' statement
} }
int http_codec::decode_header(CHARSTRING& header_line, LibItsHttp__TypesAndValues::HeaderLine& header) { int http_codec::decode_header(CHARSTRING& header_line, LibItsHttp__TypesAndValues::Header& header) {
loggers::get_instance().log_msg(">>> http_codec::decode_header", header_line); loggers::get_instance().log_msg(">>> http_codec::decode_header", header_line);
try { try {
...@@ -503,8 +508,8 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod ...@@ -503,8 +508,8 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod
OCTETSTRING s(decoding_buffer.get_len() - decoding_buffer.get_pos(), decoding_buffer.get_data() + decoding_buffer.get_pos()); OCTETSTRING s(decoding_buffer.get_len() - decoding_buffer.get_pos(), decoding_buffer.get_data() + decoding_buffer.get_pos());
loggers::get_instance().log_msg("http_codec::decode_body: raw body=", s); loggers::get_instance().log_msg("http_codec::decode_body: raw body=", s);
// Align the payload length with the specified Content-Length value // Align the payload length with the specified Content-Lenght value
loggers::get_instance().log("http_codec::decode_body: _dc.length=%d - body length=%d", _dc.length, s.lengthof()); loggers::get_instance().log("http_codec::decode_body: _dc.length=%d - body length=%d", _dc.length, s.lengthof());
OCTETSTRING body; OCTETSTRING body;
if (_dc.length != 0) { if (_dc.length != 0) {
...@@ -515,10 +520,11 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod ...@@ -515,10 +520,11 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod
body = OCTETSTRING(_dc.length, p); body = OCTETSTRING(_dc.length, p);
} }
} else { } else {
loggers::get_instance().warning("http_codec::decode_body: No Content-Length header, process all remaining bytes"); loggers::get_instance().warning("http_codec::decode_body: No Conten-Length header, process all remaining bytes");
body = s; body = s;
} }
loggers::get_instance().log_msg("http_codec::decode_body: Aligned body=", body); loggers::get_instance().log_msg("http_codec::decode_body: Aligned body=", body);
loggers::get_instance().log("http_codec::decode_body: body length=%d", body.lengthof());
// Remove CRLF if any // Remove CRLF if any
int counter = 0; int counter = 0;
if ((body[body.lengthof() - 1].get_octet() == 0x0d) || (body[body.lengthof() - 1].get_octet() == 0x0a)) { if ((body[body.lengthof() - 1].get_octet() == 0x0d) || (body[body.lengthof() - 1].get_octet() == 0x0a)) {
...@@ -528,10 +534,9 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod ...@@ -528,10 +534,9 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod
} }
} }
loggers::get_instance().log("http_codec::decode_body: counter=%d", counter); loggers::get_instance().log("http_codec::decode_body: counter=%d", counter);
loggers::get_instance().log("http_codec::decode_body: body length=%d", body.lengthof());
body = OCTETSTRING(body.lengthof() - counter, static_cast<const unsigned char*>(body)); body = OCTETSTRING(body.lengthof() - counter, static_cast<const unsigned char*>(body));
if (_dc.chunked) { if (_dc.chunked){
counter = 0; int counter = 0;
int prev = 0; int prev = 0;
OCTETSTRING os(0, nullptr); OCTETSTRING os(0, nullptr);
do { do {
...@@ -569,8 +574,8 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod ...@@ -569,8 +574,8 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod
} }
} while (counter < body.lengthof()); // Process next chunk if any } while (counter < body.lengthof()); // Process next chunk if any
body = os; body = os;
loggers::get_instance().log_msg("http_codec::decode_body: Finalised body=", body);
} }
loggers::get_instance().log_msg("http_codec::decode_body: Finalised body=", body);
// Check if HTTP message body contains binary characters // Check if HTTP message body contains binary characters
for (int i = 0; i < body.lengthof(); i++) { for (int i = 0; i < body.lengthof(); i++) {
unsigned char c = body[i].get_octet(); unsigned char c = body[i].get_octet();
...@@ -688,7 +693,7 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod ...@@ -688,7 +693,7 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod
LibItsHttp__MessageBodyTypes::HtmlBody html_body; LibItsHttp__MessageBodyTypes::HtmlBody html_body;
message_body.html__body() = CHARSTRING(body.lengthof(), (char*)static_cast<const unsigned char*>(body)); message_body.html__body() = CHARSTRING(body.lengthof(), (char*)static_cast<const unsigned char*>(body));
} else { } else {
loggers::get_instance().log("http_codec::decode_body: Use textBody as default"); loggers::get_instance().log("http_codec::decode_body: Use textBdy as default");
LibItsHttp__MessageBodyTypes::TextBody text_body; LibItsHttp__MessageBodyTypes::TextBody text_body;
message_body.text__body() = CHARSTRING(body.lengthof(), (char*)static_cast<const unsigned char*>(body)); message_body.text__body() = CHARSTRING(body.lengthof(), (char*)static_cast<const unsigned char*>(body));
} }
......
#pragma once #pragma once
#include <memory> #include <memory>
#include "codec.hh" #include "codec.hh"
#include "params.hh" #include "params.hh"
class Base_Type; class Base_Type;
class Record_Type; class Record_Type;
class TTCN_Typedescriptor_t; class TTCN_Typedescriptor_t;
class TTCN_Buffer; class TTCN_Buffer;
namespace LibItsHttp__TypesAndValues { namespace LibItsHttp__TypesAndValues {
class HttpMessage; class HttpMessage;
class Request; class Request;
class Response; class Response;
class HeaderLines; class Headers;
class HeaderLine; class Header;
} }
namespace LibItsHttp__MessageBodyTypes { namespace LibItsHttp__MessageBodyTypes {
class HttpMessageBody; class HttpMessageBody;
} }
struct encoding_context { struct encoding_context {
unsigned int length; unsigned int length;
unsigned char is_content_length_present; unsigned char is_content_length_present;
encoding_context() { reset(); }; encoding_context() { reset(); };
void reset() { length = -1; is_content_length_present = 0x00; }; void reset() { length = -1; is_content_length_present = 0x00; };
}; };
struct decoding_context { struct decoding_context {
unsigned int length; unsigned int length;
unsigned char is_binary; unsigned char is_binary;
bool chunked; bool chunked;
decoding_context() { reset(); }; decoding_context() { reset(); };
void reset() { length = -1; is_binary = 0x00; chunked = false; }; void reset() { length = -1; is_binary = 0x00; chunked = false; };
}; };
class http_codec: public codec < class http_codec: public codec <
LibItsHttp__TypesAndValues::HttpMessage, LibItsHttp__TypesAndValues::HttpMessage,
LibItsHttp__TypesAndValues::HttpMessage> LibItsHttp__TypesAndValues::HttpMessage>
{ {
encoding_context _ec; encoding_context _ec;
decoding_context _dc; decoding_context _dc;
std::map<std::string, std::unique_ptr<codec<Record_Type, Record_Type> > > _codecs; std::map<std::string, std::unique_ptr<codec<Record_Type, Record_Type> > > _codecs;
public: public:
explicit http_codec() : codec<LibItsHttp__TypesAndValues::HttpMessage, LibItsHttp__TypesAndValues::HttpMessage>(), _ec(), _dc(), _codecs() { }; explicit http_codec() : codec<LibItsHttp__TypesAndValues::HttpMessage, LibItsHttp__TypesAndValues::HttpMessage>(), _ec(), _dc(), _codecs() { };
virtual ~http_codec() { }; virtual ~http_codec() { };
virtual int encode (const LibItsHttp__TypesAndValues::HttpMessage&, OCTETSTRING& data); virtual int encode (const LibItsHttp__TypesAndValues::HttpMessage&, OCTETSTRING& data);
virtual int decode (const OCTETSTRING& data, LibItsHttp__TypesAndValues::HttpMessage&, params* params = NULL); virtual int decode (const OCTETSTRING& data, LibItsHttp__TypesAndValues::HttpMessage&, params* params = NULL);
void set_payload_codecs(const std::string& p_codecs); void set_payload_codecs(const std::string& p_codecs);
private: private:
int encode_request (const LibItsHttp__TypesAndValues::Request& p_request, TTCN_Buffer& p_encoding_buffer); int encode_request (const LibItsHttp__TypesAndValues::Request& p_request, TTCN_Buffer& p_encoding_buffer);
int encode_response (const LibItsHttp__TypesAndValues::Response& p_response, TTCN_Buffer& p_encoding_buffer); int encode_response (const LibItsHttp__TypesAndValues::Response& p_response, TTCN_Buffer& p_encoding_buffer);
int encode_body(const LibItsHttp__MessageBodyTypes::HttpMessageBody& p_message_body, OCTETSTRING& p_encoding_buffer, const std::string& p_content_type); int encode_body(const LibItsHttp__MessageBodyTypes::HttpMessageBody& p_message_body, OCTETSTRING& p_encoding_buffer, const std::string& p_content_type);
int decode_headers(TTCN_Buffer& decoding_buffer, LibItsHttp__TypesAndValues::HeaderLines& headers, std::string& p_content_type); int decode_headers(TTCN_Buffer& decoding_buffer, LibItsHttp__TypesAndValues::Headers& headers, std::string& p_content_type);
int decode_header(CHARSTRING& header_line, LibItsHttp__TypesAndValues::HeaderLine& header); int decode_header(CHARSTRING& header_line, LibItsHttp__TypesAndValues::Header& header);
int decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBodyTypes::HttpMessageBody& message_body, const std::string& p_content_type); int decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBodyTypes::HttpMessageBody& message_body, const std::string& p_content_type);
int get_line(TTCN_Buffer& buffer, CHARSTRING& to, const bool concatenate_header_lines = false); int get_line(TTCN_Buffer& buffer, CHARSTRING& to, const bool concatenate_header_lines = false);
}; // End of class http_codec }; // End of class http_codec
#!/bin/bash
# Turn on debug mode
#set -vx
#set -e
# Colors and Prompt
#export PS1="\w\$ "
#export PS1="\D{%Y-%m-%d %H:%M:%S} \w\n\$ "
export EDITOR=emacs
set -o emacs
# Home working directories
export HOME_FRAMEWORKS=${HOME}/frameworks
export HOME_LIB=${HOME}/lib
export HOME_BIN=${HOME}/bin
export HOME_ETC=${HOME}/etc
export HOME_TMP=${HOME}/tmp
export HOME_DOCS=${HOME}/docs
# Home common include directory
export HOME_INC=${HOME}/include
# Update PATH environment variable
export PATH=${HOME_BIN}:${PATH}
# Update LD_LIBRARY_PATH environment variable
if [ -z "${LD_LIBRARY_PATH}" ]
then
export LD_LIBRARY_PATH=${HOME_LIB}:/usr/local/lib:${HOME}/dev/etsi_its/lib
else
export LD_LIBRARY_PATH=${HOME_LIB}:/usr/local/lib:${HOME}/dev/etsi_its/lib:${LD_LIBRARY_PATH}
fi
# Add JAVA support
#export JAVA_VERSION=1.8.0_92
#export JAVA_JDK=jdk${JAVA_VERSION}
#if [ -d "${HOME_FRAMEWORKS}/${JAVA_JDK}" ]
#then
# export JAVA_HOME=${HOME_FRAMEWORKS}/${JAVA_JDK}/bin
#else
# unset JAVA_VERSION
# unset JAVA_JDK
#fi
# Add TITAN support
export TOP=${HOME_FRAMEWORKS}/titan/titan.core
export TTCN3_DIR=${TOP}/Install
if [ -d ${TTCN3_DIR} ]
then
export TTCN3_BROWSER=mozilla
export PATH=${TTCN3_DIR}/bin:${PATH}
export LD_LIBRARY_PATH=${TTCN3_DIR}/lib:${LD_LIBRARY_PATH}
export MANPATH=${TTCN3_DIR}/man:${MANPATH}
export TTCN3_LICENSE_FILE=${TTCN3_DIR}/etc/license/license.dat
export PATH_DEV_TTCN=${HOME}/dev/ttcn3
# ITS support
export PATH_DEV_ITS=${HOME}/dev/etsi_its
# Emergency Communication support
export PATH_DEV_EMCOM=${HOME}/dev/etsi_emcom
# Mobile-Edge Computing support
export PATH_DEV_MEC=${HOME}/dev/etsi_mec
# Validation folder
export VALIDATION_DIR=${HOME}
fi
export BROWSER=netsurf
export OPENSSL_DIR=/usr/local
export LSAN_OPTIONS=verbosity=1:log_threads=1
...@@ -4,7 +4,7 @@ set -vx ...@@ -4,7 +4,7 @@ set -vx
function f_exit { function f_exit {
cd ${CURPWD} cd ${CURPWD}
unset TTCN_FILES unset TTCN_FILES
unset CC_FILES unset CC_FILES
unset CFG_FILES unset CFG_FILES
...@@ -52,7 +52,7 @@ find .. -type f -name "*.bak" -exec rm {} \; ...@@ -52,7 +52,7 @@ find .. -type f -name "*.bak" -exec rm {} \;
find .. -type f -name "*.log" -exec rm {} \; find .. -type f -name "*.log" -exec rm {} \;
# Build JSON files if any and put them in objs directory # Build JSON files if any and put them in objs directory
REFERENCES="LibCommon LibHttp LibMec LibMec/LocationAPI LibMec/RnisAPI LibMec/UEidentityAPI LibMec/BwManagementAPI" REFERENCES="LibCommon LibHttp LibMec LibMec/LocationAPI LibMec/UEidentityAPI LibMec/RnisAPI LibMec/BwManagementAPI LibMec/Ams LibMec/AppEna LibMec/AppLCM LibMec/Grant LibMec/FixedAccessInformationAPI LibMec/MeoPkgm LibMec/MepmPkgm LibMec/UEAppInterfaceAPI LibMec/UEidentityAPI"
for i in ${REFERENCES} for i in ${REFERENCES}
do do
# TTCN code # TTCN code
......
...@@ -158,7 +158,7 @@ done ...@@ -158,7 +158,7 @@ done
echo 'Update TTCN-3 files' echo 'Update TTCN-3 files'
TTCN_3_ORG_PATH=${SRC_MEC_PATH}/ttcn TTCN_3_ORG_PATH=${SRC_MEC_PATH}/ttcn
TTCN_3_DST_PATH=${PATH_DEV_MEC}/src TTCN_3_DST_PATH=${PATH_DEV_MEC}/src
TTCN_3_ATS_LIST='AtsNg112 LibMec LibMec/LocationAPI LibMec/UEidentityAPI LibMec/RnisAPI LibMec/BwManagementAPI LibHttp LibCommon' TTCN_3_ATS_LIST='AtsMec LibMec LibMec/LocationAPI LibMec/UEidentityAPI LibMec/RnisAPI LibMec/BwManagementAPI LibHttp LibCommon'
for i in ${TTCN_3_ATS_LIST} for i in ${TTCN_3_ATS_LIST}
do do
# TTCN-3 files # TTCN-3 files
...@@ -208,7 +208,7 @@ do ...@@ -208,7 +208,7 @@ do
fi fi
done done
TTCN_3_LIB_LIST='TestCodec' TTCN_3_LIB_LIST='AtsMec'
for i in ${TTCN_3_LIB_LIST} for i in ${TTCN_3_LIB_LIST}
do do
LIST_TTCN_FILES=`find ${TTCN_3_ORG_PATH}/$i -name "*.ttcn" -type f` LIST_TTCN_FILES=`find ${TTCN_3_ORG_PATH}/$i -name "*.ttcn" -type f`
......
...@@ -106,7 +106,7 @@ echo 'Update TTCN-3 files' ...@@ -106,7 +106,7 @@ echo 'Update TTCN-3 files'
TTCN_3_ORG_PATH=${SRC_MEC_PATH}/ttcn TTCN_3_ORG_PATH=${SRC_MEC_PATH}/ttcn
TTCN_3_DST_PATH=${PATH_DEV_MEC}/src TTCN_3_DST_PATH=${PATH_DEV_MEC}/src
CC_SRC_PATH=${SRC_MEC_PATH}/ccsrc CC_SRC_PATH=${SRC_MEC_PATH}/ccsrc
TTCN_3_ATS_LIST='AtsMec TestCodec' TTCN_3_ATS_LIST='AtsMec'
for i in ${TTCN_3_ATS_LIST} for i in ${TTCN_3_ATS_LIST}
do do