sdkcreationmw/sdkruntimes/wsock/inc/WinsockProtocol.h
author Shabe Razvi <shaber@symbian.org>
Thu, 04 Nov 2010 17:22:05 +0000
changeset 4 b3b823debf08
parent 1 ac50fd48361b
permissions -rw-r--r--
Workaround for Bug 3917 - CWinsockInterface::DataSent calls NotifyDataSent which is not implemented.
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-2005 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
* which accompanies this distribution, and is available
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     6
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     7
* Initial Contributors:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     8
* Nokia Corporation - initial contribution.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     9
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    10
* Contributors:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    11
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    12
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    13
*/
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    14
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    15
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    16
#ifndef _WSOCK_PROTOCOL_H_
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    17
#define _WSOCK_PROTOCOL_H_
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    18
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    19
#include <nifif.h>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    20
#include <es_prot.h>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    21
#include <time.h>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    22
#include "WinsockInterface.h"
1
ac50fd48361b Second Contribution
rajpuroh
parents: 0
diff changeset
    23
#include <es_prot_internal.h>
ac50fd48361b Second Contribution
rajpuroh
parents: 0
diff changeset
    24
#include <nifif_internal.h>
ac50fd48361b Second Contribution
rajpuroh
parents: 0
diff changeset
    25
0
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    26
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    27
// IpHlpApi.dll data structures, needed by GetAdaptersInfo
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    28
typedef struct _WinsockIpAddressString {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    29
    TText8 String[16];
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    30
} WinsockIpAddressString;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    31
typedef struct _WinsockIpAddrString {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    32
    struct _WinsockIpAddrString* Next;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    33
    WinsockIpAddressString IpAddress;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    34
    WinsockIpAddressString IpMask;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    35
    TUint32 Context;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    36
} WinsockIpAddrString;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    37
typedef struct _WinsockIpAdapterInfo {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    38
    struct _WinsockIpAdapterInfo* Next;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    39
    TUint32 ComboIndex;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    40
    TText8 AdapterName[260];
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    41
    TText8 Description[132];
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    42
    TUint AddressLength;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    43
    TUint8 Address[8];
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    44
    TUint32 Index;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    45
    TUint Type;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    46
    TUint DhcpEnabled;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    47
    WinsockIpAddrString* CurrentIpAddress;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    48
    WinsockIpAddrString IpAddressList;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    49
    WinsockIpAddrString GatewayList;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    50
    WinsockIpAddrString DhcpServer;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    51
    TBool HaveWins;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    52
    WinsockIpAddrString PrimaryWinsServer;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    53
    WinsockIpAddrString SecondaryWinsServer;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    54
    time_t LeaseObtained;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    55
    time_t LeaseExpires;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    56
} WinsockIpAdapterInfo;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    57
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    58
// CWinsockProtocol
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    59
struct TWinProtocolDesc;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    60
class CWinsockServProvider;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    61
class CWinsockProtocol : public CProtocolBase, public MNifIfUser
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    62
{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    63
    typedef TUint (__stdcall* GetAdaptersInfoProc)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    64
        (WinsockIpAdapterInfo* aAdapterInfo, TUint* aOutBufLen);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    65
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    66
private:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    67
    MNifIfNotify* iIfNotify;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    68
    CWinsockInterface* iWinsockInterface;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    69
    const TWinProtocolDesc* iProtocolDesc;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    70
    RPointerArray<CWinsockServProvider> iReadPending;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    71
    void* iIpHlpApi;        // Handle to IPHLPAPI.DLL
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    72
    GetAdaptersInfoProc iGetAdapterInfo; // Pointer to GetAdaptersInfo
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    73
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    74
public:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    75
    CWinsockProtocol(const TWinProtocolDesc* aProtocolDesc);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    76
    virtual ~CWinsockProtocol();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    77
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    78
    const TWinProtocolDesc* ProtocolDesc() const;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    79
    TBool IsStreamProtocol() const;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    80
    TBool IsDatagramProtocol() const;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    81
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    82
    void DataSent(TUint aBytes);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    83
    void DataReceived(TUint aBytes);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    84
    WinsockIpAdapterInfo* GetAdapterInfo();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    85
    void SetReadPending(CWinsockServProvider* aSocket, TBool aPending);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    86
    TBool ReadPending() const;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    87
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    88
    // CProtocolBase
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    89
    virtual CServProviderBase* NewSAPL(TUint aSockType);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    90
    virtual CHostResolvProvdBase* NewHostResolverL();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    91
    virtual void Identify(TServerProtocolDesc* aProtocolDesc) const;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    92
    virtual TInt GetOption(TUint aLevel,TUint aName,TDes8& aOption,CProtocolBase* aSourceProtocol);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    93
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    94
    // MNifIfUser
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    95
    virtual void IfUserBindFailure(TInt aResult, TAny* aId);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    96
    virtual void IfUserNewInterfaceL(CNifIfBase* aIf, TAny* aId);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    97
    virtual void IfUserInterfaceDown(TInt aResult, CNifIfBase* aIf);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    98
    virtual void IfUserOpenNetworkLayer();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    99
    virtual void IfUserCloseNetworkLayer();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   100
    virtual CProtocolBase* IfUserProtocol();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   101
    virtual TBool IfUserIsNetworkLayerActive();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   102
};
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   103
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   104
// Inline methods
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   105
inline const TWinProtocolDesc* CWinsockProtocol::ProtocolDesc() const
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   106
    { return iProtocolDesc; }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   107
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   108
#endif // _WSOCK_PROTOCOL_H_
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   109
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   110
/**
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   111
 * Local Variables:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   112
 * mode: c++
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   113
 * c-basic-offset: 4
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   114
 * indent-tabs-mode: nil
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   115
 * End:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   116
 */