Loading ccsrc/Framework/include/base_time.hh +1 −1 Original line number Diff line number Diff line /*! * \file base_time.hh * \brief Header file for the control port base_time functionality. * \brief Header file for base_time functionality. * \author ETSI STF525 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. Loading ccsrc/Framework/src/base_time.cc +1 −1 Original line number Diff line number Diff line /*! * \file base_time.cc * \brief Source file for the control port base_time functionality. * \brief Source file base_time functionality. * \author ETSI STF525 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. Loading ccsrc/Helpers/helpers_externals.cc +33 −2 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ #include <math.h> #include "base_time.hh" #include "converter.hh" #include "loggers.hh" #ifndef M_PI Loading Loading @@ -29,7 +30,7 @@ namespace LibHelpers__Functions { * @see function f_getMinuteOfTheYear() return MinuteOfTheYear */ INTEGER fx__getMinuteOfTheYear() { // TODO: this is just a sceleton. fill in the function // TODO: this is just a skeleton. fill in the function return 0; } Loading @@ -39,8 +40,38 @@ namespace LibHelpers__Functions { * @see function f_getDSecond() return DSecond */ INTEGER fx__getDSecond() { // TODO: this is just a sceleton. fill in the function // TODO: this is just a skeleton. fill in the function return 0; } /** * @desc Encode into Base64 * @return p_to_encode - The buffer to be encoded * @see function f_enc_base64(in octetstring p_to_encode) return octetstring */ OCTETSTRING fx__enc__base64(const OCTETSTRING& p_to_encode) { loggers::get_instance().log_msg(">>> fx__enc__base64: ", p_to_encode); const std::vector<unsigned char> to_encode(static_cast<const unsigned char*>(p_to_encode), static_cast<const unsigned char*>(p_to_encode) + p_to_encode.lengthof()); std::vector<unsigned char> b64 = converter::get_instance().buffer_to_base64(to_encode); OCTETSTRING os(b64.size(), b64.data()); loggers::get_instance().log_msg("<<< fx__enc__base64: ", os); return os; } /** * @desc Decode from Base64 * @return p_to_decode - The buffer to be decoded * @see function f_dec_base64(in octetstring p_to_decode) return octetstring */ OCTETSTRING fx__dec__base64(const OCTETSTRING& p_to_decode) { loggers::get_instance().log_msg(">>> fx__dec__base64: ", p_to_decode); const std::vector<unsigned char> to_decode(static_cast<const unsigned char*>(p_to_decode), static_cast<const unsigned char*>(p_to_decode) + p_to_decode.lengthof()); std::vector<unsigned char> b64 = converter::get_instance().base64_to_buffer(to_decode); OCTETSTRING os(b64.size(), b64.data()); loggers::get_instance().log_msg("<<< fx__dec__base64: ", os); return os; } } // namespace LibHelpers__Functions ccsrc/Protocols/Xml/include/xml_converters.hh 0 → 100644 +43 −0 Original line number Diff line number Diff line /*! * \file xml_converters.hh * \brief Header file for xml_converters functionality. * \author ETSI STF637 * \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 <libxml/tree.h> /** * \class xml_converters * \brief This class provides XML converters such as canonicalization of XML documents before signature f encryption */ class xml_converters { static xml_converters *_instance; private: xml_converters() {}; //! Can not be created manually static int xml_node_set_contains_callback(void* user_data, xmlNodePtr node, xmlNodePtr parent); public: static inline xml_converters &get_instance(); virtual ~xml_converters() { if (_instance != nullptr) delete _instance; }; public: int xml_canonicalization(const std::string& p_to_canonical, std::string& p_canonicalized) const; }; // End of class xml_converters // static functions xml_converters &xml_converters::get_instance() { return (_instance != nullptr) ? *_instance : *(_instance = new xml_converters()); } ccsrc/Protocols/Xml/module.mk 0 → 100644 +4 −0 Original line number Diff line number Diff line sources := \ src/xml_converters.cc includes += ./include Loading
ccsrc/Framework/include/base_time.hh +1 −1 Original line number Diff line number Diff line /*! * \file base_time.hh * \brief Header file for the control port base_time functionality. * \brief Header file for base_time functionality. * \author ETSI STF525 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. Loading
ccsrc/Framework/src/base_time.cc +1 −1 Original line number Diff line number Diff line /*! * \file base_time.cc * \brief Source file for the control port base_time functionality. * \brief Source file base_time functionality. * \author ETSI STF525 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. Loading
ccsrc/Helpers/helpers_externals.cc +33 −2 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ #include <math.h> #include "base_time.hh" #include "converter.hh" #include "loggers.hh" #ifndef M_PI Loading Loading @@ -29,7 +30,7 @@ namespace LibHelpers__Functions { * @see function f_getMinuteOfTheYear() return MinuteOfTheYear */ INTEGER fx__getMinuteOfTheYear() { // TODO: this is just a sceleton. fill in the function // TODO: this is just a skeleton. fill in the function return 0; } Loading @@ -39,8 +40,38 @@ namespace LibHelpers__Functions { * @see function f_getDSecond() return DSecond */ INTEGER fx__getDSecond() { // TODO: this is just a sceleton. fill in the function // TODO: this is just a skeleton. fill in the function return 0; } /** * @desc Encode into Base64 * @return p_to_encode - The buffer to be encoded * @see function f_enc_base64(in octetstring p_to_encode) return octetstring */ OCTETSTRING fx__enc__base64(const OCTETSTRING& p_to_encode) { loggers::get_instance().log_msg(">>> fx__enc__base64: ", p_to_encode); const std::vector<unsigned char> to_encode(static_cast<const unsigned char*>(p_to_encode), static_cast<const unsigned char*>(p_to_encode) + p_to_encode.lengthof()); std::vector<unsigned char> b64 = converter::get_instance().buffer_to_base64(to_encode); OCTETSTRING os(b64.size(), b64.data()); loggers::get_instance().log_msg("<<< fx__enc__base64: ", os); return os; } /** * @desc Decode from Base64 * @return p_to_decode - The buffer to be decoded * @see function f_dec_base64(in octetstring p_to_decode) return octetstring */ OCTETSTRING fx__dec__base64(const OCTETSTRING& p_to_decode) { loggers::get_instance().log_msg(">>> fx__dec__base64: ", p_to_decode); const std::vector<unsigned char> to_decode(static_cast<const unsigned char*>(p_to_decode), static_cast<const unsigned char*>(p_to_decode) + p_to_decode.lengthof()); std::vector<unsigned char> b64 = converter::get_instance().base64_to_buffer(to_decode); OCTETSTRING os(b64.size(), b64.data()); loggers::get_instance().log_msg("<<< fx__dec__base64: ", os); return os; } } // namespace LibHelpers__Functions
ccsrc/Protocols/Xml/include/xml_converters.hh 0 → 100644 +43 −0 Original line number Diff line number Diff line /*! * \file xml_converters.hh * \brief Header file for xml_converters functionality. * \author ETSI STF637 * \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 <libxml/tree.h> /** * \class xml_converters * \brief This class provides XML converters such as canonicalization of XML documents before signature f encryption */ class xml_converters { static xml_converters *_instance; private: xml_converters() {}; //! Can not be created manually static int xml_node_set_contains_callback(void* user_data, xmlNodePtr node, xmlNodePtr parent); public: static inline xml_converters &get_instance(); virtual ~xml_converters() { if (_instance != nullptr) delete _instance; }; public: int xml_canonicalization(const std::string& p_to_canonical, std::string& p_canonicalized) const; }; // End of class xml_converters // static functions xml_converters &xml_converters::get_instance() { return (_instance != nullptr) ? *_instance : *(_instance = new xml_converters()); }
ccsrc/Protocols/Xml/module.mk 0 → 100644 +4 −0 Original line number Diff line number Diff line sources := \ src/xml_converters.cc includes += ./include