Commit 99c78d5a authored by YannGarcia's avatar YannGarcia
Browse files

Add missing Port functions and Codecs

parent bd57d319
Loading
Loading
Loading
Loading
+44 −0
Original line number Diff line number Diff line
@@ -195,5 +195,49 @@ namespace LibSip__Interface {
    loggers::get_instance().set_stop_time(_time_key, duration);
  }
  
  void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::CANCEL__Request& send_par, const Address4SIP *destination_address) {
    loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
    loggers::get_instance().log(">>> SipPort::outgoing_send: %s", destination_address);

    float duration;
    loggers::get_instance().set_start_time(_time_key);
    params params;
    static_cast<sip_layer*>(_layer)->sendMsg(send_par, params);
    loggers::get_instance().set_stop_time(_time_key, duration);
  }
  
  void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::NOTIFY__Request& send_par, const Address4SIP *destination_address) {
    loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
    loggers::get_instance().log(">>> SipPort::outgoing_send: %s", destination_address);

    float duration;
    loggers::get_instance().set_start_time(_time_key);
    params params;
    static_cast<sip_layer*>(_layer)->sendMsg(send_par, params);
    loggers::get_instance().set_stop_time(_time_key, duration);
  }
  
  void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::INFO__Request& send_par, const Address4SIP *destination_address) {
    loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
    loggers::get_instance().log(">>> SipPort::outgoing_send: %s", destination_address);

    float duration;
    loggers::get_instance().set_start_time(_time_key);
    params params;
    static_cast<sip_layer*>(_layer)->sendMsg(send_par, params);
    loggers::get_instance().set_stop_time(_time_key, duration);
  }
  
  void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::Response& send_par, const Address4SIP *destination_address) {
    loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
    loggers::get_instance().log(">>> SipPort::outgoing_send: %s", destination_address);

    float duration;
    loggers::get_instance().set_start_time(_time_key);
    params params;
    static_cast<sip_layer*>(_layer)->sendMsg(send_par, params);
    loggers::get_instance().set_stop_time(_time_key, duration);
  }
  
}
+4 −4
Original line number Diff line number Diff line
@@ -46,17 +46,17 @@ namespace LibSip__Interface {
    void outgoing_send(const LibSip__SIPTypesAndValues::INVITE__Request& send_par, const Address4SIP *destination_address);
    void outgoing_send(const LibSip__SIPTypesAndValues::OPTIONS__Request& send_par, const Address4SIP *destination_address);
    void outgoing_send(const LibSip__SIPTypesAndValues::BYE__Request& send_par, const Address4SIP *destination_address);
    virtual void outgoing_send(const LibSip__SIPTypesAndValues::CANCEL__Request& send_par, const Address4SIP *destination_address) { };
    virtual void outgoing_send(const LibSip__SIPTypesAndValues::CANCEL__Request& send_par, const Address4SIP *destination_address);
    void outgoing_send(const LibSip__SIPTypesAndValues::ACK__Request& send_par, const Address4SIP *destination_address);
    virtual void outgoing_send(const LibSip__SIPTypesAndValues::PRACK__Request& send_par, const Address4SIP *destination_address) { };
    virtual void outgoing_send(const LibSip__SIPTypesAndValues::NOTIFY__Request& send_par, const Address4SIP *destination_address) { };
    virtual void outgoing_send(const LibSip__SIPTypesAndValues::NOTIFY__Request& send_par, const Address4SIP *destination_address);
    void outgoing_send(const LibSip__SIPTypesAndValues::SUBSCRIBE__Request& send_par, const Address4SIP *destination_address);
    virtual void outgoing_send(const LibSip__SIPTypesAndValues::PUBLISH__Request& send_par, const Address4SIP *destination_address) { };
    virtual void outgoing_send(const LibSip__SIPTypesAndValues::UPDATE__Request& send_par, const Address4SIP *destination_address) { };
    virtual void outgoing_send(const LibSip__SIPTypesAndValues::REFER__Request& send_par, const Address4SIP *destination_address) { };
    void outgoing_send(const LibSip__SIPTypesAndValues::MESSAGE__Request& send_par, const Address4SIP *destination_address);
    virtual void outgoing_send(const LibSip__SIPTypesAndValues::INFO__Request& send_par, const Address4SIP *destination_address) { };
    virtual void outgoing_send(const LibSip__SIPTypesAndValues::Response& send_par, const Address4SIP *destination_address) { };
    virtual void outgoing_send(const LibSip__SIPTypesAndValues::INFO__Request& send_par, const Address4SIP *destination_address);
    virtual void outgoing_send(const LibSip__SIPTypesAndValues::Response& send_par, const Address4SIP *destination_address);
    virtual void outgoing_send(const CHARSTRING& send_par, const Address4SIP *destination_address) { };
  }; // End of class SipPort

+5 −1
Original line number Diff line number Diff line
@@ -9,6 +9,10 @@ sources := \
						sip_codec_invite_request.cc \
						sip_codec_message_request.cc \
						sip_codec_register_request.cc \
						sip_codec_response.cc  sip_layer.cc
            sip_codec_cancel_request.cc \
            sip_codec_notify_request.cc \
            sip_codec_info_request.cc \
						sip_codec_response.cc \
            sip_layer.cc
includes := .
+37 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@

#include "converter.hh"

sip_layer::sip_layer(const std::string & p_type, const std::string & p_param) : t_layer<LibSip__Interface::SipPort>(p_type), _params(), _codec_request(), _codec_response(), _codec_register(), _codec_invite(), _codec_ack(), _codec_subscribe(), _codec_message(), _codec_options(), _codec_bye() {
sip_layer::sip_layer(const std::string & p_type, const std::string & p_param) : t_layer<LibSip__Interface::SipPort>(p_type), _params(), _codec_request(), _codec_response(), _codec_register(), _codec_invite(), _codec_ack(), _codec_subscribe(), _codec_message(), _codec_options(), _codec_cancel(), _codec_notify(), _codec_info(), _codec_bye() {
  loggers::get_instance().log(">>> sip_layer::sip_layer: %s, %s", to_string().c_str(), p_param.c_str());
  // Setup parameters
  params::convert(_params, p_param);
@@ -76,6 +76,42 @@ void sip_layer::sendMsg(const LibSip__SIPTypesAndValues::BYE__Request& p_sip_mes
  send_data(data, _params);
}

void sip_layer::sendMsg(const LibSip__SIPTypesAndValues::CANCEL__Request& p_sip_message, params& p_param) {
  loggers::get_instance().log_msg(">>> sip_layer::sendMsg: ", p_sip_message);

  // Encode SipMessage
  OCTETSTRING data;
  _codec_cancel.encode(p_sip_message, data);
  send_data(data, _params);
}

void sip_layer::sendMsg(const LibSip__SIPTypesAndValues::NOTIFY__Request& p_sip_message, params& p_param) {
  loggers::get_instance().log_msg(">>> sip_layer::sendMsg: ", p_sip_message);

  // Encode SipMessage
  OCTETSTRING data;
  _codec_notify.encode(p_sip_message, data);
  send_data(data, _params);
}

void sip_layer::sendMsg(const LibSip__SIPTypesAndValues::INFO__Request& p_sip_message, params& p_param) {
  loggers::get_instance().log_msg(">>> sip_layer::sendMsg: ", p_sip_message);

  // Encode SipMessage
  OCTETSTRING data;
  _codec_info.encode(p_sip_message, data);
  send_data(data, _params);
}

void sip_layer::sendMsg(const LibSip__SIPTypesAndValues::Response& p_sip_message, params& p_param) {
  loggers::get_instance().log_msg(">>> sip_layer::sendMsg: ", p_sip_message);

  // Encode SipMessage
  OCTETSTRING data;
  _codec_response.encode(p_sip_message, data);
  send_data(data, _params);
}

void sip_layer::send_data(OCTETSTRING& data, params& p_params) {
  loggers::get_instance().log_msg(">>> sip_layer::send_data: ", data);

+18 −1
Original line number Diff line number Diff line
@@ -22,6 +22,9 @@
#include "sip_codec_subscribe_request.hh"
#include "sip_codec_message_request.hh"
#include "sip_codec_options_request.hh"
#include "sip_codec_notify_request.hh"
#include "sip_codec_cancel_request.hh"
#include "sip_codec_info_request.hh"
#include "sip_codec_bye_request.hh"

namespace LibSip__Interface {
@@ -35,6 +38,9 @@ namespace LibSip__SIPTypesAndValues {
  class SUSCRIBE__Request; //! Forward declaration of TITAN class
  class MESSAGE__Request;  //! Forward declaration of TITAN class
  class OPTIONS__Request;   //! Forward declaration of TITAN class
  class CANCEL__Request;   //! Forward declaration of TITAN class
  class NOTIFY__Request;   //! Forward declaration of TITAN class
  class INFO__Request;   //! Forward declaration of TITAN class
  class BYE__Request;   //! Forward declaration of TITAN class
  class Resquest;          //! Forward declaration of TITAN class
  class Response;          //! Forward declaration of TITAN class
@@ -56,6 +62,9 @@ class sip_layer : public t_layer<LibSip__Interface::SipPort> {
  sip_codec_subscribe_request _codec_subscribe;
  sip_codec_message_request _codec_message;
  sip_codec_options_request _codec_options;
  sip_codec_cancel_request _codec_cancel;
  sip_codec_notify_request _codec_notify;
  sip_codec_info_request _codec_info;
  sip_codec_bye_request _codec_bye;

public: //! \publicsection
@@ -65,7 +74,7 @@ public: //! \publicsection
   * \param[in] p_type \todo
   * \param[in] p_param \todo
   */
  sip_layer() : t_layer<LibSip__Interface::SipPort>(), _params(), _codec_request(), _codec_response(), _codec_register(), _codec_invite(), _codec_ack(), _codec_subscribe(), _codec_message(), _codec_options(), _codec_bye() {};
  sip_layer() : t_layer<LibSip__Interface::SipPort>(), _params(), _codec_request(), _codec_response(), _codec_register(), _codec_invite(), _codec_ack(), _codec_subscribe(), _codec_message(), _codec_options(), _codec_cancel(), _codec_notify(), _codec_info(), _codec_bye() {};
  /*!
   * \brief Specialised constructor
   *        Create a new instance of the sip_layer class
@@ -92,6 +101,14 @@ public: //! \publicsection
  
  void sendMsg(const LibSip__SIPTypesAndValues::BYE__Request& p_sip_message, params& p_param);
  
  void sendMsg(const LibSip__SIPTypesAndValues::CANCEL__Request& p_sip_message, params& p_param);
  
  void sendMsg(const LibSip__SIPTypesAndValues::NOTIFY__Request& p_sip_message, params& p_param);
  
  void sendMsg(const LibSip__SIPTypesAndValues::INFO__Request& p_sip_message, params& p_param);
  
  void sendMsg(const LibSip__SIPTypesAndValues::Response& p_sip_message, params& p_param);
  
  /*!
   * \virtual
   * \fn void send_data(OCTETSTRING& data, params& p_params);