Commit 89b90aec authored by liebigan's avatar liebigan
Browse files

Merge remote-tracking branch 'origin/ttf_t009' into ttf_t009

parents 352ae64d c702965f
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 := .
+46 −0
Original line number Diff line number Diff line
#include "LibSip_SIPTypesAndValues.hh"

#include "sip_codec_cancel_request.hh"
#include "loggers.hh"

int sip_codec_cancel_request::encode (const LibSip__SIPTypesAndValues::CANCEL__Request& msg, OCTETSTRING& data)
{
  loggers::get_instance().log_msg(">>> sip_codec_cancel_request::encode: ", (const Base_Type&)msg);

  if (_codec.encode((LibSip__SIPTypesAndValues::Request&)msg, data) == -1) {
    loggers::get_instance().warning("sip_codec_cancel_request::encode: Failed to encode message");
    return -1;
  }
  
  loggers::get_instance().log_msg("<<< sip_codec_cancel_request::encode: data=", data);
  return 0;
}

int sip_codec_cancel_request::decode (const OCTETSTRING& data, LibSip__SIPTypesAndValues::CANCEL__Request& msg, params* p_params)
{
  loggers::get_instance().log_msg(">>> sip_codec_cancel_request::decode: data=", data);

  // Sanity checks
  if (data.lengthof() == 0) {
    loggers::get_instance().warning("sip_codec_cancel_request::decode: Wrong parameters");
    return -1;
  }

  //  LibSip__SIPTypesAndValues::Request request;
  if (_codec.decode(data, (LibSip__SIPTypesAndValues::Request&)msg) == -1) {
    //  if (_codec.decode(data, request) == -1) {
    loggers::get_instance().warning("sip_codec_cancel_request::decode: Failed to decode message");
    return -1;
  }
  // msg.requestLine() = request.requestLine();
  // msg.msgHeader() = request.msgHeader();
  // msg.messageBody() = request.messageBody();
  // msg.payload() = request.payload();

  if (msg.requestLine().method() != LibSip__SIPTypesAndValues::Method::CANCEL__E) {
    loggers::get_instance().warning("sip_codec_cancel_request::decode: Wrong SIP Method, expected CANCEL");
    return -1;
  }
  
  return 0;
}
+27 −0
Original line number Diff line number Diff line
#pragma once

#include "codec.hh"
#include "params.hh"

#include "sip_codec_request.hh"

class Base_Type;
class TTCN_Typedescriptor_t;
class TTCN_Buffer;

namespace LibSip__SIPTypesAndValues {
  class CANCEL__Request;
}

class sip_codec_cancel_request: public codec <
LibSip__SIPTypesAndValues::CANCEL__Request,
LibSip__SIPTypesAndValues::CANCEL__Request>
{
  sip_codec_request _codec;
public:
  explicit sip_codec_cancel_request() : codec<LibSip__SIPTypesAndValues::CANCEL__Request, LibSip__SIPTypesAndValues::CANCEL__Request>(), _codec() { };
  virtual ~sip_codec_cancel_request() { };

  virtual int encode (const LibSip__SIPTypesAndValues::CANCEL__Request& msg, OCTETSTRING& data);
  virtual int decode (const OCTETSTRING& data, LibSip__SIPTypesAndValues::CANCEL__Request& msg, params* p_params = NULL);
}; // End of class sip_codec_cancel_request
Loading