Commit 111eb2bf authored by garciay's avatar garciay
Browse files

STF545: Add acPkiPort support for Pki. Conflict with acPort to be fixed

parent d6fcd3e5
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -76,15 +76,13 @@ namespace LibItsCommon__Functions
    double d_lonA = ((double)p__longitudeA)/10000000.0;
    double d_lonB = ((double)p__longitudeB)/10000000.0;

    double earth_radius = 6371000.0; //meters

    double d_lat = (d_latB  - d_latA) * (M_PI/180.0);
    double d_lon = (d_lonB - d_lonA) * (M_PI/180.0);
  
    double a = sin(d_lat/2)*sin(d_lat/2) + cos(d_latA*M_PI/180.0)*cos(d_latB*M_PI/180.0)*sin(d_lon/2)*sin(d_lon/2);
    double c = 2*atan2(sqrt(a), sqrt(1-a));

    return FLOAT(earth_radius*c);
    return FLOAT(earthRadius*c);
  }

  /*       * @desc    External function to compute a position using a reference position, a distance and an orientation 
+4 −1
Original line number Diff line number Diff line
@@ -77,8 +77,11 @@ public: //! \publicsection
  static const std::string& interface_id;          //! Commsignia antenna selector

  static const std::string& server;                //! HTTP server address (e.g. www.etsi.org)
  static const std::string& port;                  //! Commsignia HTTP server port. Default: 80
  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& 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& codecs;                //! List of codecs to use for HTTP application layers

+3 −0
Original line number Diff line number Diff line
@@ -72,6 +72,9 @@ const std::string& params::interface_id = std::string("interface_id");
const std::string& params::server = std::string("server");
const std::string& params::port = std::string("port");
const std::string& params::use_ssl = std::string("use_ssl");
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::codecs = std::string("codecs");

+26 −24
Original line number Diff line number Diff line
#include <TTCN3.hh>

#include "LibItsPki_TestSystem.hh"

#include "loggers.hh"
#include "registration.hh"

@@ -8,87 +10,87 @@
//=============================================================================
namespace LibItsPki__TestSystem {

  AdapterControlPort::AdapterControlPort(const char *par_port_name)
    : AdapterControlPort_BASE(par_port_name), _params()
  AdapterControlPkiPort::AdapterControlPkiPort(const char *par_port_name)
    : AdapterControlPkiPort_BASE(par_port_name), _params()
  {
    loggers::get_instance().log("AdapterControlPort::AdapterControlPort");
    loggers::get_instance().log("AdapterControlPkiPort::AdapterControlPkiPort");


  }

  AdapterControlPort::~AdapterControlPort()
  AdapterControlPkiPort::~AdapterControlPkiPort()
  {

  }

  void AdapterControlPort::set_parameter(const char * parameter_name, const char * parameter_value)
  void AdapterControlPkiPort::set_parameter(const char * parameter_name, const char * parameter_value)
  {
    loggers::get_instance().log("AdapterControlPort::set_parameter: %s=%s", parameter_name, parameter_value);
    loggers::get_instance().log("AdapterControlPkiPort::set_parameter: %s=%s", parameter_name, parameter_value);

  }

  /*void AdapterControlPort::Handle_Fd_Event(int fd, boolean is_readable,
  /*void AdapterControlPkiPort::Handle_Fd_Event(int fd, boolean is_readable,
    boolean is_writable, boolean is_error) {}*/

  void AdapterControlPort::Handle_Fd_Event_Error(int /*fd*/)
  void AdapterControlPkiPort::Handle_Fd_Event_Error(int /*fd*/)
  {

  }

  void AdapterControlPort::Handle_Fd_Event_Writable(int /*fd*/)
  void AdapterControlPkiPort::Handle_Fd_Event_Writable(int /*fd*/)
  {

  }

  void AdapterControlPort::Handle_Fd_Event_Readable(int /*fd*/)
  void AdapterControlPkiPort::Handle_Fd_Event_Readable(int /*fd*/)
  {

  }

  /*void AdapterControlPort::Handle_Timeout(double time_since_last_call) {}*/
  /*void AdapterControlPkiPort::Handle_Timeout(double time_since_last_call) {}*/

  void AdapterControlPort::user_map(const char * system_port)
  void AdapterControlPkiPort::user_map(const char * system_port)
  {
    loggers::get_instance().log(">>> AdapterControlPort::user_map: %s", system_port);
    loggers::get_instance().log(">>> AdapterControlPkiPort::user_map: %s", system_port);

  }

  void AdapterControlPort::user_unmap(const char * system_port)
  void AdapterControlPkiPort::user_unmap(const char * system_port)
  {
    loggers::get_instance().log(">>> AdapterControlPort::user_unmap: %s", system_port);
    loggers::get_instance().log(">>> AdapterControlPkiPort::user_unmap: %s", system_port);

  }

  void AdapterControlPort::user_start()
  void AdapterControlPkiPort::user_start()
  {

  }

  void AdapterControlPort::user_stop()
  void AdapterControlPkiPort::user_stop()
  {

  }

  void AdapterControlPort::outgoing_send(const LibItsPki__TypesAndValues::AcPkiPrimitive& send_par)
  void AdapterControlPkiPort::outgoing_send(const LibItsPki__TypesAndValues::AcPkiPrimitive& send_par)
  {
    loggers::get_instance().log_msg(">>> AdapterControlPort::outgoing_send: ", send_par);
    loggers::get_instance().log_msg(">>> AdapterControlPkiPort::outgoing_send: ", send_par);
    
    // Register this object for AdapterControlPort
    // Register this object for AdapterControlPkiPort
    pki_layer* p = registration<pki_layer>::get_instance().get_item(std::string("PKI"));
    if (p != NULL) {
      loggers::get_instance().log("AdapterControlPort::outgoing_send: Got PKI layer %p", p);
      loggers::get_instance().log("AdapterControlPkiPort::outgoing_send: Got PKI layer %p", p);
      LibItsPki__TypesAndValues::AcPkiResponse response;
      response.result() = BOOLEAN(false);
      if (send_par.ischosen(LibItsPki__TypesAndValues::AcPkiPrimitive::ALT_acSetSecurityData)) {
        loggers::get_instance().log("AdapterControlPort::outgoing_send: AcSetSecurityData");
        loggers::get_instance().log("AdapterControlPkiPort::outgoing_send: AcSetSecurityData");
        p->set_pki_keys(send_par.acSetSecurityData());
        response.result() = BOOLEAN(true);
      }
      // Send response
      loggers::get_instance().log_msg("AdapterControlPort::outgoing_send: Send response: ", response);
      loggers::get_instance().log_msg("AdapterControlPkiPort::outgoing_send: Send response: ", response);
      incoming_message(response);
    } else {
      loggers::get_instance().error("AdapterControlPort::outgoing_send: pkiPort not registered");
      loggers::get_instance().error("AdapterControlPkiPort::outgoing_send: pkiPort not registered");
    }
  }

+8 −4
Original line number Diff line number Diff line
@@ -3,14 +3,18 @@

#include "params.hh"

namespace LibItsPki__TypesAndValues {
  class AcPkiPrimitive;
}

namespace LibItsPki__TestSystem {

class AdapterControlPort : public AdapterControlPort_BASE {
class AdapterControlPkiPort : public AdapterControlPkiPort_BASE {
  params _params;
	
public:
	AdapterControlPort(const char *par_port_name = NULL);
	~AdapterControlPort();
	AdapterControlPkiPort(const char *par_port_name = NULL);
	~AdapterControlPkiPort();

	void set_parameter(const char *parameter_name,
		const char *parameter_value);
Loading