ptconnectionevent.cpp

来自「基于sipfoundy 公司开发的sipx协议API」· C++ 代码 · 共 122 行

CPP
122
字号
//// Copyright (C) 2004, 2005 Pingtel Corp.// //// $$//////////////////////////////////////////////////////////////////////////////// SYSTEM INCLUDES#include <assert.h>#include <string.h>// APPLICATION INCLUDES#include "ptapi/PtConnectionEvent.h"#include "ptapi/PtConnection.h"#include "tao/TaoClientTask.h"// EXTERNAL FUNCTIONS// EXTERNAL VARIABLES// CONSTANTS// STATIC VARIABLE INITIALIZATIONS/* //////////////////////////// PUBLIC //////////////////////////////////// *//* ============================ CREATORS ================================== */// ConstructorPtConnectionEvent::PtConnectionEvent(PtEvent::PtEventId eventId) :PtCallEvent(eventId){        setEventAddress(0);        mpClient = NULL;}PtConnectionEvent::PtConnectionEvent(PtEvent::PtEventId eventId,                                                        int metaCode,                                                        const char* addressName,                                                        const char* callId,                                                        int sipResponseCode,                                                        const char* sipResponseText,                                                        const char* newCallId,                                                        const char** oldCallIds,                                                        int numOldCalls,                                                        PtEvent::PtEventCause cause,                                                        TaoClientTask *pClient) :PtCallEvent(eventId, metaCode, callId, pClient, sipResponseCode, sipResponseText, newCallId, oldCallIds, numOldCalls){        mEventCause = cause;        setEventAddress(addressName);}PtConnectionEvent::PtConnectionEvent(TaoClientTask *pClient) :PtCallEvent(pClient){        setEventAddress(0);}// Copy constructorPtConnectionEvent::PtConnectionEvent(const PtConnectionEvent& rPtConnectionEvent):PtCallEvent(rPtConnectionEvent){        mEventCause = rPtConnectionEvent.mEventCause;        setEventAddress(rPtConnectionEvent.mAddressName);}// DestructorPtConnectionEvent::~PtConnectionEvent(){}/* ============================ MANIPULATORS ============================== */// Assignment operatorPtConnectionEvent&PtConnectionEvent::operator=(const PtConnectionEvent& rhs){        if (this == &rhs)            // handle the assignment to self case          return *this;        PtCallEvent::operator=(rhs);        setEventAddress(rhs.mAddressName);        mEventCause = rhs.mEventCause;   return *this;}void PtConnectionEvent::setEventAddress(const char* address){        if (address)        {                int len = strlen(address);                if (len > 127)                        len = 127;                strncpy(mAddressName, address, len);                mAddressName[len] = 0;        }        else                memset(mAddressName, 0, 128);}/* ============================ ACCESSORS ================================= */// Return the terminal connection object associated with this eventPtStatusPtConnectionEvent::getConnection(PtConnection& rConnection) const{        PtConnection conn(mpClient, mAddressName, mCallId);        rConnection = conn;        return PT_SUCCESS;}/* ============================ INQUIRY =================================== */// PT_IMPLEMENT_CLASS_INFO(PtConnectionEvent, PtCallEvent)/* //////////////////////////// PROTECTED ///////////////////////////////// */// Protected constructor./* //////////////////////////// PRIVATE /////////////////////////////////// *//* ============================ FUNCTIONS ================================= */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?