plugins/networking/winsockprt/src/wsp_subsession.cpp
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // wsp_subsession.cpp
       
     2 // 
       
     3 // Copyright (c) 2002 - 2010 Accenture. All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of the "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 // Accenture - Initial contribution
       
    11 //
       
    12 
       
    13 
       
    14 #include "wsp_subsession.h"
       
    15 #include "wsp_session.h"
       
    16 #include "wsp_panic.h"
       
    17 
       
    18 
       
    19 //
       
    20 // RWin32SubSession.
       
    21 //
       
    22 
       
    23 void RWin32SubSession::Close()
       
    24 	{
       
    25 	if (iSession->iThread.Handle())
       
    26 		{
       
    27 		TPckgC<TInt> handlePckg(iHandle);
       
    28 		iWin32Message.Set(CWin32Session::ECloseSubSession, handlePckg);
       
    29 		iSession->iRequest.MakeRequest(iWin32Message);
       
    30 		}
       
    31 	}
       
    32 
       
    33 TInt RWin32SubSession::CreateSubSession(RWin32Session& aSession, TInt aOppCode)
       
    34 	{
       
    35 	TPckg<TInt> handleBuf(iHandle);
       
    36 	iWin32Message.Set(aOppCode, handleBuf);
       
    37 	TInt err = aSession.MakeRequest(iWin32Message);
       
    38 	if (err == KErrNone)
       
    39 		{
       
    40 		iSession = &aSession;
       
    41 		}
       
    42 	return err;
       
    43 	}
       
    44 
       
    45 TInt RWin32SubSession::CreateSubSession(RWin32Session& aSession, TInt aOppCode, const TDesC8& aReadBuf)
       
    46 	{
       
    47 	TPckg<TInt> handleBuf(iHandle);
       
    48 	iWin32Message.Set(aOppCode, aReadBuf, handleBuf);
       
    49 	TInt err = aSession.MakeRequest(iWin32Message);
       
    50 	if (err == KErrNone)
       
    51 		{
       
    52 		iSession = &aSession;
       
    53 		}
       
    54 	return err;
       
    55 	}
       
    56 
       
    57 
       
    58 TInt RWin32SubSession::MakeRequest(TWin32Message& aMessage) const
       
    59 	{
       
    60 	return iSession->iRequest.MakeRequest(aMessage, iHandle);
       
    61 	}
       
    62 
       
    63 
       
    64 //
       
    65 // CWin32SubSession.
       
    66 //
       
    67 
       
    68 CWin32SubSession::CWin32SubSession(CWin32Scheduler& aScheduler)
       
    69 	: CWin32ActiveObject(aScheduler)
       
    70 	{
       
    71 	}
       
    72 
       
    73 void CWin32SubSession::Complete(TWin32Message*& aMessage, TInt aReason) const
       
    74 	{
       
    75 	__ASSERT_DEBUG(aMessage, Panic(EWinSockPrtSubSessionInvalidMessage));
       
    76 	aMessage->Complete(aReason);
       
    77 	aMessage = NULL;
       
    78 	}