sdkcreationmw/sdkruntimes/wsock/inc/WinsockSelectThread.h
author rajpuroh
Wed, 21 Apr 2010 09:56:53 +0530
changeset 1 ac50fd48361b
parent 0 b26acd06ea60
permissions -rw-r--r--
Second Contribution
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
1
ac50fd48361b Second Contribution
rajpuroh
parents: 0
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
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
*
1
ac50fd48361b Second Contribution
rajpuroh
parents: 0
diff changeset
    14
* Description:
0
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_READ_THREAD_H_
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    20
#define _WSOCK_READ_THREAD_H_
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    21
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    22
#include <e32std.h>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    23
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    24
enum TSelectMask
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    25
{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    26
    ESelectRead  = 0x0001,
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    27
    ESelectWrite = 0x0002,
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    28
    ESelectError = 0x0004
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    29
};
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    30
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    31
class MSelectRequest
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    32
{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    33
public:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    34
    virtual TUint Socket() = 0;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    35
    virtual TInt SelectMask() = 0;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    36
    virtual void SelectComplete(TInt aMask) = 0;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    37
};
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    38
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    39
class CWinsockSelectThread : public CBase
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    40
{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    41
private:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    42
    RCriticalSection iCriticalSection;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    43
    RThread iThread;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    44
    TBool iCriticalSectionCreated;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    45
    RPointerArray<MSelectRequest> iRequests;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    46
    TUint iUnblockSocket;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    47
    struct timeval* iTimeout;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    48
    union {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    49
        struct sockaddr* iSockAddr;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    50
        struct sockaddr_in* iSockAddrIn;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    51
    } iAddr;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    52
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    53
public:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    54
    static CWinsockSelectThread* Static();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    55
    static CWinsockSelectThread& StaticL();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    56
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    57
    TInt Submit(MSelectRequest* aRequest);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    58
    TBool Cancel(MSelectRequest* aRequest);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    59
private:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    60
    static CWinsockSelectThread* NewL();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    61
    CWinsockSelectThread();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    62
    virtual ~CWinsockSelectThread();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    63
    void ConstructL();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    64
    static TInt Run(TAny *aPtr);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    65
    void RunL();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    66
    TBool Wakeup();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    67
};
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    68
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    69
#endif // _WSOCK_READ_THREAD_H_