vpnengine/sit/inc/sit.h
changeset 0 33413c0669b9
equal deleted inserted replaced
-1:000000000000 0:33413c0669b9
       
     1 /*
       
     2 * Copyright (c) 2003 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: Socket Interaction Thread implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __SIT_H__
       
    21 #define __SIT_H__
       
    22 
       
    23 #include <e32std.h>
       
    24 #include <e32base.h>
       
    25 
       
    26 #include "eventmediatorapi.h"
       
    27 #include "sitdeathobserver.h"
       
    28 
       
    29 #ifndef TRAP_IGNORE
       
    30 #define TRAP_IGNORE(_s) {TInt _ignore;TTrap __t;if (__t.Trap(_ignore)==0){_s;TTrap::UnTrap();}}
       
    31 #endif
       
    32 
       
    33 _LIT(KSitName, "SocketInteractionThread");
       
    34 
       
    35 static const TUid KUidSit = {0x101FD28D};
       
    36 
       
    37 enum TSitPanic
       
    38     {
       
    39     EPanicUnknownEventType = 1,
       
    40     EPanicInvalidTaskHandlerState,
       
    41     EPanicUnexpectedEventOccured                             
       
    42     };
       
    43 
       
    44 const TUint KSitMaxHeapSize = 0x80000;  // 512 kB
       
    45 
       
    46 /**
       
    47  * Socket Interaction Thread implementation
       
    48  */
       
    49 class CSit : public CBase, public MSitDeathListener
       
    50     {
       
    51 /**
       
    52  ** @internalComponent
       
    53  */
       
    54 public:
       
    55     IMPORT_C CSit(MSitDeathListener* aSitDeathListener);
       
    56     IMPORT_C ~CSit();
       
    57 
       
    58     IMPORT_C void StartL();
       
    59     IMPORT_C static TBool EventRequiresSit(TEventType aEventType);
       
    60     IMPORT_C TThreadId ThreadId();
       
    61     IMPORT_C static TEventType FindTaskRequestEventType(TEventType aCancelEventType);
       
    62     IMPORT_C static TEventType FindCancelEventType(TEventType aTaskRequestEventType);
       
    63     IMPORT_C static TBool IsTaskCancellationObservationRequest(TEventType aEventType);
       
    64     
       
    65 public: // From MSitDeathListener    
       
    66     void SitDied();
       
    67     
       
    68 public:    
       
    69     static HBufC16* To16BitL(const TDesC8& aDes);
       
    70 
       
    71 private:
       
    72     void StartWorkingL();
       
    73     void StartThreadL();
       
    74    
       
    75     static TInt ThreadFunction(TAny* aParameters);
       
    76 
       
    77 private:
       
    78     RThread* iTaskThread;
       
    79 
       
    80     CSitDeathObserver* iSitDeathObserver;
       
    81     MSitDeathListener* iSitDeathListener;
       
    82 
       
    83     TEventType iEventType;
       
    84     };
       
    85 
       
    86 #endif // __SIT_H__