Loading ccsrc/EncDec/LibItsGeoNetworking_Encdec.cc +2 −2 Original line number Diff line number Diff line Loading @@ -135,7 +135,7 @@ namespace LibItsGeoNetworking__EncdecDeclarations { if (p_geoNetworkingInd.get_at(i)->is_optional()) { loggers::get_instance().log("fx__dec__GeoNetworkingInd: Bytes remaining: %d - field lenth: %d", decoding_buffer.get_len() - decoding_buffer.get_pos(), p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8); if (std::string(p_geoNetworkingInd.fld_name(i)).compare("ssp") == 0) { if ((decoding_buffer.get_len() - decoding_buffer.get_pos()) >= p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8) { if ((decoding_buffer.get_len() - decoding_buffer.get_pos()) >= (int)p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8) { loggers::get_instance().log("fx__dec__GeoNetworkingInd: decoding %s", p_geoNetworkingInd.fld_descr(i)->name); BITSTRING ssp; ssp.decode(*p_geoNetworkingInd.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW); Loading @@ -147,7 +147,7 @@ namespace LibItsGeoNetworking__EncdecDeclarations { } } else if (std::string(p_geoNetworkingInd.fld_name(i)).compare("its_aid") == 0) { loggers::get_instance().log("fx__dec__GeoNetworkingInd: Bytes remaining: %d - its_aid lenth: %d", decoding_buffer.get_len() - decoding_buffer.get_pos(), p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8); if ((decoding_buffer.get_len() - decoding_buffer.get_pos()) >= p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8) { if ((decoding_buffer.get_len() - decoding_buffer.get_pos()) >= (int)p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8) { INTEGER its_aid; its_aid.decode(*p_geoNetworkingInd.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW); loggers::get_instance().log_msg("fx__dec__GeoNetworkingInd: its_aid=", its_aid); Loading ccsrc/Framework/Layer.hh +86 −60 Original line number Diff line number Diff line #ifndef LAYER_HH #define LAYER_HH /*! * \file Layer.hh * \brief Header file for ITS abstract protocol layer definition. * \author ETSI STF525 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. * \version 0.1 */ #pragma once #include <string> #include <map> Loading @@ -9,19 +18,40 @@ #include "Params.hh" #include "loggers.hh" class OCTETSTRING; class BITSTRING; class CHARSTRING; class INTEGER; class OCTETSTRING; //! Declare TITAN class class BITSTRING; //! Declare TITAN class class CHARSTRING; //! Declare TITAN class class INTEGER; //! Declare TITAN class /*! * \class Layer * \brief This class provides basic description of an ITS protocol layer */ class Layer { std::vector<Layer*> upperLayers; std::vector<Layer*> lowerLayers; std::vector<Layer*> upperLayers; //! List of the upper protocol layers std::vector<Layer*> lowerLayers; //! List of the lower protocol layers protected: std::string type; std::string type; //! Type description, it indicates the protocol type (e.g. CAM, DENM, GN, ETH, PCAP...) public: /*! * \brief Default constructor * Create a new instance of the Layer class */ Layer() : upperLayers(), lowerLayers(), type(std::string("")) { loggers::get_instance().log("Layer::Layer (D)"); }; /*! * \brief Specialized constructor * Create a new instance of the Layer class with its type description * \remark This constructor is called by the Layer factory * \see LayerFactory */ Layer(const std::string& p_type) : upperLayers(), lowerLayers(), type(std::string(p_type.begin(), p_type.end())) { loggers::get_instance().log("Layer::Layer"); }; /*! * \brief Default destructor */ virtual ~Layer() { loggers::get_instance().log("Layer::~Layer"); // Double linked list, only remove layers in lowerLayers from the lowest one Loading @@ -29,7 +59,13 @@ public: lowerLayers.clear(); upperLayers.clear(); }; /*! * \fn void deleteLayer(); * \brief Delete this layer */ void deleteLayer() { loggers::get_instance().log("Layer::deleteLayer"); }; public: inline void addUpperLayer(Layer* p_layer) { //loggers::get_instance().log(">>> Layer::addUpperLayer"); Loading @@ -40,12 +76,47 @@ public: p_layer->lowerLayers.push_back(this); }; }; void removeUpperLayer(Layer* p_layer) { }; virtual void sendData(OCTETSTRING& data, Params& params) { loggers::get_instance().log("Layer::sendData"); }; virtual void receiveData(OCTETSTRING& data, Params& params) { loggers::get_instance().log("Layer::receiveData"); } virtual OCTETSTRING trigger_ac_event(OCTETSTRING& data, Params& params) { loggers::get_instance().log("Layer::trigger_ac_event"); return int2oct(0, 2); } /*! * \fn void removeUpperLayer(Layer* p_layer); * \brief Remove the specified upper layer protocol from the list of the upper layer * \param[in] p_layer The layer protocol to be removed */ void removeUpperLayer(Layer* p_layer) { }; /*! * \virtual * \fn void sendData(OCTETSTRING& data, Params& params); * \brief Send bytes formated data to the lower layers * \param[in] p_data The data to be sent * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters */ virtual void sendData(OCTETSTRING& p_data, Params& p_params) { loggers::get_instance().log("Layer::sendData"); }; /*! * \virtual * \fn void receiveData(OCTETSTRING& data, Params& params); * \brief Receive bytes formated data from the lower layers * \param[in] p_data The bytes formated data received * \param[in] p_params Some lower layers parameters values when data was received */ virtual void receiveData(OCTETSTRING& p_data, Params& p_params) { loggers::get_instance().log("Layer::receiveData"); } /*! * \virtual * \fn OCTETSTRING trigger_ac_event(OCTETSTRING& data, Params& params); * \brief TODO * \param[in] p_data * \param[in] p_params */ virtual OCTETSTRING trigger_ac_event(OCTETSTRING& p_data, Params& p_params) { loggers::get_instance().log("Layer::trigger_ac_event"); return int2oct(0, 2); } /*! * \inline * \fn const std::string& to_string(); * \brief Remove the specified upper layer protocol from the list of the upper layer * \param[in] The layer protocol to be removed */ inline const std::string& to_string() const { return type; }; protected: Loading @@ -56,6 +127,7 @@ protected: p->receiveData(data, params); // FIXME BUG I } // End of 'for' statement }; inline void receiveToAllLayers(OCTETSTRING& data, Params& params) { //loggers::get_instance().log(">>> Layer::receiveToAllLayers: %d", upperLayers.size()); for (std::vector<Layer*>::const_iterator it = upperLayers.cbegin(); it != upperLayers.cend(); ++it) { Loading @@ -64,6 +136,7 @@ protected: p->receiveData(data, params); } // End of 'for' statement }; inline void sendToAllLayers(OCTETSTRING& data, Params& params) { //loggers::get_instance().log(">>> Layer::sendToAllLayers: %d", lowerLayers.size()); for (std::vector<Layer*>::const_iterator it = lowerLayers.cbegin(); it != lowerLayers.cend(); ++it) { Loading @@ -74,50 +147,3 @@ protected: }; }; // End of class Layer template <typename TPort> class TLayer : public Layer { typedef std::vector<TPort*> TPortList; typedef typename std::vector<TPort*>::iterator TPortListIterator; TPortList upperPorts; public: TLayer() : Layer(), upperPorts() { loggers::get_instance().log("TLayer::TLayer (D)"); }; TLayer(const std::string& p_type) : Layer(p_type), upperPorts() { loggers::get_instance().log("TLayer::TLayer"); }; void addUpperPort(TPort * p_port) { upperPorts.push_back(p_port); }; void removeUpperPort(TPort*); protected: template <typename TMessage> inline void toAllUpperPorts(const TMessage& m, const Params& param) { //loggers::get_instance().log(">>> TLayer::toAllUpperPorts: %d", upperPorts.size()); for(TPortListIterator it=upperPorts.begin(); it<upperPorts.end(); ++it){ (*it)->receiveMsg(m, param); } } }; class LayerFactory { public: LayerFactory() {}; virtual Layer * createLayer(const std::string & type, const std::string & param) = 0; }; class LayerStackBuilder { typedef std::map<std::string, LayerFactory*> LayerFactoryMap; static LayerStackBuilder * _instance; std::map<std::string, LayerFactory*> _fs; private: LayerStackBuilder(); // can not be created manually public: static LayerStackBuilder * GetInstance(); static void RegisterLayerFactory(const std::string & type, LayerFactory * f); public: void registerLayerFactory(const std::string & type, LayerFactory * f); Layer* createLayerStack(const char*); }; #endif ccsrc/Framework/LayerFactory.hh 0 → 100644 +30 −0 Original line number Diff line number Diff line /*! * \file LayerFactory.hh * \brief Header file for ITS abstract protocol layer definition. * \author ETSI STF525 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. * \version 0.1 */ #pragma once #include <string> #include <map> #include <vector> #include <algorithm> #include "Layer.hh" /*! * \class Layerfactory * \brief This class provides a factory class to create Layer class instances * \abstract */ class LayerFactory { public: LayerFactory() {}; virtual Layer * createLayer(const std::string & type, const std::string & param) = 0; }; // End of class LayerFactory ccsrc/Framework/LayerStackBuilder.hh 0 → 100644 +34 −0 Original line number Diff line number Diff line /*! * \file LayerStackBuilder.hh * \brief Header file for ITS protocol stack builder. * \author ETSI STF525 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. * \version 0.1 */ #pragma once #include "LayerFactory.hh" /*! * \class LayerStackBuilder * \brief This class provides a factory class to create Layer class instances */ class LayerStackBuilder { typedef std::map<std::string, LayerFactory*> LayerFactoryMap; static LayerStackBuilder * _instance; std::map<std::string, LayerFactory*> _fs; private: LayerStackBuilder(); // can not be created manually public: static LayerStackBuilder * GetInstance(); static void RegisterLayerFactory(const std::string & type, LayerFactory * f); public: void registerLayerFactory(const std::string & type, LayerFactory * f); Layer* createLayerStack(const char*); }; // End of class LayerStackBuilder ccsrc/Framework/Params.hh +71 −28 Original line number Diff line number Diff line /*! * \file Params.hh * \brief Header file for the parameter dictionary. * \author ETSI STF525 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. * \version 0.1 */ #pragma once #include <vector> #include <map> /*! * \class Params * \brief This class provides basic functionalities for an ITS dictionary * \implements std::map */ class Params : public std::map<std::string, std::string> { public: static const std::string& mac_src; static const std::string& mac_dst; static const std::string& mac_bc; static const std::string& eth_type; static const std::string& beaconing; static const std::string& ssp; static const std::string& its_aid; static const std::string& gn_payload; static const std::string& gn_next_header; static const std::string& gn_header_type; static const std::string& gn_header_sub_type; static const std::string& gn_lifetime; static const std::string& gn_traffic_class; static const std::string& btp_type; static const std::string& btp_payload; static const std::string& btp_destination_port; static const std::string& btp_info; static const std::string& nic; static const std::string& ll_address; static const std::string& latitude; static const std::string& longitude; static const std::string& expiry; static const std::string& packetize; /** Indicate to the lower layer to build packet */ static const std::string& distanceA; static const std::string& distanceB; static const std::string& angle; static const std::string& mac_src; //! Source MAC address parameter name static const std::string& mac_dst; //! Destination MAC address parameter name static const std::string& mac_bc; //! Broadcast MAC address parameter name static const std::string& eth_type; //! Ethernet type parameter name static const std::string& beaconing; //! Beaconing mode parameter name static const std::string& ssp; //! SSP parameter name static const std::string& its_aid; //! ITS-AID parameter name static const std::string& gn_payload; //! GeoNetworking Payload parameter name static const std::string& gn_next_header; //! GeoNetworking NextHeader parameter name static const std::string& gn_header_type; //! GeoNetworking HeaderType parameter name static const std::string& gn_header_sub_type; //! GeoNetworking HeaderSubType parameter name static const std::string& gn_lifetime; //! GeoNetworking Lifetime parameter name static const std::string& gn_traffic_class; //! GeoNetworking Traffic class parameter name static const std::string& btp_type; //! BTP Type parameter name static const std::string& btp_payload; //! BTP Payload parameter name static const std::string& btp_destination_port; //! BTP DestinationPort parameter name static const std::string& btp_info; //! BTP Info parameter name static const std::string& nic; //! Network Interface Card parameter name static const std::string& ll_address; //! Test system GeoNetworking LL-Address parameter name static const std::string& latitude; //! Test system Latitude parameter name 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& packetize; //! Packetize mode, to indicate to the lower layer to build packet static const std::string& distanceA; //! Test system GeoNetworking DistanceA parameter name static const std::string& distanceB; //! Test system GeoNetworking DistanceB parameter name static const std::string& angle; //! Test system GeoNetworking Angle parameter name /*! * \brief Default constructor * Create a new instance of the Params class */ Params() : std::map<std::string, std::string>() {}; /*! * \brief Copy constructor * Clone 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()) {}; /*! * \brief Default destructor */ virtual ~Params() { }; /*! * \fn void log(); * \brief Provides a dump of the content of this instance */ void log(); /*! * \fn void reset(); * \brief Reset the content of this instance */ void reset(); /*! * \static * \fn void convert(Params& p_param, const std::string p_parameters); * \brief Create a new instance of a Params object by converting a list of ITS parameters in string format (t1=v1,T2=(v0,v1v2)...) * \return a new instance of a Params object */ static void convert(Params& p_param, const std::string p_parameters); }; }; // End of class Params Loading
ccsrc/EncDec/LibItsGeoNetworking_Encdec.cc +2 −2 Original line number Diff line number Diff line Loading @@ -135,7 +135,7 @@ namespace LibItsGeoNetworking__EncdecDeclarations { if (p_geoNetworkingInd.get_at(i)->is_optional()) { loggers::get_instance().log("fx__dec__GeoNetworkingInd: Bytes remaining: %d - field lenth: %d", decoding_buffer.get_len() - decoding_buffer.get_pos(), p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8); if (std::string(p_geoNetworkingInd.fld_name(i)).compare("ssp") == 0) { if ((decoding_buffer.get_len() - decoding_buffer.get_pos()) >= p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8) { if ((decoding_buffer.get_len() - decoding_buffer.get_pos()) >= (int)p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8) { loggers::get_instance().log("fx__dec__GeoNetworkingInd: decoding %s", p_geoNetworkingInd.fld_descr(i)->name); BITSTRING ssp; ssp.decode(*p_geoNetworkingInd.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW); Loading @@ -147,7 +147,7 @@ namespace LibItsGeoNetworking__EncdecDeclarations { } } else if (std::string(p_geoNetworkingInd.fld_name(i)).compare("its_aid") == 0) { loggers::get_instance().log("fx__dec__GeoNetworkingInd: Bytes remaining: %d - its_aid lenth: %d", decoding_buffer.get_len() - decoding_buffer.get_pos(), p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8); if ((decoding_buffer.get_len() - decoding_buffer.get_pos()) >= p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8) { if ((decoding_buffer.get_len() - decoding_buffer.get_pos()) >= (int)p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8) { INTEGER its_aid; its_aid.decode(*p_geoNetworkingInd.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW); loggers::get_instance().log_msg("fx__dec__GeoNetworkingInd: its_aid=", its_aid); Loading
ccsrc/Framework/Layer.hh +86 −60 Original line number Diff line number Diff line #ifndef LAYER_HH #define LAYER_HH /*! * \file Layer.hh * \brief Header file for ITS abstract protocol layer definition. * \author ETSI STF525 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. * \version 0.1 */ #pragma once #include <string> #include <map> Loading @@ -9,19 +18,40 @@ #include "Params.hh" #include "loggers.hh" class OCTETSTRING; class BITSTRING; class CHARSTRING; class INTEGER; class OCTETSTRING; //! Declare TITAN class class BITSTRING; //! Declare TITAN class class CHARSTRING; //! Declare TITAN class class INTEGER; //! Declare TITAN class /*! * \class Layer * \brief This class provides basic description of an ITS protocol layer */ class Layer { std::vector<Layer*> upperLayers; std::vector<Layer*> lowerLayers; std::vector<Layer*> upperLayers; //! List of the upper protocol layers std::vector<Layer*> lowerLayers; //! List of the lower protocol layers protected: std::string type; std::string type; //! Type description, it indicates the protocol type (e.g. CAM, DENM, GN, ETH, PCAP...) public: /*! * \brief Default constructor * Create a new instance of the Layer class */ Layer() : upperLayers(), lowerLayers(), type(std::string("")) { loggers::get_instance().log("Layer::Layer (D)"); }; /*! * \brief Specialized constructor * Create a new instance of the Layer class with its type description * \remark This constructor is called by the Layer factory * \see LayerFactory */ Layer(const std::string& p_type) : upperLayers(), lowerLayers(), type(std::string(p_type.begin(), p_type.end())) { loggers::get_instance().log("Layer::Layer"); }; /*! * \brief Default destructor */ virtual ~Layer() { loggers::get_instance().log("Layer::~Layer"); // Double linked list, only remove layers in lowerLayers from the lowest one Loading @@ -29,7 +59,13 @@ public: lowerLayers.clear(); upperLayers.clear(); }; /*! * \fn void deleteLayer(); * \brief Delete this layer */ void deleteLayer() { loggers::get_instance().log("Layer::deleteLayer"); }; public: inline void addUpperLayer(Layer* p_layer) { //loggers::get_instance().log(">>> Layer::addUpperLayer"); Loading @@ -40,12 +76,47 @@ public: p_layer->lowerLayers.push_back(this); }; }; void removeUpperLayer(Layer* p_layer) { }; virtual void sendData(OCTETSTRING& data, Params& params) { loggers::get_instance().log("Layer::sendData"); }; virtual void receiveData(OCTETSTRING& data, Params& params) { loggers::get_instance().log("Layer::receiveData"); } virtual OCTETSTRING trigger_ac_event(OCTETSTRING& data, Params& params) { loggers::get_instance().log("Layer::trigger_ac_event"); return int2oct(0, 2); } /*! * \fn void removeUpperLayer(Layer* p_layer); * \brief Remove the specified upper layer protocol from the list of the upper layer * \param[in] p_layer The layer protocol to be removed */ void removeUpperLayer(Layer* p_layer) { }; /*! * \virtual * \fn void sendData(OCTETSTRING& data, Params& params); * \brief Send bytes formated data to the lower layers * \param[in] p_data The data to be sent * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters */ virtual void sendData(OCTETSTRING& p_data, Params& p_params) { loggers::get_instance().log("Layer::sendData"); }; /*! * \virtual * \fn void receiveData(OCTETSTRING& data, Params& params); * \brief Receive bytes formated data from the lower layers * \param[in] p_data The bytes formated data received * \param[in] p_params Some lower layers parameters values when data was received */ virtual void receiveData(OCTETSTRING& p_data, Params& p_params) { loggers::get_instance().log("Layer::receiveData"); } /*! * \virtual * \fn OCTETSTRING trigger_ac_event(OCTETSTRING& data, Params& params); * \brief TODO * \param[in] p_data * \param[in] p_params */ virtual OCTETSTRING trigger_ac_event(OCTETSTRING& p_data, Params& p_params) { loggers::get_instance().log("Layer::trigger_ac_event"); return int2oct(0, 2); } /*! * \inline * \fn const std::string& to_string(); * \brief Remove the specified upper layer protocol from the list of the upper layer * \param[in] The layer protocol to be removed */ inline const std::string& to_string() const { return type; }; protected: Loading @@ -56,6 +127,7 @@ protected: p->receiveData(data, params); // FIXME BUG I } // End of 'for' statement }; inline void receiveToAllLayers(OCTETSTRING& data, Params& params) { //loggers::get_instance().log(">>> Layer::receiveToAllLayers: %d", upperLayers.size()); for (std::vector<Layer*>::const_iterator it = upperLayers.cbegin(); it != upperLayers.cend(); ++it) { Loading @@ -64,6 +136,7 @@ protected: p->receiveData(data, params); } // End of 'for' statement }; inline void sendToAllLayers(OCTETSTRING& data, Params& params) { //loggers::get_instance().log(">>> Layer::sendToAllLayers: %d", lowerLayers.size()); for (std::vector<Layer*>::const_iterator it = lowerLayers.cbegin(); it != lowerLayers.cend(); ++it) { Loading @@ -74,50 +147,3 @@ protected: }; }; // End of class Layer template <typename TPort> class TLayer : public Layer { typedef std::vector<TPort*> TPortList; typedef typename std::vector<TPort*>::iterator TPortListIterator; TPortList upperPorts; public: TLayer() : Layer(), upperPorts() { loggers::get_instance().log("TLayer::TLayer (D)"); }; TLayer(const std::string& p_type) : Layer(p_type), upperPorts() { loggers::get_instance().log("TLayer::TLayer"); }; void addUpperPort(TPort * p_port) { upperPorts.push_back(p_port); }; void removeUpperPort(TPort*); protected: template <typename TMessage> inline void toAllUpperPorts(const TMessage& m, const Params& param) { //loggers::get_instance().log(">>> TLayer::toAllUpperPorts: %d", upperPorts.size()); for(TPortListIterator it=upperPorts.begin(); it<upperPorts.end(); ++it){ (*it)->receiveMsg(m, param); } } }; class LayerFactory { public: LayerFactory() {}; virtual Layer * createLayer(const std::string & type, const std::string & param) = 0; }; class LayerStackBuilder { typedef std::map<std::string, LayerFactory*> LayerFactoryMap; static LayerStackBuilder * _instance; std::map<std::string, LayerFactory*> _fs; private: LayerStackBuilder(); // can not be created manually public: static LayerStackBuilder * GetInstance(); static void RegisterLayerFactory(const std::string & type, LayerFactory * f); public: void registerLayerFactory(const std::string & type, LayerFactory * f); Layer* createLayerStack(const char*); }; #endif
ccsrc/Framework/LayerFactory.hh 0 → 100644 +30 −0 Original line number Diff line number Diff line /*! * \file LayerFactory.hh * \brief Header file for ITS abstract protocol layer definition. * \author ETSI STF525 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. * \version 0.1 */ #pragma once #include <string> #include <map> #include <vector> #include <algorithm> #include "Layer.hh" /*! * \class Layerfactory * \brief This class provides a factory class to create Layer class instances * \abstract */ class LayerFactory { public: LayerFactory() {}; virtual Layer * createLayer(const std::string & type, const std::string & param) = 0; }; // End of class LayerFactory
ccsrc/Framework/LayerStackBuilder.hh 0 → 100644 +34 −0 Original line number Diff line number Diff line /*! * \file LayerStackBuilder.hh * \brief Header file for ITS protocol stack builder. * \author ETSI STF525 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. * \version 0.1 */ #pragma once #include "LayerFactory.hh" /*! * \class LayerStackBuilder * \brief This class provides a factory class to create Layer class instances */ class LayerStackBuilder { typedef std::map<std::string, LayerFactory*> LayerFactoryMap; static LayerStackBuilder * _instance; std::map<std::string, LayerFactory*> _fs; private: LayerStackBuilder(); // can not be created manually public: static LayerStackBuilder * GetInstance(); static void RegisterLayerFactory(const std::string & type, LayerFactory * f); public: void registerLayerFactory(const std::string & type, LayerFactory * f); Layer* createLayerStack(const char*); }; // End of class LayerStackBuilder
ccsrc/Framework/Params.hh +71 −28 Original line number Diff line number Diff line /*! * \file Params.hh * \brief Header file for the parameter dictionary. * \author ETSI STF525 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. * \version 0.1 */ #pragma once #include <vector> #include <map> /*! * \class Params * \brief This class provides basic functionalities for an ITS dictionary * \implements std::map */ class Params : public std::map<std::string, std::string> { public: static const std::string& mac_src; static const std::string& mac_dst; static const std::string& mac_bc; static const std::string& eth_type; static const std::string& beaconing; static const std::string& ssp; static const std::string& its_aid; static const std::string& gn_payload; static const std::string& gn_next_header; static const std::string& gn_header_type; static const std::string& gn_header_sub_type; static const std::string& gn_lifetime; static const std::string& gn_traffic_class; static const std::string& btp_type; static const std::string& btp_payload; static const std::string& btp_destination_port; static const std::string& btp_info; static const std::string& nic; static const std::string& ll_address; static const std::string& latitude; static const std::string& longitude; static const std::string& expiry; static const std::string& packetize; /** Indicate to the lower layer to build packet */ static const std::string& distanceA; static const std::string& distanceB; static const std::string& angle; static const std::string& mac_src; //! Source MAC address parameter name static const std::string& mac_dst; //! Destination MAC address parameter name static const std::string& mac_bc; //! Broadcast MAC address parameter name static const std::string& eth_type; //! Ethernet type parameter name static const std::string& beaconing; //! Beaconing mode parameter name static const std::string& ssp; //! SSP parameter name static const std::string& its_aid; //! ITS-AID parameter name static const std::string& gn_payload; //! GeoNetworking Payload parameter name static const std::string& gn_next_header; //! GeoNetworking NextHeader parameter name static const std::string& gn_header_type; //! GeoNetworking HeaderType parameter name static const std::string& gn_header_sub_type; //! GeoNetworking HeaderSubType parameter name static const std::string& gn_lifetime; //! GeoNetworking Lifetime parameter name static const std::string& gn_traffic_class; //! GeoNetworking Traffic class parameter name static const std::string& btp_type; //! BTP Type parameter name static const std::string& btp_payload; //! BTP Payload parameter name static const std::string& btp_destination_port; //! BTP DestinationPort parameter name static const std::string& btp_info; //! BTP Info parameter name static const std::string& nic; //! Network Interface Card parameter name static const std::string& ll_address; //! Test system GeoNetworking LL-Address parameter name static const std::string& latitude; //! Test system Latitude parameter name 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& packetize; //! Packetize mode, to indicate to the lower layer to build packet static const std::string& distanceA; //! Test system GeoNetworking DistanceA parameter name static const std::string& distanceB; //! Test system GeoNetworking DistanceB parameter name static const std::string& angle; //! Test system GeoNetworking Angle parameter name /*! * \brief Default constructor * Create a new instance of the Params class */ Params() : std::map<std::string, std::string>() {}; /*! * \brief Copy constructor * Clone 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()) {}; /*! * \brief Default destructor */ virtual ~Params() { }; /*! * \fn void log(); * \brief Provides a dump of the content of this instance */ void log(); /*! * \fn void reset(); * \brief Reset the content of this instance */ void reset(); /*! * \static * \fn void convert(Params& p_param, const std::string p_parameters); * \brief Create a new instance of a Params object by converting a list of ITS parameters in string format (t1=v1,T2=(v0,v1v2)...) * \return a new instance of a Params object */ static void convert(Params& p_param, const std::string p_parameters); }; }; // End of class Params