Commit c5ace61c authored by garciay's avatar garciay
Browse files

Add ITS HTTP support

parent 87c716f0
#include <asn1/asn_application.h> #include <asn1/asn_application.h>
#include "ASN1RecodePer.hh" #include "asn1_recode_per.hh"
#include <TTCN3.hh> #include <TTCN3.hh>
...@@ -13,7 +13,7 @@ extern "C" { ...@@ -13,7 +13,7 @@ extern "C" {
} }
} }
int ASN1RecodePer::recode(const asn_TYPE_descriptor_s & td, int from, int to, TTCN_Buffer & buf) int asn1_recode_per::recode(const asn_TYPE_descriptor_s & td, int from, int to, TTCN_Buffer & buf)
{ {
int rc = -1; int rc = -1;
void * ptr = NULL; void * ptr = NULL;
...@@ -32,12 +32,12 @@ int ASN1RecodePer::recode(const asn_TYPE_descriptor_s & td, int from, int to, TT ...@@ -32,12 +32,12 @@ int ASN1RecodePer::recode(const asn_TYPE_descriptor_s & td, int from, int to, TT
return rc; return rc;
} }
int ASN1RecodePer::ber2per(const asn_TYPE_descriptor_s & td, TTCN_Buffer & buf) int asn1_recode_per::ber2per(const asn_TYPE_descriptor_s & td, TTCN_Buffer & buf)
{ {
return recode(td, (int)ATS_BER, (int)ATS_UNALIGNED_CANONICAL_PER, buf); return recode(td, (int)ATS_BER, (int)ATS_UNALIGNED_CANONICAL_PER, buf);
} }
int ASN1RecodePer::per2ber(const asn_TYPE_descriptor_s & td, TTCN_Buffer & buf) int asn1_recode_per::per2ber(const asn_TYPE_descriptor_s & td, TTCN_Buffer & buf)
{ {
return recode(td, (int)ATS_UNALIGNED_BASIC_PER, (int)ATS_DER, buf); return recode(td, (int)ATS_UNALIGNED_BASIC_PER, (int)ATS_DER, buf);
} }
......
...@@ -17,7 +17,7 @@ namespace LibItsCommon__Functions ...@@ -17,7 +17,7 @@ namespace LibItsCommon__Functions
*/ */
INTEGER fx__getCurrentTime( INTEGER fx__getCurrentTime(
) { ) {
unsigned long long ms = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count() - 1072911600000L; // TODO Add a global method such as its_tme() & its_time_mod() beacuse it is used also in GeoNetworkingLayer unsigned long long ms = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count() - 1072911600000L; // TODO Add a global method such as its_tme() & its_time_mod() beacuse it is used also in geonetworking_layer
/*unsigned long long its_ref_time = 1072911600000L; /*unsigned long long its_ref_time = 1072911600000L;
struct timeval tv; struct timeval tv;
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#include "sha256.hh" #include "sha256.hh"
#include "sha384.hh" #include "sha384.hh"
#include "ec_keys.hh" #include "security_ecc.hh"
#include "security_services.hh" #include "security_services.hh"
...@@ -67,7 +67,7 @@ namespace LibItsSecurity__Functions ...@@ -67,7 +67,7 @@ namespace LibItsSecurity__Functions
hash.generate(tbs, hashData); hash.generate(tbs, hashData);
// Calculate the signature // Calculate the signature
std::vector<unsigned char> p_key(static_cast<const unsigned char *>(p__privateKey), static_cast<const unsigned char *>(p__privateKey) + p__privateKey.lengthof()); std::vector<unsigned char> p_key(static_cast<const unsigned char *>(p__privateKey), static_cast<const unsigned char *>(p__privateKey) + p__privateKey.lengthof());
ec_keys k(ec_elliptic_curves::nist_p_256, p_key); security_ecc k(ec_elliptic_curves::nist_p_256, p_key);
std::vector<unsigned char> r_sig; std::vector<unsigned char> r_sig;
std::vector<unsigned char> s_sig; std::vector<unsigned char> s_sig;
if (k.sign(hashData, r_sig, s_sig) == 0) { if (k.sign(hashData, r_sig, s_sig) == 0) {
...@@ -101,7 +101,7 @@ namespace LibItsSecurity__Functions ...@@ -101,7 +101,7 @@ namespace LibItsSecurity__Functions
hash.generate(tbs, hashData); hash.generate(tbs, hashData);
// Calculate the signature // Calculate the signature
std::vector<unsigned char> p_key(static_cast<const unsigned char *>(p__privateKey), static_cast<const unsigned char *>(p__privateKey) + p__privateKey.lengthof()); std::vector<unsigned char> p_key(static_cast<const unsigned char *>(p__privateKey), static_cast<const unsigned char *>(p__privateKey) + p__privateKey.lengthof());
ec_keys k(ec_elliptic_curves::brainpool_p_256_r1, p_key); security_ecc k(ec_elliptic_curves::brainpool_p_256_r1, p_key);
std::vector<unsigned char> r_sig; std::vector<unsigned char> r_sig;
std::vector<unsigned char> s_sig; std::vector<unsigned char> s_sig;
if (k.sign(hashData, r_sig, s_sig) == 0) { if (k.sign(hashData, r_sig, s_sig) == 0) {
...@@ -135,7 +135,7 @@ namespace LibItsSecurity__Functions ...@@ -135,7 +135,7 @@ namespace LibItsSecurity__Functions
hash.generate(tbs, hashData); hash.generate(tbs, hashData);
// Calculate the signature // Calculate the signature
std::vector<unsigned char> p_key(static_cast<const unsigned char *>(p__privateKey), static_cast<const unsigned char *>(p__privateKey) + p__privateKey.lengthof()); std::vector<unsigned char> p_key(static_cast<const unsigned char *>(p__privateKey), static_cast<const unsigned char *>(p__privateKey) + p__privateKey.lengthof());
ec_keys k(ec_elliptic_curves::brainpool_p_384_r1, p_key); security_ecc k(ec_elliptic_curves::brainpool_p_384_r1, p_key);
std::vector<unsigned char> r_sig; std::vector<unsigned char> r_sig;
std::vector<unsigned char> s_sig; std::vector<unsigned char> s_sig;
if (k.sign(hashData, r_sig, s_sig) == 0) { if (k.sign(hashData, r_sig, s_sig) == 0) {
...@@ -175,7 +175,7 @@ namespace LibItsSecurity__Functions ...@@ -175,7 +175,7 @@ namespace LibItsSecurity__Functions
std::vector<unsigned char> signature(static_cast<const unsigned char *>(p__signature), static_cast<const unsigned char *>(p__signature) + p__signature.lengthof()); std::vector<unsigned char> signature(static_cast<const unsigned char *>(p__signature), static_cast<const unsigned char *>(p__signature) + p__signature.lengthof());
std::vector<unsigned char> pub_key_x(static_cast<const unsigned char *>(p__ecdsaNistp256PublicKeyX), static_cast<const unsigned char *>(p__ecdsaNistp256PublicKeyX) + p__ecdsaNistp256PublicKeyX.lengthof()); std::vector<unsigned char> pub_key_x(static_cast<const unsigned char *>(p__ecdsaNistp256PublicKeyX), static_cast<const unsigned char *>(p__ecdsaNistp256PublicKeyX) + p__ecdsaNistp256PublicKeyX.lengthof());
std::vector<unsigned char> pub_key_y(static_cast<const unsigned char *>(p__ecdsaNistp256PublicKeyY), static_cast<const unsigned char *>(p__ecdsaNistp256PublicKeyY) + p__ecdsaNistp256PublicKeyY.lengthof()); std::vector<unsigned char> pub_key_y(static_cast<const unsigned char *>(p__ecdsaNistp256PublicKeyY), static_cast<const unsigned char *>(p__ecdsaNistp256PublicKeyY) + p__ecdsaNistp256PublicKeyY.lengthof());
ec_keys k(ec_elliptic_curves::nist_p_256, pub_key_x, pub_key_y); security_ecc k(ec_elliptic_curves::nist_p_256, pub_key_x, pub_key_y);
if (k.sign_verif(hashData, signature) == 0) { if (k.sign_verif(hashData, signature) == 0) {
return TRUE; return TRUE;
} }
...@@ -208,7 +208,7 @@ namespace LibItsSecurity__Functions ...@@ -208,7 +208,7 @@ namespace LibItsSecurity__Functions
std::vector<unsigned char> signature(static_cast<const unsigned char *>(p__signature), static_cast<const unsigned char *>(p__signature) + p__signature.lengthof()); std::vector<unsigned char> signature(static_cast<const unsigned char *>(p__signature), static_cast<const unsigned char *>(p__signature) + p__signature.lengthof());
std::vector<unsigned char> pub_key_x(static_cast<const unsigned char *>(p__ecdsaBrainpoolp256PublicKeyX), static_cast<const unsigned char *>(p__ecdsaBrainpoolp256PublicKeyX) + p__ecdsaBrainpoolp256PublicKeyX.lengthof()); std::vector<unsigned char> pub_key_x(static_cast<const unsigned char *>(p__ecdsaBrainpoolp256PublicKeyX), static_cast<const unsigned char *>(p__ecdsaBrainpoolp256PublicKeyX) + p__ecdsaBrainpoolp256PublicKeyX.lengthof());
std::vector<unsigned char> pub_key_y(static_cast<const unsigned char *>(p__ecdsaBrainpoolp256PublicKeyY), static_cast<const unsigned char *>(p__ecdsaBrainpoolp256PublicKeyY) + p__ecdsaBrainpoolp256PublicKeyY.lengthof()); std::vector<unsigned char> pub_key_y(static_cast<const unsigned char *>(p__ecdsaBrainpoolp256PublicKeyY), static_cast<const unsigned char *>(p__ecdsaBrainpoolp256PublicKeyY) + p__ecdsaBrainpoolp256PublicKeyY.lengthof());
ec_keys k(ec_elliptic_curves::brainpool_p_256_r1, pub_key_x, pub_key_y); security_ecc k(ec_elliptic_curves::brainpool_p_256_r1, pub_key_x, pub_key_y);
if (k.sign_verif(hashData, signature) == 0) { if (k.sign_verif(hashData, signature) == 0) {
return TRUE; return TRUE;
} }
...@@ -241,7 +241,7 @@ namespace LibItsSecurity__Functions ...@@ -241,7 +241,7 @@ namespace LibItsSecurity__Functions
std::vector<unsigned char> signature(static_cast<const unsigned char *>(p__signature), static_cast<const unsigned char *>(p__signature) + p__signature.lengthof()); std::vector<unsigned char> signature(static_cast<const unsigned char *>(p__signature), static_cast<const unsigned char *>(p__signature) + p__signature.lengthof());
std::vector<unsigned char> pub_key_x(static_cast<const unsigned char *>(p__ecdsaBrainpoolp384PublicKeyX), static_cast<const unsigned char *>(p__ecdsaBrainpoolp384PublicKeyX) + p__ecdsaBrainpoolp384PublicKeyX.lengthof()); std::vector<unsigned char> pub_key_x(static_cast<const unsigned char *>(p__ecdsaBrainpoolp384PublicKeyX), static_cast<const unsigned char *>(p__ecdsaBrainpoolp384PublicKeyX) + p__ecdsaBrainpoolp384PublicKeyX.lengthof());
std::vector<unsigned char> pub_key_y(static_cast<const unsigned char *>(p__ecdsaBrainpoolp384PublicKeyY), static_cast<const unsigned char *>(p__ecdsaBrainpoolp384PublicKeyY) + p__ecdsaBrainpoolp384PublicKeyY.lengthof()); std::vector<unsigned char> pub_key_y(static_cast<const unsigned char *>(p__ecdsaBrainpoolp384PublicKeyY), static_cast<const unsigned char *>(p__ecdsaBrainpoolp384PublicKeyY) + p__ecdsaBrainpoolp384PublicKeyY.lengthof());
ec_keys k(ec_elliptic_curves::brainpool_p_384_r1, pub_key_x, pub_key_y); security_ecc k(ec_elliptic_curves::brainpool_p_384_r1, pub_key_x, pub_key_y);
if (k.sign_verif(hashData, signature) == 0) { if (k.sign_verif(hashData, signature) == 0) {
return TRUE; return TRUE;
} }
...@@ -255,7 +255,7 @@ namespace LibItsSecurity__Functions ...@@ -255,7 +255,7 @@ namespace LibItsSecurity__Functions
loggers::get_instance().log_msg(">>> fx__encryptWithEciesNistp256WithSha256: ", p__peerPublicKeyX); loggers::get_instance().log_msg(">>> fx__encryptWithEciesNistp256WithSha256: ", p__peerPublicKeyX);
loggers::get_instance().log_msg(">>> fx__encryptWithEciesNistp256WithSha256: ", p__publicEncKeyY); loggers::get_instance().log_msg(">>> fx__encryptWithEciesNistp256WithSha256: ", p__publicEncKeyY);
ec_keys ec(ec_elliptic_curves::nist_p_256); security_ecc ec(ec_elliptic_curves::nist_p_256);
std::vector<unsigned char> peer_public_key_x(static_cast<const unsigned char *>(p__peerPublicKeyX), p__peerPublicKeyX.lengthof() + static_cast<const unsigned char *>(p__peerPublicKeyX)); std::vector<unsigned char> peer_public_key_x(static_cast<const unsigned char *>(p__peerPublicKeyX), p__peerPublicKeyX.lengthof() + static_cast<const unsigned char *>(p__peerPublicKeyX));
std::vector<unsigned char> peer_public_key_y(static_cast<const unsigned char *>(p__publicEncKeyY), p__publicEncKeyY.lengthof() + static_cast<const unsigned char *>(p__publicEncKeyY)); std::vector<unsigned char> peer_public_key_y(static_cast<const unsigned char *>(p__publicEncKeyY), p__publicEncKeyY.lengthof() + static_cast<const unsigned char *>(p__publicEncKeyY));
int unused = 0; int unused = 0;
...@@ -317,7 +317,7 @@ namespace LibItsSecurity__Functions ...@@ -317,7 +317,7 @@ namespace LibItsSecurity__Functions
OCTETSTRING& p__publicKeyX, OCTETSTRING& p__publicKeyX,
OCTETSTRING& p__publicKeyY OCTETSTRING& p__publicKeyY
) { ) {
ec_keys k(ec_elliptic_curves::nist_p_256); security_ecc k(ec_elliptic_curves::nist_p_256);
if (k.generate() != 0) { if (k.generate() != 0) {
p__privateKey = OCTETSTRING(); p__privateKey = OCTETSTRING();
p__publicKeyX = OCTETSTRING(); p__publicKeyX = OCTETSTRING();
...@@ -357,7 +357,7 @@ namespace LibItsSecurity__Functions ...@@ -357,7 +357,7 @@ namespace LibItsSecurity__Functions
OCTETSTRING& p__publicKeyX, OCTETSTRING& p__publicKeyX,
OCTETSTRING& p__publicKeyY OCTETSTRING& p__publicKeyY
) { ) {
ec_keys k(ec_elliptic_curves::brainpool_p_256_r1); security_ecc k(ec_elliptic_curves::brainpool_p_256_r1);
if (k.generate() != 0) { if (k.generate() != 0) {
p__privateKey = OCTETSTRING(); p__privateKey = OCTETSTRING();
p__publicKeyX = OCTETSTRING(); p__publicKeyX = OCTETSTRING();
...@@ -398,7 +398,7 @@ namespace LibItsSecurity__Functions ...@@ -398,7 +398,7 @@ namespace LibItsSecurity__Functions
OCTETSTRING& p__publicKeyX, OCTETSTRING& p__publicKeyX,
OCTETSTRING& p__publicKeyY OCTETSTRING& p__publicKeyY
) { ) {
ec_keys k(ec_elliptic_curves::brainpool_p_384_r1); security_ecc k(ec_elliptic_curves::brainpool_p_384_r1);
if (k.generate() != 0) { if (k.generate() != 0) {
p__privateKey = OCTETSTRING(); p__privateKey = OCTETSTRING();
p__publicKeyX = OCTETSTRING(); p__publicKeyX = OCTETSTRING();
......
...@@ -34,7 +34,7 @@ public: //! \publicsection ...@@ -34,7 +34,7 @@ public: //! \publicsection
* \brief Default constructor * \brief Default constructor
* \todo Remove logs * \todo Remove logs
*/ */
Codec() : _params(nullptr) { }; explicit Codec() : _params(nullptr) { };
/*! /*!
* \fn ~Codec(); * \fn ~Codec();
* \brief Default destructor * \brief Default destructor
......
...@@ -33,22 +33,22 @@ class Layer { ...@@ -33,22 +33,22 @@ class Layer {
protected: protected:
std::string type; //! Type description, it indicates the protocol type (e.g. CAM, DENM, GN, ETH, PCAP...) std::string type; //! Type description, it indicates the protocol type (e.g. CAM, DENM, GN, ETH, PCAP...)
public: public: //! \publicsection
/*! /*!
* \brief Default constructor * \brief Default constructor
* Create a new instance of the Layer class * Create a new instance of the Layer class
* \todo Remove logs * \todo Remove logs
*/ */
Layer() : upperLayers(), lowerLayers(), type(std::string("")) { }; explicit Layer() : upperLayers(), lowerLayers(), type(std::string("")) { };
/*! /*!
* \brief Specialized constructor * \brief Specialized constructor
* Create a new instance of the Layer class with its type description * Create a new instance of the Layer class with its type description
* \remark This constructor is called by the Layer factory * \remark This constructor is called by the Layer factory
* \see LayerFactory * \see layer_factory
* \todo Remove logs * \todo Remove logs
*/ */
Layer(const std::string& p_type) : upperLayers(), lowerLayers(), type(std::string(p_type.begin(), p_type.end())) { }; explicit Layer(const std::string& p_type) : upperLayers(), lowerLayers(), type(std::string(p_type.begin(), p_type.end())) { };
/*! /*!
* \brief Default destructor * \brief Default destructor
...@@ -113,17 +113,6 @@ public: //! \publicsection ...@@ -113,17 +113,6 @@ public: //! \publicsection
*/ */
virtual void receiveData(OCTETSTRING& p_data, Params& p_params) { } virtual void receiveData(OCTETSTRING& p_data, Params& p_params) { }
/*!
* \virtual
* \fn OCTETSTRING trigger_ac_event(OCTETSTRING& data, Params& params);
* \brief TODO
* \param[in] p_data
* \param[in] p_params
* \todo Remove the logs
* \virtual
*/
//virtual OCTETSTRING trigger_ac_event(OCTETSTRING& p_data, Params& p_params) { return int2oct(0, 2); }
/*! /*!
* \inline * \inline
* \fn const std::string& to_string(); * \fn const std::string& to_string();
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
*/ */
class Params : public std::map<std::string, std::string> { class Params : public std::map<std::string, std::string> {
public: //! \publicsection public: //! \publicsection
// TODO Use static constexpr (see CommsigniaLayer.hh) // TODO Use static constexpr (see commsignia_layer.hh)
static const std::string& debug; //! Set to 1 to enable the debug mode static const std::string& debug; //! Set to 1 to enable the debug mode
static const std::string& loopback; static const std::string& loopback;
...@@ -88,7 +88,7 @@ public: //! \publicsection ...@@ -88,7 +88,7 @@ public: //! \publicsection
* Clone an existing instance of a Params object * Clone an existing instance of a Params object
* \param[in] p_params An existing instance of a Params object * \param[in] p_params An existing instance of a Params object
*/ */
Params(const Params& p_params) : std::map<std::string, std::string>(p_params.begin(), p_params.end()) {}; explicit Params(const Params& p_params) : std::map<std::string, std::string>(p_params.begin(), p_params.end()) { };
/*! /*!
* \brief Default destructor * \brief Default destructor
......
...@@ -19,8 +19,8 @@ template <typename TPort> class TLayer : public Layer { ...@@ -19,8 +19,8 @@ template <typename TPort> class TLayer : public Layer {
TPortList upperPorts; TPortList upperPorts;
public: public:
TLayer() : Layer(), upperPorts() { }; explicit TLayer() : Layer(), upperPorts() { };
TLayer(const std::string& p_type) : Layer(p_type), upperPorts() { }; explicit TLayer(const std::string& p_type) : Layer(p_type), upperPorts() { };
void addUpperPort(TPort * p_port) { upperPorts.push_back(p_port); }; void addUpperPort(TPort * p_port) { upperPorts.push_back(p_port); };
void removeUpperPort(TPort*); void removeUpperPort(TPort*);
......
...@@ -21,11 +21,11 @@ class TTCN_Typedescriptor_t; //! Forward declaration of TITAN class ...@@ -21,11 +21,11 @@ class TTCN_Typedescriptor_t; //! Forward declaration of TITAN class
struct asn_TYPE_descriptor_s; //! Forward declaration of asn1c class struct asn_TYPE_descriptor_s; //! Forward declaration of asn1c class
class ASN1RecodePer class asn1_recode_per
{ {
protected: protected:
int ber2per (const asn_TYPE_descriptor_s & td, TTCN_Buffer & buf); int ber2per (const asn_TYPE_descriptor_s & td, TTCN_Buffer & buf);
int per2ber (const asn_TYPE_descriptor_s & td, TTCN_Buffer & buf); int per2ber (const asn_TYPE_descriptor_s & td, TTCN_Buffer & buf);
int recode (const asn_TYPE_descriptor_s & td, int from, int to, TTCN_Buffer & buf); int recode (const asn_TYPE_descriptor_s & td, int from, int to, TTCN_Buffer & buf);
}; // End of class ASN1RecodePer }; // End of class asn1_recode_per
...@@ -18,17 +18,17 @@ ...@@ -18,17 +18,17 @@
#include "Layer.hh" #include "Layer.hh"
/*! /*!
* \class Layerfactory * \class layer_factory
* \brief This class provides a factory class to create Layer class instances * \brief This class provides a factory class to create Layer class instances
* \abstract * \abstract
*/ */
class LayerFactory { class layer_factory {
public: //! \publicsection public: //! \publicsection
/*! /*!
* \fn Codec(); * \fn Codec();
* \brief Default constructor * \brief Default constructor
*/ */
LayerFactory() {}; layer_factory() {};
/*! /*!
* \fn Layer * create_layer(const std::string & type, const std::string & param); * \fn Layer * create_layer(const std::string & type, const std::string & param);
* \brief Create the layers stack based on the provided layers stack description (cf. remark) * \brief Create the layers stack based on the provided layers stack description (cf. remark)
...@@ -110,5 +110,5 @@ NodeC.geoNetworkingPort.params := "GN(ll_address=70b3d5791b48,latitude=43551050, ...@@ -110,5 +110,5 @@ NodeC.geoNetworkingPort.params := "GN(ll_address=70b3d5791b48,latitude=43551050,
* \pure * \pure
*/ */
virtual Layer* create_layer(const std::string & p_type, const std::string & p_params) = 0; virtual Layer* create_layer(const std::string & p_type, const std::string & p_params) = 0;
}; // End of class LayerFactory }; // End of class layer_factory
/*! /*!
* \file LayerStackBuilder.hh * \file layer_stack_builder.hh
* \brief Header file for ITS protocol stack builder. * \brief Header file for ITS protocol stack builder.
* \author ETSI STF525 * \author ETSI STF525
* \copyright ETSI Copyright Notification * \copyright ETSI Copyright Notification
...@@ -10,50 +10,50 @@ ...@@ -10,50 +10,50 @@
*/ */
#pragma once #pragma once
#include "LayerFactory.hh" #include "layer_factory.hh"
/*! /*!
* \class LayerStackBuilder * \class layer_stack_builder
* \brief This class provides a factory class to create Layer class instances * \brief This class provides a factory class to create Layer class instances
*/ */
class LayerStackBuilder { class layer_stack_builder {
private: //! \privatesection private: //! \privatesection
typedef std::map<std::string, LayerFactory*> LayerFactoryMap; typedef std::map<std::string, layer_factory*> LayerFactoryMap;
static LayerStackBuilder * _instance; //! Smart pointer to the unique instance of the logger framework static layer_stack_builder * _instance; //! Smart pointer to the unique instance of the logger framework
std::map<std::string, LayerFactory*> _layer_factories; //! The list of the registered \see TLayer factories std::map<std::string, layer_factory*> _layer_factories; //! The list of the registered \see TLayer factories
/*! /*!
* \brief Default constructor * \brief Default constructor
* Create a new instance of the LayerStackBuilder class * Create a new instance of the layer_stack_builder class
* \private * \private
*/ */
LayerStackBuilder(); // can not be created manually layer_stack_builder(); // can not be created manually
public: //! \publicsection public: //! \publicsection
/*! /*!
* \fn LayerStackBuilder* get_instance(); * \fn layer_stack_builder* get_instance();
* \brief Accessor for the unique instance of the logger framework * \brief Accessor for the unique instance of the logger framework
* \static * \static
*/ */
static LayerStackBuilder* get_instance(); static layer_stack_builder* get_instance();
/*! /*!
* \fn void register_layer_factory(const std::string & p_type, LayerFactory* p_layer_factory); * \fn void register_layer_factory(const std::string & p_type, layer_factory* p_layer_factory);
* \brief Add a new layer factory * \brief Add a new layer factory
* \param[in] p_type The layer identifier (e.g. GN for the GeoNetworking layer...) * \param[in] p_type The layer identifier (e.g. GN for the GeoNetworking layer...)
* \param[in] p_layer_factory A reference to the \see LayerFactory * \param[in] p_layer_factory A reference to the \see layer_factory
* \static * \static
*/ */
static void register_layer_factory(const std::string & p_type, LayerFactory* p_layer_factory); static void register_layer_factory(const std::string & p_type, layer_factory* p_layer_factory);
private: //! \privatesection private: //! \privatesection
/*! /*!
* \fn void _register_layer_factory(const std::string & p_type, LayerFactory* p_layer_factory); * \fn void _register_layer_factory(const std::string & p_type, layer_factory* p_layer_factory);
* \brief Add a new layer factory * \brief Add a new layer factory
* \param[in] p_type The layer identifier (e.g. GN for the GeoNetworking layer...) * \param[in] p_type The layer identifier (e.g. GN for the GeoNetworking layer...)
* \param[in] p_layer_factory A reference to the \see LayerFactory * \param[in] p_layer_factory A reference to the \see layer_factory
*/ */
void _register_layer_factory(const std::string & p_type, LayerFactory* p_layer_factory); void _register_layer_factory(const std::string & p_type, layer_factory* p_layer_factory);
public: //! \publicsection public: //! \publicsection
/*! /*!
...@@ -63,5 +63,5 @@ public: //! \publicsection ...@@ -63,5 +63,5 @@ public: //! \publicsection
* \return The created layer object on success, nullptr otherwise * \return The created layer object on success, nullptr otherwise
*/ */
Layer* create_layer_stack(const char* p_layer_stack_description); Layer* create_layer_stack(const char* p_layer_stack_description);
}; // End of class LayerStackBuilder }; // End of class layer_stack_builder
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#pragma once #pragma once
#include "Params.hh" #include "Params.hh"
#include "ASN1RecodePer.hh" #include "asn1_recode_per.hh"
class BITSTRING; //! Forward declaration of TITAN class class BITSTRING; //! Forward declaration of TITAN class
class TTCN_Typedescriptor_t; //! Forward declaration of TITAN class class TTCN_Typedescriptor_t; //! Forward declaration of TITAN class
...@@ -19,12 +19,12 @@ class TTCN_Typedescriptor_t; //! Forward declaration of TITAN class ...@@ -19,12 +19,12 @@ class TTCN_Typedescriptor_t; //! Forward declaration of TITAN class
struct asn_TYPE_descriptor_s; //! Declare asn1c class struct asn_TYPE_descriptor_s; //! Declare asn1c class
/*! /*!
* \class PERCodec * \class per_code
* \brief This class This class provides the interface for all ASN.1 PER codecs. * \brief This class This class provides the interface for all ASN.1 PER codecs.
* \remark This class uses asn1c external tool * \remark This class uses asn1c external tool
*/ */
template<typename TPDU> template<typename TPDU>
class PERCodec : public ASN1RecodePer class per_code : public asn1_recode_per
{ {
public: //! \publicsection public: //! \publicsection
/*! /*!
...@@ -47,7 +47,7 @@ public: //! \publicsection ...@@ -47,7 +47,7 @@ public: //! \publicsection
protected: //! \protectedsection protected: //! \protectedsection
int _decode (const TTCN_Typedescriptor_t& ttcn, const asn_TYPE_descriptor_s & td, const BITSTRING& p_data, TPDU& msg); int _decode (const TTCN_Typedescriptor_t& ttcn, const asn_TYPE_descriptor_s & td, const BITSTRING& p_data, TPDU& msg);
int _encode (const TTCN_Typedescriptor_t& ttcn, const asn_TYPE_descriptor_s & td, const TPDU& msg, BITSTRING& p_data); int _encode (const TTCN_Typedescriptor_t& ttcn, const asn_TYPE_descriptor_s & td, const TPDU& msg, BITSTRING& p_data);
}; // End of class PERCodec }; // End of class per_code
#include "PERCodec.t.hh" #include "per_code.t.hh"
#include <TTCN3.hh> #include <TTCN3.hh>
template<class TPDU> template<class TPDU>
int PERCodec<TPDU>::_decode (const TTCN_Typedescriptor_t& ttcn, const asn_TYPE_descriptor_s & td, const BITSTRING& p_data, TPDU& msg) { int per_code<TPDU>::_decode (const TTCN_Typedescriptor_t& ttcn, const asn_TYPE_descriptor_s & td, const BITSTRING& p_data, TPDU& msg) {
TTCN_Buffer buf(bit2oct(p_data)); TTCN_Buffer buf(bit2oct(p_data));
TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING); TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING);
int rc = per2ber (td, buf); int rc = per2ber (td, buf);
...@@ -13,7 +13,7 @@ int PERCodec<TPDU>::_decode (const TTCN_Typedescriptor_t& ttcn, const asn_TYPE_d ...@@ -13,7 +13,7 @@ int PERCodec<TPDU>::_decode (const TTCN_Typedescriptor_t& ttcn, const asn_TYPE_d
} }
template<class TPDU> template<class TPDU>
int PERCodec<TPDU>::_encode (const TTCN_Typedescriptor_t& ttcn, const asn_TYPE_descriptor_s & td, const TPDU& msg, BITSTRING& p_data) { int per_code<TPDU>::_encode (const TTCN_Typedescriptor_t& ttcn, const asn_TYPE_descriptor_s & td, const TPDU& msg, BITSTRING& p_data) {
int rc = -1; int rc = -1;
TTCN_Buffer buf; TTCN_Buffer buf;
TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING); TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING);
......