sdkcreationmw/sdkruntimes/wsock/inc/wsock.h
author rajpuroh
Mon, 08 Mar 2010 12:09:11 +0530
changeset 0 b26acd06ea60
child 1 ac50fd48361b
permissions -rw-r--r--
First Contribution of SDK components
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     1
/*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     2
* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     3
* All rights reserved.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     4
* This component and the accompanying materials are made available
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     6
* which accompanies this distribution, and is available
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     8
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     9
* Initial Contributors:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    11
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    12
* Contributors:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    13
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    14
* Description: 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    15
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    16
*/
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    17
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    18
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    19
#ifndef _WSOCK_WSOCK_H_
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    20
#define _WSOCK_WSOCK_H_
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    21
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    22
#ifdef _DEBUG
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    23
#  include <e32svr.h>  // defines RDebug
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    24
#endif // _DEBUG
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    25
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    26
#include <cdbcols.h>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    27
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    28
// files that redefine ASSERT macro
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    29
#include <e32def.h>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    30
#include <vwsdef.h>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    31
#include <mda/common/base.h>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    32
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    33
#define N(x) ((TInt)(sizeof(x)/sizeof((x)[0])))
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    34
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    35
#ifndef _REALLY_DEBUG
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    36
#  if defined(_DEBUG) && defined(WSOCK_ENABLE_DEBUG_TRACE)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    37
#    define _REALLY_DEBUG
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    38
#  endif // _DEBUG && WSOCK_ENABLE_DEBUG_TRACE
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    39
#endif // _REALLY_DEBUG
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    40
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    41
//===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    42
// Debug trace
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    43
//===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    44
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    45
#ifdef _UNICODE
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    46
#  define __T(a,b) a L##b
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    47
#else  // _UNICODE
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    48
#  define __T(a,b) a b
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    49
#endif // _UNICODE
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    50
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    51
#ifdef _REALLY_DEBUG
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    52
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    53
#  ifdef TRACE_PREFIX
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    54
#    define ___L(z) _L(z)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    55
#    define __L(z) ___L(__T(TRACE_PREFIX,z))
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    56
#  else
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    57
#    define __L(z) _L(z)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    58
#  endif // TRACE_PREFIX
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    59
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    60
#  define TRACE(s)                  RDebug::Print(__L("%s"),_S(s))
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    61
#  define TRACE0(s)                 RDebug::Print(__L("%s"),_S(s))
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    62
#  define TRACE1(s,p1)              RDebug::Print(__L(s),p1)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    63
#  define TRACE2(s,p1,p2)           RDebug::Print(__L(s),p1,p2)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    64
#  define TRACE3(s,p1,p2,p3)        RDebug::Print(__L(s),p1,p2,p3)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    65
#  define TRACE4(s,p1,p2,p3,p4)     RDebug::Print(__L(s),p1,p2,p3,p4)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    66
#  define TRACE5(s,p1,p2,p3,p4,p5)  RDebug::Print(__L(s),p1,p2,p3,p4,p5)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    67
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    68
#  define DEBUG_ONLY(x)             x
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    69
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    70
#else  /* !_DEBUG */
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    71
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    72
#  define TRACE(s)                  ((void)0)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    73
#  define TRACE0(s)                 ((void)0)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    74
#  define TRACE1(s,p1)              ((void)0)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    75
#  define TRACE2(s,p1,p2)           ((void)0)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    76
#  define TRACE3(s,p1,p2,p3)        ((void)0)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    77
#  define TRACE4(s,p1,p2,p3,p4)     ((void)0)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    78
#  define TRACE5(s,p1,p2,p3,p4,p5)  ((void)0)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    79
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    80
#  define DEBUG_ONLY(x)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    81
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    82
#endif /* !_DEBUG */
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    83
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    84
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    85
#define WTRACE(s)               	TRACE1(__T("[%08X] ",s),this)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    86
#define WTRACE0(s)              	TRACE1(__T("[%08X] ",s),this)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    87
#define WTRACE1(s,p1)           	TRACE2(__T("[%08X] ",s),this,p1)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    88
#define WTRACE2(s,p1,p2)        	TRACE3(__T("[%08X] ",s),this,p1,p2)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    89
#define WTRACE3(s,p1,p2,p3)     	TRACE4(__T("[%08X] ",s),this,p1,p2,p3)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    90
#define WTRACE4(s,p1,p2,p3,p4)  	TRACE5(__T("[%08X] ",s),this,p1,p2,p3,p4)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    91
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    92
//===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    93
// Debug assert
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    94
//===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    95
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    96
#undef ASSERT
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    97
#ifdef _REALLY_DEBUG
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    98
void WsockAssert(const TText* s,const TText* file,TInt line);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    99
TInt WsockAssertSuccess(TInt err,const TText* s,const TText* file,TInt line);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   100
void WsockLeave(TInt err,const TText* s,const TText* file,TInt line);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   101
void WsockLeaveIfError(TInt err,const TText* s,const TText* file,TInt line);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   102
#  define __S(x) _S(x)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   103
#  define ASSERT(x) ((void)((x)||(WsockAssert(_S(#x),__S(__FILE__),__LINE__),0),0))
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   104
#  define LEAVE(x) WsockLeave(x,_S(#x),__S(__FILE__),__LINE__)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   105
#  define LEAVE_IF_ERROR(x) WsockLeaveIfError(x,_S(#x),__S(__FILE__),__LINE__)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   106
#  define ASSERT_SUCCESS(x) WsockAssertSuccess(x,_S(#x),__S(__FILE__),__LINE__)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   107
#  define VERIFY_SUCCESS(x) ASSERT_SUCCESS(x)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   108
#else  // _DEBUG
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   109
#  define ASSERT(x)         ((void)0)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   110
#  define LEAVE(x)          User::Leave(x)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   111
#  define LEAVE_IF_ERROR(x) User::LeaveIfError(x)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   112
#  define ASSERT_SUCCESS(x) ((void)0)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   113
#  define VERIFY_SUCCESS(x) (x)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   114
#endif // _DEBUG
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   115
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   116
//===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   117
// Constants
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   118
//===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   119
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   120
#define WSOCK_LAN_SERVICE 1
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   121
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   122
// Names of the modules
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   123
_LIT(KWinsockAgent,"wsocka");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   124
_LIT(KWinsockInterface,"wsocki");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   125
_LIT(KWinsockProtocol,"wsock");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   126
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   127
// CommDb constants
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   128
_LIT(KWinsockConnectionName,"Winsock");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   129
_LIT(KWinsockAPName,"Winsock");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   130
_LIT(KWinsockBearerName,"Winsock");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   131
_LIT(KWinsockBearerType,"LANBearer");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   132
_LIT(KWinsockWapBearer,"WAPIPBearer");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   133
_LIT(KWinsockGatewayAddress,"0.0.0.0");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   134
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   135
#ifdef WSOCK_LAN_SERVICE
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   136
_LIT(KWinsockServiceType,"LANService");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   137
_LIT(KWinsockServiceName,"Winsock");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   138
#else // ! WSOCK_LAN_SERVICE
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   139
_LIT(KWinsockServiceType,"OutgoingGPRS");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   140
_LIT(KWinsockServiceName,"Winsock Service");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   141
#endif // !WSOCK_LAN_SERVICE
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   142
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   143
const TUint32 KWinsockSocketActivityTimeout = (TUint32)-1;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   144
const TUint32 KWinsockSessionClosedTimeout = (TUint32)-1;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   145
const TUint32 KWinsockSocketClosedTimeout = (TUint32)-1;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   146
const TUint32 KWinsockAPType = EIspTypeInternetAndWAP;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   147
#define KWinsockPdpType RPacketContext::EPdpTypeIPv6 // defined in etelpckt.h
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   148
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   149
//===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   150
// Internal API
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   151
//===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   152
void WsockCheckCommDbL(TUint32& aIapId,
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   153
                       TUint32& aNetworkId,
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   154
                       TUint32& aServiceId,
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   155
                       TUint32& aBearerId);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   156
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   157
//===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   158
// Functions exported from wsock.dll
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   159
//===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   160
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   161
class CProtocolFamilyBase;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   162
class CNifAgentFactory;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   163
class CNifIfFactory;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   164
class CNetworkControllerBase;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   165
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   166
extern "C" {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   167
    IMPORT_C CProtocolFamilyBase* WsockCreateProtocolFamily(void);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   168
    IMPORT_C CNifAgentFactory* WsockCreateAgentFactory(void);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   169
    IMPORT_C CNifIfFactory* WsockCreateInterfaceFactory(void);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   170
    IMPORT_C TInt WsockQueryConfiguration(TBool&, HBufC*&, TUint&);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   171
    IMPORT_C TInt WsockSetConfiguration(TBool, TBool, const TDesC*, TUint);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   172
    IMPORT_C CProtocolFamilyBase* WsockCreateProtocolFamily6(void);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   173
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   174
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   175
#endif // _WSOCK_WSOCK_H_