|
1 /* |
|
2 * Copyright (c) 2004-2007 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 _WSOCK_WSOCK_H_ |
|
20 #define _WSOCK_WSOCK_H_ |
|
21 |
|
22 #ifdef _DEBUG |
|
23 # include <e32svr.h> // defines RDebug |
|
24 #endif // _DEBUG |
|
25 |
|
26 #include <cdbcols.h> |
|
27 |
|
28 // files that redefine ASSERT macro |
|
29 #include <e32def.h> |
|
30 #include <vwsdef.h> |
|
31 #include <mda/common/base.h> |
|
32 |
|
33 #define N(x) ((TInt)(sizeof(x)/sizeof((x)[0]))) |
|
34 |
|
35 #ifndef _REALLY_DEBUG |
|
36 # if defined(_DEBUG) && defined(WSOCK_ENABLE_DEBUG_TRACE) |
|
37 # define _REALLY_DEBUG |
|
38 # endif // _DEBUG && WSOCK_ENABLE_DEBUG_TRACE |
|
39 #endif // _REALLY_DEBUG |
|
40 |
|
41 //=========================================================================== |
|
42 // Debug trace |
|
43 //=========================================================================== |
|
44 |
|
45 #ifdef _UNICODE |
|
46 # define __T(a,b) a L##b |
|
47 #else // _UNICODE |
|
48 # define __T(a,b) a b |
|
49 #endif // _UNICODE |
|
50 |
|
51 #ifdef _REALLY_DEBUG |
|
52 |
|
53 # ifdef TRACE_PREFIX |
|
54 # define ___L(z) _L(z) |
|
55 # define __L(z) ___L(__T(TRACE_PREFIX,z)) |
|
56 # else |
|
57 # define __L(z) _L(z) |
|
58 # endif // TRACE_PREFIX |
|
59 |
|
60 # define TRACE(s) RDebug::Print(__L("%s"),_S(s)) |
|
61 # define TRACE0(s) RDebug::Print(__L("%s"),_S(s)) |
|
62 # define TRACE1(s,p1) RDebug::Print(__L(s),p1) |
|
63 # define TRACE2(s,p1,p2) RDebug::Print(__L(s),p1,p2) |
|
64 # define TRACE3(s,p1,p2,p3) RDebug::Print(__L(s),p1,p2,p3) |
|
65 # define TRACE4(s,p1,p2,p3,p4) RDebug::Print(__L(s),p1,p2,p3,p4) |
|
66 # define TRACE5(s,p1,p2,p3,p4,p5) RDebug::Print(__L(s),p1,p2,p3,p4,p5) |
|
67 |
|
68 # define DEBUG_ONLY(x) x |
|
69 |
|
70 #else /* !_DEBUG */ |
|
71 |
|
72 # define TRACE(s) ((void)0) |
|
73 # define TRACE0(s) ((void)0) |
|
74 # define TRACE1(s,p1) ((void)0) |
|
75 # define TRACE2(s,p1,p2) ((void)0) |
|
76 # define TRACE3(s,p1,p2,p3) ((void)0) |
|
77 # define TRACE4(s,p1,p2,p3,p4) ((void)0) |
|
78 # define TRACE5(s,p1,p2,p3,p4,p5) ((void)0) |
|
79 |
|
80 # define DEBUG_ONLY(x) |
|
81 |
|
82 #endif /* !_DEBUG */ |
|
83 |
|
84 |
|
85 #define WTRACE(s) TRACE1(__T("[%08X] ",s),this) |
|
86 #define WTRACE0(s) TRACE1(__T("[%08X] ",s),this) |
|
87 #define WTRACE1(s,p1) TRACE2(__T("[%08X] ",s),this,p1) |
|
88 #define WTRACE2(s,p1,p2) TRACE3(__T("[%08X] ",s),this,p1,p2) |
|
89 #define WTRACE3(s,p1,p2,p3) TRACE4(__T("[%08X] ",s),this,p1,p2,p3) |
|
90 #define WTRACE4(s,p1,p2,p3,p4) TRACE5(__T("[%08X] ",s),this,p1,p2,p3,p4) |
|
91 |
|
92 //=========================================================================== |
|
93 // Debug assert |
|
94 //=========================================================================== |
|
95 |
|
96 #undef ASSERT |
|
97 #ifdef _REALLY_DEBUG |
|
98 void WsockAssert(const TText* s,const TText* file,TInt line); |
|
99 TInt WsockAssertSuccess(TInt err,const TText* s,const TText* file,TInt line); |
|
100 void WsockLeave(TInt err,const TText* s,const TText* file,TInt line); |
|
101 void WsockLeaveIfError(TInt err,const TText* s,const TText* file,TInt line); |
|
102 # define __S(x) _S(x) |
|
103 # define ASSERT(x) ((void)((x)||(WsockAssert(_S(#x),__S(__FILE__),__LINE__),0),0)) |
|
104 # define LEAVE(x) WsockLeave(x,_S(#x),__S(__FILE__),__LINE__) |
|
105 # define LEAVE_IF_ERROR(x) WsockLeaveIfError(x,_S(#x),__S(__FILE__),__LINE__) |
|
106 # define ASSERT_SUCCESS(x) WsockAssertSuccess(x,_S(#x),__S(__FILE__),__LINE__) |
|
107 # define VERIFY_SUCCESS(x) ASSERT_SUCCESS(x) |
|
108 #else // _DEBUG |
|
109 # define ASSERT(x) ((void)0) |
|
110 # define LEAVE(x) User::Leave(x) |
|
111 # define LEAVE_IF_ERROR(x) User::LeaveIfError(x) |
|
112 # define ASSERT_SUCCESS(x) ((void)0) |
|
113 # define VERIFY_SUCCESS(x) (x) |
|
114 #endif // _DEBUG |
|
115 |
|
116 //=========================================================================== |
|
117 // Constants |
|
118 //=========================================================================== |
|
119 |
|
120 #define WSOCK_LAN_SERVICE 1 |
|
121 |
|
122 // Names of the modules |
|
123 _LIT(KWinsockAgent,"wsocka"); |
|
124 _LIT(KWinsockInterface,"wsocki"); |
|
125 _LIT(KWinsockProtocol,"wsock"); |
|
126 |
|
127 // CommDb constants |
|
128 _LIT(KWinsockConnectionName,"Winsock"); |
|
129 _LIT(KWinsockAPName,"Winsock"); |
|
130 _LIT(KWinsockBearerName,"Winsock"); |
|
131 _LIT(KWinsockBearerType,"LANBearer"); |
|
132 _LIT(KWinsockWapBearer,"WAPIPBearer"); |
|
133 _LIT(KWinsockGatewayAddress,"0.0.0.0"); |
|
134 |
|
135 #ifdef WSOCK_LAN_SERVICE |
|
136 _LIT(KWinsockServiceType,"LANService"); |
|
137 _LIT(KWinsockServiceName,"Winsock"); |
|
138 #else // ! WSOCK_LAN_SERVICE |
|
139 _LIT(KWinsockServiceType,"OutgoingGPRS"); |
|
140 _LIT(KWinsockServiceName,"Winsock Service"); |
|
141 #endif // !WSOCK_LAN_SERVICE |
|
142 |
|
143 const TUint32 KWinsockSocketActivityTimeout = (TUint32)-1; |
|
144 const TUint32 KWinsockSessionClosedTimeout = (TUint32)-1; |
|
145 const TUint32 KWinsockSocketClosedTimeout = (TUint32)-1; |
|
146 const TUint32 KWinsockAPType = EIspTypeInternetAndWAP; |
|
147 #define KWinsockPdpType RPacketContext::EPdpTypeIPv6 // defined in etelpckt.h |
|
148 |
|
149 //=========================================================================== |
|
150 // Internal API |
|
151 //=========================================================================== |
|
152 void WsockCheckCommDbL(TUint32& aIapId, |
|
153 TUint32& aNetworkId, |
|
154 TUint32& aServiceId, |
|
155 TUint32& aBearerId); |
|
156 |
|
157 //=========================================================================== |
|
158 // Functions exported from wsock.dll |
|
159 //=========================================================================== |
|
160 |
|
161 class CProtocolFamilyBase; |
|
162 class CNifAgentFactory; |
|
163 class CNifIfFactory; |
|
164 class CNetworkControllerBase; |
|
165 |
|
166 extern "C" { |
|
167 IMPORT_C CProtocolFamilyBase* WsockCreateProtocolFamily(void); |
|
168 IMPORT_C CNifAgentFactory* WsockCreateAgentFactory(void); |
|
169 IMPORT_C CNifIfFactory* WsockCreateInterfaceFactory(void); |
|
170 IMPORT_C TInt WsockQueryConfiguration(TBool&, HBufC*&, TUint&); |
|
171 IMPORT_C TInt WsockSetConfiguration(TBool, TBool, const TDesC*, TUint); |
|
172 IMPORT_C CProtocolFamilyBase* WsockCreateProtocolFamily6(void); |
|
173 } |
|
174 |
|
175 #endif // _WSOCK_WSOCK_H_ |