sdkcreationmw/sdkruntimes/new_wsock_3pc/inc/winsockBinders.h
changeset 2 82fb8aa91b2c
equal deleted inserted replaced
1:ac50fd48361b 2:82fb8aa91b2c
       
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // tunnelnif.h 
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file 
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 #ifndef WINSOCKBINDERS_H__
       
    24 #define WINSOCKBINDERS_H__
       
    25 
       
    26 #include <comms-infras/nifif.h>
       
    27 #include <in6_if.h>
       
    28 #include <eui_addr.h>	// TE64Addr
       
    29 #include <comms-infras/ss_flowbinders.h>
       
    30 #include <comms-infras/ss_nodemessages.h>
       
    31 #include "winsockflow.h"				// for CTunnelNcp::Info()
       
    32 
       
    33 using namespace ESock;
       
    34 
       
    35 const TInt KWinsockMtu = 1500;
       
    36 
       
    37 class CWinsockFlow;
       
    38 
       
    39 NONSHARABLE_CLASS(CWinsockNcp) : public CBase, public ESock::MLowerDataSender, public ESock::MLowerControl
       
    40 	{
       
    41 public:
       
    42 	// from MLowerControl
       
    43 	virtual TInt GetName(TDes& aName);
       
    44 	virtual TInt BlockFlow(ESock::MLowerControl::TBlockOption /*aOption*/);
       
    45 
       
    46 	// from MLowerDataSender
       
    47 	virtual ESock::MLowerDataSender::TSendResult Send(RMBufChain& aPdu);
       
    48 
       
    49 	// Utility functions called from CTunnelFlow
       
    50 	ESock::MLowerDataSender* Bind(ESock::MUpperDataReceiver* aUpperReceiver, ESock::MUpperControl* aUpperControl);
       
    51 	void Unbind(ESock::MUpperDataReceiver* aUpperReceiver, ESock::MUpperControl* aUpperControl);
       
    52 	TBool MatchesUpperControl(const ESock::MUpperControl* aUpperControl);
       
    53 	void StartSending();
       
    54 
       
    55 protected:
       
    56 	CWinsockNcp(CWinsockFlow& aFlow);
       
    57 	inline const TWinsockInfo* Info();
       
    58 
       
    59 protected:
       
    60     CWinsockFlow* iFlow;
       
    61 	
       
    62     TInetAddr iNameSer1;
       
    63 	TInetAddr iNameSer2;
       
    64 
       
    65 	ESock::MUpperControl* iUpperControl;
       
    66 	ESock::MUpperDataReceiver* iUpperReceiver;
       
    67 	};
       
    68 
       
    69 // ======================================================================================
       
    70 
       
    71 NONSHARABLE_CLASS(CWinsockNcp4) : public CWinsockNcp
       
    72 	{
       
    73 public:
       
    74 	static CWinsockNcp4* ConstructL(CWinsockFlow& aLink);
       
    75 
       
    76 	// from MLowerDataSender
       
    77 	virtual TInt GetConfig(TBinderConfig& aConfig);
       
    78 	virtual TInt Control(TUint, TUint, TDes8&);
       
    79 	//
       
    80 
       
    81 	virtual TInt Notification(TWinsockAgentMessage::TTunnelSetAddress& aMessage);
       
    82 
       
    83 private:
       
    84     CWinsockNcp4(CWinsockFlow& aLink);
       
    85 
       
    86 	TUint32 iLocalAddress;
       
    87 	};
       
    88 
       
    89 // ======================================================================================
       
    90 
       
    91 NONSHARABLE_CLASS(CWinsockNcp6) : public CWinsockNcp
       
    92 	{
       
    93 public:
       
    94 	static CWinsockNcp6* ConstructL(CWinsockFlow& aLink);
       
    95 
       
    96 	// from MLowerDataSender
       
    97 	virtual TInt GetConfig(TBinderConfig& aConfig);
       
    98 	virtual TInt Control(TUint, TUint, TDes8&);
       
    99 	//
       
   100 
       
   101 	virtual TInt Notification(TWinsockAgentMessage::TTunnelSetAddress& aMessage);
       
   102 
       
   103 private:
       
   104     CWinsockNcp6(CWinsockFlow& aLink);
       
   105 
       
   106 	TInetAddr iLocalAddress;
       
   107 	};
       
   108 
       
   109 // ======================================================================================
       
   110 
       
   111 class CWinsockNcpLog : public CBase
       
   112 	{
       
   113 public:
       
   114 	static void Write(const TDesC& aDes);
       
   115 	static void Printf(TRefByValue<const TDesC> aFmt, ...);
       
   116 	};
       
   117 
       
   118 //
       
   119 // Inline functions
       
   120 //
       
   121 
       
   122 inline const TWinsockInfo* CWinsockNcp::Info()
       
   123 	{
       
   124 	return iFlow->Info();
       
   125 	}
       
   126 
       
   127 #endif