📄 sipexsipengine.h
字号:
/*
* ==============================================================================
* Name : SIPExSIPEngine.h
*
* ==============================================================================
*/
#ifndef _SIPEXSIPENGINE_H_
#define _SIPEXSIPENGINE_H_
// INCLUDES
#include <e32base.h>
#include <e32std.h>
#include <e32math.h>
#include <s32mem.h>
#include <in_sock.h>
#include <sip.h>
#include <sipdialog.h>
#include <sipobserver.h>
#include <sipinvitedialogassoc.h>
#include <sipconnectionobserver.h>
#include <sipservertransaction.h>
#include <sipmessageelements.h>
#include <siprequestelements.h>
#include <sdpdocument.h>
#include <sdpmediafield.h>
#include <sdporiginfield.h>
#include <sdpconnectionfield.h>
#include <sdpcodecstringconstants.h>
#include <sdpcodecstringpool.h>
#include <sipprofile.h>
#include <sipprofileregistry.h>
#include <sipprofileregistryobserver.h>
#include <sipaddress.h>
#include <sipcontenttypeheader.h>
#include <sipfromheader.h>
#include "SIPExSIPEngineObserver.h"
#include "SIPExSIPIdleState.h"
#include "SIPExSIPClientEstablishingState.h"
#include "SIPExSIPClientOfferingState.h"
#include "SIPExSIPServerOfferingState.h"
#include "SIPExSIPServerEstablishingState.h"
#include "SIPExSIPEstablishedState.h"
#include "SIPExSIPTerminatingState.h"
// FORWARD DECLARATIONS
class CSIP;
class CSIPDialog;
class CSIPServerTransaction;
class CSIPMessageElements;
class CSIPRequestElements;
class CSIPAddress;
class CSIPContentTypeHeader;
class CSIPFromHeader;
class MSIPExSIPEngineObserver;
class CSIPExSIPIdleState;
class CSIPExSIPClientEstablishingState;
class CSIPExSIPClientOfferingState;
class CSIPExSIPServerOfferingState;
class CSIPExSIPServerEstablishingState;
class CSIPExSIPEstablishedState;
class CSIPExSIPTerminatingState;
// CLASS DECLARATION
/**
* CSIPExSIPEngine
* Class for implementing the SIP Engine for the SIP
* Example Application. The Engine provides API functions
* for other parts of the Application, and maintains an
* internal state machine to handle the SIP session.
*/
class CSIPExSIPEngine: public CBase,
MSIPObserver,
MSIPConnectionObserver,
MSIPProfileRegistryObserver
{
public: // Constructors and destructor
/**
* NewL
* Create new instance of SIP Engine.
* @param aAppUid Application uid.
* @param aObserver Pointer to the Engine Observer.
* @return Pointer to new SIP Engine instance.
*/
IMPORT_C static CSIPExSIPEngine* NewL( TUid aAppUid,
MSIPExSIPEngineObserver* aObserver );
/**
* Destructor.
*/
virtual ~CSIPExSIPEngine();
private:
/**
* C++ default constructor.
*/
CSIPExSIPEngine();
/**
* 2nd phase construction.
* @param aAppUid Application uid.
* @param aObserver Pointer to the Engine Observer.
*/
void ConstructL( TUid aAppUid,
MSIPExSIPEngineObserver* aObserver );
public: // New functions - services provided by the SIP Engine
/**
* EnableProfileL
* Enable the default profile.
* Callback is notified when operation is complete.
* Leaves if default SIP profile is not found or profile type is not expected.
* Returns true if profile was registered immediately after enabling.
*/
IMPORT_C TBool EnableProfileL();
/**
* DisableProfile
* Disable the current profile.
* Callback is notified when operation is complete.
*/
IMPORT_C void DisableProfileL();
/**
* SendInvite
* Create and send an INVITE to the recipient
* identified by the parameter.
* @param aSipUri Address of the recipient.
*/
IMPORT_C void SendInviteL( const TDesC8& aSipUri );
/**
* CancelInvite
* CANCEL a previously sent INVITE. If a final
* response for the INVITE has been sent, the
* CANCEL request fails.
*/
IMPORT_C void CancelInviteL();
/**
* AcceptInvite
* Send a 200 (OK) response to an INVITE sent
* by a remote party.
* @param aIPAddr local ip-address.
*/
IMPORT_C void AcceptInviteL(const TInetAddr& aIPAddr );
/**
* DeclineInvite
* Send a 488 (Not Acceptable Here) response to
* an INVITE sent by a remote party.
*/
IMPORT_C void DeclineInviteL();
/**
* EndSession
* Terminate the SIP session by sending a BYE
* request.
*/
IMPORT_C void EndSessionL();
/**
* CreateIML
* Create an instant message and send it to the
* remote party using the MESSAGE method.
* @param aMessage The message to be sent.
* @param aSipUri Address of the recipient.
*/
IMPORT_C void CreateIML( const TDesC8& aMessage,
const TDesC8& aSipUri );
public: // State machine & internal functionality
/**
* IMReceivedL
* An instant message has been received from the
* network. Inform the observer.
* @param aTransaction Contains message elements.
* Ownership is transferred.
*/
void IMReceivedL( CSIPServerTransaction* aTransaction );
/**
* IMReceived
* A non-leaving version of the IMReceivedL, the
* possible errors are trapped.
* @param aTransaction Contains message elements.
* Ownership is transferred.
*/
void IMReceived( CSIPServerTransaction* aTransaction );
/**
* SetCurrentState
* Sets the active state of the state machine.
* @param aState The current state.
*/
void SetCurrentState( CSIPExSIPStateBase* aState );
/**
* Connection
* Sets the active connection.
*/
CSIPConnection& ConnectionL();
/**
* Profile
* Returns the enabled profile.
*/
CSIPProfile& Profile();
/**
* SetServerTx
* Sets the current Server Transaction.
* The ownership is transferred to the Engine.
* @param aTx The transaction.
*/
void SetServerTx( CSIPServerTransaction* aTx );
/**
* ServerTx
* Gets the current Server Transaction.
*/
CSIPServerTransaction& ServerTx();
/**
* SetClientTx
* Sets the current Client Transaction.
* The ownership is transferred to the Engine.
* @param aTx The transaction.
*/
void SetClientTx( CSIPClientTransaction* aTx );
/**
* ClearClientTx
* Deletes the current Client Transaction.
*/
void ClearClientTx();
/**
* ClientTx
* Gets the current Client Transaction.
*/
CSIPClientTransaction& ClientTx();
/**
* SetDialogAssoc
* Sets the current Invite Dialog Association.
* @param aAssoc The Dialog Assoc.
*/
void SetDialogAssoc( CSIPInviteDialogAssoc& aAssoc );
/**
* DialogAssoc
* Returns the current Invite Dialog Association.
*/
CSIPInviteDialogAssoc& DialogAssoc();
public: // Methods from base classes
// From MSIPObserver
/**
* IncomingRequest (from MSIPObserver)
* A SIP request has been received from the network.
* @param aIapId The IapId from which
* the SIP request was received.
* @param aTransaction contains local address,
* remote address of a sip message,
* as well as optional SIP message method, headers and body.
* The ownership is transferred.
*/
void IncomingRequest( TUint32 aIapId,
CSIPServerTransaction* aTransaction );
/**
* TimedOut (from MSIPObserver)
*/
void TimedOut( CSIPServerTransaction& aSIPServerTransaction );
// From MSIPConnectionObserver
/**
* IncomingRequest (from MSIPConnectionObserver)
* A SIP request outside a dialog has been received from the network.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -