|
1 /* |
|
2 * Copyright (c) 2004 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 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef UT_CNATBINDING_H |
|
20 #define UT_CNATBINDING_H |
|
21 |
|
22 #include "sipnattraversalrequestobserver.h" |
|
23 #include "sipnatbindingobserver.h" |
|
24 #include "nattraversalsocketmanager.h" |
|
25 |
|
26 #include "natfwstunclientobserver.h" |
|
27 #include <es_sock.h> |
|
28 #include <in_sock.h> |
|
29 |
|
30 #include <digia/eunit/ceunittestsuiteclass.h> |
|
31 |
|
32 #include <e32def.h> |
|
33 #ifndef NONSHARABLE_CLASS |
|
34 #define NONSHARABLE_CLASS(x) class x |
|
35 #endif |
|
36 |
|
37 class CSTUNClient; |
|
38 class CNATBinding; |
|
39 |
|
40 NONSHARABLE_CLASS(UT_CNATBinding) : |
|
41 public CEUnitTestSuiteClass, |
|
42 public MSTUNClientObserver, |
|
43 public MSIPNATTraversalRequestObserver, |
|
44 public MSIPNATBindingObserver, |
|
45 public MNATTraversalSocketManager |
|
46 { |
|
47 public: // Constructors and destructors |
|
48 |
|
49 /** |
|
50 * Two phase construction |
|
51 */ |
|
52 static UT_CNATBinding* NewL(); |
|
53 static UT_CNATBinding* NewLC(); |
|
54 |
|
55 /** |
|
56 * Destructor |
|
57 */ |
|
58 ~UT_CNATBinding(); |
|
59 |
|
60 private: // Constructors and destructors |
|
61 |
|
62 UT_CNATBinding(); |
|
63 void ConstructL(); |
|
64 |
|
65 public: // From MSTUNClientObserver |
|
66 |
|
67 void STUNClientInitCompleted( const CSTUNClient& aClient, |
|
68 TInt aCompletionCode ); |
|
69 |
|
70 void STUNBindingEventOccurredL( TSTUNBindingEvent aEvent, |
|
71 const CBinding& aBinding ); |
|
72 |
|
73 void STUNBindingErrorOccurred( const CBinding& aBinding, |
|
74 TInt aError ); |
|
75 |
|
76 public: // MSIPNATTraversalRequestObserver |
|
77 |
|
78 void RequestComplete( |
|
79 TUint32 aRequestId, |
|
80 TInt aCompletionCode ); |
|
81 |
|
82 void PublicAddrResolved( |
|
83 TUint32 aRequestId, |
|
84 const TInetAddr& aPublicAddr ); |
|
85 |
|
86 public: // MSIPNATBindingObserver |
|
87 |
|
88 void FlowFailure( TInt aError ); |
|
89 |
|
90 public: // From MNATTraversalSocketManager |
|
91 |
|
92 TBool AddToSendingQueueL( MNATTraversalSocketUser& aUser ); |
|
93 |
|
94 void SendingCompleted( MNATTraversalSocketUser& aUser ); |
|
95 |
|
96 private: // New Methods |
|
97 |
|
98 void SetupL(); |
|
99 void TeardownL(); |
|
100 void TestBasicSettersAndGettersL(); |
|
101 void TestSendSTUNRequestL(); |
|
102 void TestPublicAddrL(); |
|
103 void TestBindingFailedL(); |
|
104 void TestHandleDataL(); |
|
105 void TestNATBindingRefreshCompleteL(); |
|
106 |
|
107 private: // Data |
|
108 |
|
109 EUNIT_DECLARE_TEST_TABLE; |
|
110 |
|
111 TInetAddr iLocalAddr; |
|
112 CDeltaTimer* iDeltaTimer; |
|
113 RSocketServ iSocketServ; |
|
114 RConnection iConnection; |
|
115 RSocket iSocket; |
|
116 CSTUNClient* iSTUNClient; |
|
117 CNATBinding* iBinding; |
|
118 TBool iRequestCompleteCalled; |
|
119 TInt iRequestCompleteCode; |
|
120 TBool iPublicAddrResolvedCalled; |
|
121 TInt iLastFlowFailure; |
|
122 TBool iSendingNotAllowed; |
|
123 TBool iSendingCompletedCalled; |
|
124 }; |
|
125 |
|
126 #endif // UT_CNATBINDING_H |
|
127 |
|
128 // End of File |