Commit fb25e8af authored by YannGarcia's avatar YannGarcia
Browse files

Reorganize modules before to link with titan-test-system-framework

parent 20a36972
Loading
Loading
Loading
Loading

ccsrc/EncDec/LibItsHttp_Encdec.cc

deleted100644 → 0
+0 −28
Original line number Diff line number Diff line

#include "LibItsHttp_MessageBodyTypes.hh"

#include "http_codec.hh"

#include "loggers.hh"

namespace LibItsHttp__EncdecDeclarations {

  BITSTRING fx__enc__http__message(const LibItsHttp__TypesAndValues::HttpMessage& p) {
    loggers::get_instance().log_msg(">>> fx__enc__http__message: ", (const Base_Type&)p);

    OCTETSTRING os;
    http_codec codec;
    codec.encode(p, os);

    return oct2bit(os);
  }
  INTEGER fx__dec__http__message(BITSTRING& pdu, LibItsHttp__TypesAndValues::HttpMessage& p) {
    loggers::get_instance().log_msg(">>> fx__dec__http__message: ", pdu);

    OCTETSTRING os = bit2oct(pdu);
    http_codec codec;
    codec.decode(os, p);

    return 0;
  }
} // End of namespace LibItsHttp__EncdecDeclarations
+2 −2
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ sources += \
           LibItsBtp_Encdec.cc  \
           LibItsCam_Encdec.cc  \
           LibItsDenm_Encdec.cc  \
           LibItsHttp_Encdec.cc \
           LibHttp_Encdec.cc \
           LibItsMapemSpatem_Encdec.cc \
           LibItsSremSsem_Encdec.cc \
           LibItsRtcmem_Encdec.cc \
@@ -55,5 +55,5 @@ sources += \
           LibItsBtp_Encdec.cc \
           LibItsPki_Encdec.cc \
           LibItsCam_Encdec.cc \
           LibItsHttp_Encdec.cc
           LibHttp_Encdec.cc
endif
+1 −1
Original line number Diff line number Diff line
@@ -1369,7 +1369,7 @@ namespace LibItsSecurity__Functions {
      str += "/";
      str += std::string(static_cast<const char *>(p__configId));
    }
    params params;
    params_its params;
    params.insert(std::pair<std::string, std::string>(std::string("sec_db_path"), str));
    if (security_services::get_instance().setup(params) == -1) {
      return FALSE;
+0 −73
Original line number Diff line number Diff line
/*!
 * \file      base_time.hh
 * \brief     Header file for the control port base_time functionality.
 * \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 <chrono>

/**
 * \class base_time
 * \brief This class provides time tools such as getting current time
 */
class base_time {
  const unsigned long long its_base_time_ms = 1072915200000L; //! Base time 01/01/2004 12:00am in millseconds

  unsigned long long leap_delay;

  static base_time *_instance;

private:
  base_time() : leap_delay{0} {}; //! Can not be created manually
public:
  static inline base_time &get_instance();

  virtual ~base_time() {
    if (_instance != nullptr)
      delete _instance;
  };

public:
  inline const unsigned long long get_current_time_ms() const;
  inline const unsigned long long get_its_base_time_ms() const;
  inline const unsigned long long get_its_current_time_ms() const;
  inline const unsigned long long get_its_current_time_us() const;
  inline const unsigned long long get_its_current_time_mod_ms() const;
  inline void                     set_leap_delay_us(const unsigned long long p_leap_delay);
  inline const unsigned long long get_leap_delay_us() const;
}; // End of class base_time

// static functions
base_time &base_time::get_instance() { return (_instance != nullptr) ? *_instance : *(_instance = new base_time()); }

const unsigned long long base_time::get_current_time_ms() const {
  return (leap_delay / 1000) + std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
}

const unsigned long long base_time::get_its_base_time_ms() const { return base_time::its_base_time_ms; }

const unsigned long long base_time::get_its_current_time_ms() const {
  return (leap_delay / 1000) + std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count() -
         base_time::its_base_time_ms;
}

const unsigned long long base_time::get_its_current_time_us() const {
  return leap_delay + std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now().time_since_epoch()).count() -
         base_time::its_base_time_ms * 1000;
}

const unsigned long long base_time::get_its_current_time_mod_ms() const {
  return ((leap_delay / 1000) + std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count() -
          base_time::its_base_time_ms) %
         65536;
}

void base_time::set_leap_delay_us(const unsigned long long p_leap_delay) { leap_delay = p_leap_delay; }

inline const unsigned long long base_time::get_leap_delay_us() const { return leap_delay; }
+0 −45
Original line number Diff line number Diff line
/*!
 * \file      codec_factory.hh
 * \brief     Header file for ITS abstract protocol codec 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 <algorithm>
#include <map>
#include <string>
#include <vector>

#include "codec.hh"

class Record_Type; //! TITAN forward declaration

/*!
 * \class codec_factory
 * \brief  This class provides a factory class to create codec class instances
 * \abstract
 */
class codec_factory {
public: //! \publicsection
  /*!
   * \fn codec();
   * \brief  Default constructor
   */
  codec_factory(){};
  /*!
   * \fn codec* create_codec(const std::string & type, const std::string & param);
   * \brief  Create the codecs stack based on the provided codecs stack description (cf. remark)
   * \param[in] p_type The provided codecs stack description
   * \param[in] p_params Optional parameters
   * \return 0 on success, -1 otherwise
   * \remark The description below introduces codecs stack in case of ITS project:
   *     HTTP(codecs=xml:held_codec;html:html_codec,json:json_codec)/TCP(debug=1,server=httpbin.org,port=80,use_ssl=0)
   * \pure
   */
  virtual codec<Record_Type, Record_Type> *create_codec() = 0;
}; // End of class codec_factory
Loading