realtimenetprots/sipfw/SIP/TransactionUser/src/InviteUASStates.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * Name          : InviteUASStates.h
       
    16 * Part of       : TransactionUser
       
    17 * Version       : SIP/6.0
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 
       
    29 #ifndef INVITEUASSTATES_H
       
    30 #define INVITEUASSTATES_H
       
    31 
       
    32 // INCLUDES
       
    33 #include "UserAgentState.h"
       
    34 
       
    35 // FORWARD DECLARATIONS
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 // Waiting for INVITE from CTransaction.
       
    40 class CInviteUAS_Start : public CUserAgentState
       
    41 	{
       
    42 public: // Constructors and destructor
       
    43 
       
    44 	CInviteUAS_Start();
       
    45 
       
    46 	~CInviteUAS_Start();
       
    47 
       
    48 public: // From CUserAgentState
       
    49 
       
    50 	void TransactionEndsL(CUserAgent& aUserAgent, TInt aReason) const;
       
    51 	
       
    52 	void ReceiveL(CUserAgent& aUserAgent, CSIPRequest* aRequest) const;
       
    53 
       
    54 	// TransactionOwner shouldn't send response yet since UA hasn't passed the
       
    55 	// request to it yet, but in theory it is possible if TransactionOwner
       
    56 	// happens to use this UAS's TransactionId.
       
    57 	void SendResponseL(CUserAgent& aUserAgent,
       
    58 					   CSIPResponse* aResp,
       
    59 					   const TSIPTransportParams& aParams) const;
       
    60 
       
    61 	TBool CancelL(CUserAgent& aUserAgent) const;
       
    62 
       
    63 public: // New functions
       
    64 
       
    65 	void SetNeighbourStates(CUserAgentState& aGetTxOwner,
       
    66 							CUserAgentState& aWaitRespFromApp,
       
    67 							CUserAgentState& aRejected);
       
    68 private: // Data
       
    69 
       
    70 	// Next possible states	
       
    71 	CUserAgentState* iGetTxOwner;
       
    72 	CUserAgentState* iWaitRespFromApp;
       
    73 	
       
    74 	// If UAS or Dialogs subsystem sends a response, it is an error response
       
    75 	// (not a 2xx).
       
    76 	CUserAgentState* iRejected;
       
    77 	};
       
    78 
       
    79 
       
    80 
       
    81 // Waiting to obtain the MTransactionOwner callback to upper layer.
       
    82 // The transaction can't be canceled yet, because TransactionId hasn't been
       
    83 // passed to MTransactionOwner yet.
       
    84 class CInviteUAS_GetTxOwner : public CUserAgentState
       
    85 	{
       
    86 public:	// Constructors and destructor
       
    87 
       
    88 	CInviteUAS_GetTxOwner();
       
    89 
       
    90 	~CInviteUAS_GetTxOwner();
       
    91 
       
    92 public: // From CUserAgentState
       
    93 
       
    94 	void OwnerFoundL(CUserAgent& aUserAgent, MTransactionOwner* aOwner) const;
       
    95 
       
    96 	void OwnerNotFoundL(CUserAgent& aUserAgent, CSIPResponse* aResp) const;
       
    97 	
       
    98 	// TransactionOwner shouldn't send response yet as UA hasn't passed the
       
    99 	// request to it yet, but in theory it is possible if TransactionOwner
       
   100 	// happens to use this UAS's TransactionId.
       
   101 	void SendResponseL(CUserAgent& aUserAgent,
       
   102 					   CSIPResponse* aResp,
       
   103 					   const TSIPTransportParams& aParams) const;
       
   104 
       
   105     void TransactionEndsL(CUserAgent& aUserAgent, TInt aReason) const;
       
   106 
       
   107     void TimerExpiredL(CUserAgent& aUserAgent,
       
   108 					   TTimerId aTimerId,
       
   109 					   TAny* aTimerParam) const;
       
   110 
       
   111     void RequestRouterErrorL(CUserAgent& aUserAgent) const;
       
   112 
       
   113 	TBool CancelL(CUserAgent& aUserAgent) const;
       
   114 
       
   115 public: // New functions
       
   116 
       
   117 	void SetNeighbourStates(CUserAgentState& aWaitRespFromApp,
       
   118 							CUserAgentState& aRejected);
       
   119 
       
   120 private: // Data
       
   121 
       
   122 	// Next possible states
       
   123 	CUserAgentState* iWaitRespFromApp;
       
   124 	CUserAgentState* iRejected;
       
   125 	};
       
   126 
       
   127 
       
   128 
       
   129 // Waiting SIP response from application
       
   130 class CInviteUAS_WaitRespFromApp : public CUserAgentState
       
   131 	{
       
   132 public:	// Constructors and destructor
       
   133 
       
   134 	CInviteUAS_WaitRespFromApp();
       
   135 
       
   136 	~CInviteUAS_WaitRespFromApp();
       
   137 
       
   138 public: // From CUserAgentState
       
   139 
       
   140 	void SendResponseL(CUserAgent& aUserAgent,
       
   141 					   CSIPResponse* aResp,
       
   142 					   const TSIPTransportParams& aParams) const;
       
   143 
       
   144 	void TransactionEndsL(CUserAgent& aUserAgent, TInt aReason) const;
       
   145 
       
   146 	TBool ShouldUASStop() const;
       
   147 
       
   148 	TBool CancelL(CUserAgent& aUserAgent) const;
       
   149 
       
   150 public: // New functions
       
   151 
       
   152 	void SetNeighbourStates(CUserAgentState& aAccepted,
       
   153 							CUserAgentState& aRejected);
       
   154 
       
   155 private: // Data
       
   156 
       
   157 	// Next possible states
       
   158 	CUserAgentState* iAccepted;
       
   159 	CUserAgentState* iRejected;
       
   160 	};
       
   161 
       
   162 
       
   163 
       
   164 // Waiting for ACK from the remote endpoint
       
   165 class CInviteUAS_Accepted : public CUserAgentState
       
   166 	{
       
   167 public:	// Constructors and destructor
       
   168 
       
   169 	CInviteUAS_Accepted();
       
   170 
       
   171 	~CInviteUAS_Accepted();
       
   172 
       
   173 public: // From CUserAgentState
       
   174 
       
   175 	void SendResponseL(CUserAgent& aUserAgent,
       
   176 					   CSIPResponse* aResp,
       
   177 					   const TSIPTransportParams& aParams) const;
       
   178 
       
   179 	void TransactionEndsL(CUserAgent& aUserAgent, TInt aReason) const;
       
   180 
       
   181 	void ReceiveL(CUserAgent& aUserAgent, CSIPRequest* aRequest) const;
       
   182 
       
   183 	void SendCompleteL(CUserAgent& aUserAgent) const;
       
   184 
       
   185 	void SendFailedL(CUserAgent& aUserAgent, TInt aErrcode) const;	
       
   186 
       
   187 	void TimerExpiredL(CUserAgent& aUserAgent,
       
   188 					   TTimerId aTimerId,
       
   189 					   TAny* aTimerParam) const;
       
   190 
       
   191     // Retransmission of a 2xx may cause ICMP error, but currently it isn't
       
   192     // handled.
       
   193 
       
   194 	TBool CancelL(CUserAgent& aUserAgent) const;
       
   195 	};
       
   196 
       
   197 
       
   198 
       
   199 // Waiting for Transaction to end
       
   200 class CInviteUAS_Rejected : public CUserAgentState
       
   201 	{
       
   202 public:	// Constructors and destructor
       
   203 
       
   204 	CInviteUAS_Rejected();
       
   205 
       
   206 	~CInviteUAS_Rejected();
       
   207 
       
   208 public: // From CUserAgentState
       
   209 
       
   210 	void TransactionEndsL(CUserAgent& aUserAgent, TInt aReason) const;
       
   211 	
       
   212 	// ICMP error is handled by transaction (not by UAS) as transaction sends
       
   213 	// the error responses.
       
   214 
       
   215 	// TransactionOwner shouldn't send response any more as the final response
       
   216 	// has already been sent.
       
   217 	void SendResponseL(CUserAgent& aUserAgent,
       
   218 					   CSIPResponse* aResp,
       
   219 					   const TSIPTransportParams& aParams) const;	
       
   220 	};
       
   221 
       
   222 #endif // end of INVITEUASSTATES_H
       
   223 
       
   224 // End of File