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

Merge Its/Ng112 framwork

parent 6d163ddf
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
	<name>STF549_ng112</name>
	<comment></comment>
	<projects>
		<project>Abstract_Socket_CNL113384</project>
	</projects>
	<buildSpec>
		<buildCommand>
+51 −0
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 = 1072915200000L; //! Base time 01/01/2004 12:00am in millseconds
  
  static base_time* _instance;
private:
  base_time() { }; //! 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() const;
  inline const unsigned long long get_its_base_time() const;
  inline const unsigned long long get_its_current_time() 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() const {
  return 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() const {
  return base_time::its_base_time;
}

const unsigned long long base_time::get_its_current_time() const {
  return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count() - base_time::its_base_time;
}
+6 −1
Original line number Diff line number Diff line
@@ -35,9 +35,14 @@ public: //! \publicsection
  
  static const std::string& server;                //! HTTP server address (e.g. www.etsi.org)
  static const std::string& port;                  //! HTTP server port. Default: 80
  static const std::string& use_ssl;               //! Set to 1 to use SSL to communicate with the HTTP server. Default: false
  static const std::string& server_mode;           //! Does the test sytem acting as a server. Default: 0
  static const std::string& local_port;            //! Local listener port. Default: 80
  static const std::string& use_ssl;               //! Set to 1 to use SSL to communicate with the HTTP server. Default: false
  
  static const std::string& method;                //! HTTP method type. Default: POST
  static const std::string& uri;                   //! HTTP URI value. Default: /
  static const std::string& host;                  //! HTTP Host value. Default: 127.0.0.1
  static const std::string& content_type;          //! HTTP Content-type value. Default: application/text

  static const std::string& sip_url;
  static const std::string& sip_version;
+13 −0
Original line number Diff line number Diff line
/*!
 * \file      base_time.cc
 * \brief     Source 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
 */
#include "base_time.hh"

base_time* base_time::_instance = nullptr;
+5 −0
Original line number Diff line number Diff line
@@ -34,6 +34,11 @@ const std::string& params::server_mode = std::string("server_mode");
const std::string& params::local_port = std::string("local_port");
const std::string& params::use_ssl = std::string("use_ssl");

const std::string& params::method = std::string("method");
const std::string& params::uri = std::string("uri");
const std::string& params::host = std::string("host");
const std::string& params::content_type = std::string("content_type");

const std::string& params::sip_url = std::string("sip_url");
const std::string& params::sip_version = std::string("sip_version");
const std::string& params::payload = std::string("payload");
Loading