# HG changeset patch # User rajpuroh # Date 1271826145 -19800 # Node ID 82fb8aa91b2cc39618a125db02c403ca0035edbc # Parent ac50fd48361b437c94b3fe3b7cf6dfc9e1a6d7f9 Winsock 3 PC Arch Contribution diff -r ac50fd48361b -r 82fb8aa91b2c sdkcreationmw/sdkruntimes/new_wsock_3pc/.project --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdkcreationmw/sdkruntimes/new_wsock_3pc/.project Wed Apr 21 10:32:25 2010 +0530 @@ -0,0 +1,20 @@ + + + wsock_3pc + + + + + + com.nokia.carbide.cdt.builder.carbideCPPBuilder + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + com.nokia.carbide.cdt.builder.carbideCPPBuilderNature + com.nokia.carbide.cdt.builder.carbideSBSv2BuilderNature + + diff -r ac50fd48361b -r 82fb8aa91b2c sdkcreationmw/sdkruntimes/new_wsock_3pc/data/meshpreface1.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdkcreationmw/sdkruntimes/new_wsock_3pc/data/meshpreface1.cfg Wed Apr 21 10:32:25 2010 +0530 @@ -0,0 +1,614 @@ +## +## Purpose of this file is to provide default configuration options for the new, +## access point aware code for all legacy configuration files which do not have +## it on their own. +## According to its purpose this file is being used only(!) ever (!) with legacy, +## non access point aware (or as it is also called in CommsDat: non mesh compatible) +## configurations. +## This means that for these configurations the only preferences used for selection +## are the link layer ones (IAP + connection preference ranking on implicit). +## None of the new preferences will ever make any sense on any system that does not +## provide the new configuration and will always be rejected! +## + +############################################################ +## GlobalSettings +## +## A new setting has been added to indicate the default Tier that should be referred to +## whenever a Tier setting is required but has not been specified. +## The deprecated global settings "DefaultSnap" and "PromptForSnap" are now held in the +## default tier record not in the global settings table itself +## +## + +[GlobalSettings] +ADD_TEMPLATE + DefaultTier=Link.TierTable.2048 + FIELD_COUNT=1 +END_TEMPLATE + + +############################################################ +## AccessPointTable +## +## Generally all of our (Symbian's) network layer providers (tier id == 2048) +## interpret their selection policy ids as records in the APPrioritySelectionPolicyTable. +## However, in this particular case below (and when using this file) we are always +## dealing with a legacy, link layer preferences and selection (please also see +## the comment above). +## Since none of the link preferences can ever be understood by the network layer +## selector, they always override the provider's own selection policy (as specified +## in the network layer access point, i.e. in the "NetworkDefault" record below this text). +## This is why the default network layer access point below does not need to have +## a APPrioritySelectionPolicyTable entry orresponding to its selection poincy id +## (this really is only an excepti on from the rule, it can never happen on a system +## configured to be access point aware!!!). +## + +[AccessPointTable] +ADD_SECTION +# COMMDB_ID = 254 + Id=10000 + Name=NetworkDefault + Tier=Link.TierTable.2048 + MCpr=MCprTable.1 + AccessPointSelectionPolicy=Link.APPrioritySelectionPolicyTable.20000 + Cpr=CprTable.1 + SCpr=SCprTable.7 + Protocol=ProtocolTable.1 + FIELD_COUNT=8 +END_ADD + +##This record here is the default record for the IPProto level APs generated by +##CommsDat. This record used as it is if the config file, which is processed +## after this config file, doesn't contain any ConnectionPreferences or +##IAPPrioritySelectionPolicy tables. +ADD_SECTION +# COMMDB_ID = 253 + Id=10001 + Name=IPProtoDefault + Tier=Link.TierTable.271064560 + MCpr=MCprTable.2 + AccessPointSelectionPolicy=0 + Cpr=CprTable.2 + SCpr=SCprTable.2 + Protocol=ProtocolTable.2 + ##this field value here is an indication that the config file doesn't have + ##any generated IPProto APs which means that there is no ConnPref or + ##IAPPrioritySelPol records. + CustomSelectionPolicy=-1 + FIELD_COUNT=9 +END_ADD + +ADD_SECTION +# COMMDB_ID = 252 + Id=10002 + Name=SIPDefault + Tier=Link.TierTable.536887799 + MCpr=MCprTable.11 + AccessPointSelectionPolicy=0 + Cpr=CprTable.5 + SCpr=SCprTable.8 + Protocol=ProtocolTable.2 + FIELD_COUNT=8 +END_ADD + + +############################################################ +## APPrioritySelectionPolicyTable +## + +[APPrioritySelectionPolicyTable] +ADD_SECTION +# COMMDB_ID = 254 + Id=20000 + Name=APSelPolNetworkDefault + ##This will be modified by CommsDat to point to the correct IPProto level APs + ##in the ranking order of IAPs in the ConnectionPreferences table, if there + ##is any. + AP1=Link.AccessPointTable.10001 + APCOUNT=1 + FIELD_COUNT=4 +END_ADD + + +############################################################ +## TierTable +## + +[TierTable] + +## Id=0x10281DD8 == 271064536 + +ADD_SECTION +# COMMDB_ID = 1 + Id=2048 + TierImplUid=271064536 + Name=Tier1 + TierThreadName= ESock_IP + TierManagerName= NetworkTierManager + DefaultAccessPoint=Link.AccessPointTable.10000 + PromptUser=0 + FIELD_COUNT=7 +END_ADD + +## Id=0x10281DF0 == 271064560 + +ADD_SECTION +# COMMDB_ID = 2 + Id=271064560 + TierImplUid=271064560 + Name=Tier2 + TierThreadName= ESock_IP + TierManagerName= ProtoTierManager + ##By default this is linked to the default AP on the IPProto layer + DefaultAccessPoint=Link.AccessPointTable.10001 + PromptUser=0 + FIELD_COUNT=7 +END_ADD + +## Id=0x10281DF5 == 271064565 + +ADD_SECTION +# COMMDB_ID = 3 + Id=271064565 + TierImplUid=271064565 + Name=Tier3 + TierThreadName= ESock_IP + TierManagerName= LinkTierManager + ##NB defaultAccessPoint not present in this layer. This is only needed here to satisfy the check + ##on the link layer. However important that once this field has a value it has to be linked to a + ##correct accesspoint record in the accesspoint table because this will be checked either. + DefaultAccessPoint=Link.AccessPointTable.10000 + PromptUser=0 + FIELD_COUNT=7 +END_ADD + +ADD_SECTION +# COMMDB_ID = 4 + Id=536887799 + TierImplUid=536887799 + Name=Tier4 + TierThreadName= ESock_SIP + TierManagerName= SIPTierManager + DefaultAccessPoint=Link.AccessPointTable.10002 + PromptUser= 0 + FIELD_COUNT=7 +END_ADD + +############################################################ +## MCprTable +## +[MCprTable] +ADD_SECTION +# COMMDB_ID = 1 + Name=netmcpr + MCprUid=0x10274547 + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 2 + Name=ipprotomcpr + MCprUid=0x10281DEE + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 3 + Name=pppmcpr + MCprUid=0x10281DEC + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 4 + Name=ethmcpr + MCprUid=0x10281DFC + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 5 + Name=rawipmcpr + MCprUid=0x10281E00 + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 6 + Name=tunnelmcpr + MCprUid=0x10281E02 + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 7 + Name=qospppmcpr + MCprUid=0x10281DEC + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 8 + Name=dummynifmcpr + MCprUid=0x10281E04 + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 9 + Name=hungrynifmcpr + MCprUid=0x10281E04 + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 10 + Name=pdpmcpr + MCprUid=0x102822F0 + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 11 + Name=sipmcpr + MCprUid=0x200041F9 + FIELD_COUNT=2 +END_ADD + +## PAN Ether MCpr Uid = 271070626 (0x102835A2) +ADD_SECTION +# COMMDB_ID = 13 + Name=panethermcpr + MCprUid=271070626 + FIELD_COUNT=2 +END_ADD + + +############################################################ +## CprTable +## +[CprTable] +ADD_SECTION +# COMMDB_ID = 1 + Name=ipcpr + CprUid=0x102070EF + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 2 + Name=ipprotocpr + CprUid=0x10281DD3 + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 3 + Name=agentcpr + CprUid=0x10281DE8 + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 4 + Name=vanillacpr + CprUid=0x102822F3 + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 5 + Name=sipcpr + CprUid=0x10274C38 + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 7 + Name=tunnelagentcpr + CprUid=271080968 + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 8 + Name=pdpcpr + CprUid=0x102822E2 + FIELD_COUNT=2 +END_ADD +############################################################ +## SCprTable +## +[SCprTable] +ADD_SECTION +# COMMDB_ID = 1 + Name=qosipscpr + SCprUid=0x10204308 + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 2 + Name=ipprotoscpr + SCprUid=0x10281DD1 + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 3 + Name=agentscpr + SCprUid=0x10281DEA + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 4 + Name=pdpscpr + SCprUid=0x102822E0 + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 5 + Name=pppscpr + SCprUid=0x102822FC + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 6 + Name=vanillascpr + SCprUid=0x102822F4 + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 7 + Name=qosscpr + SCprUid=0x102822D3 + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 8 + Name=sipscpr + SCprUid=0x10274C17 + FIELD_COUNT=2 +END_ADD + +############################################################ +## ProtocolTable +## +[ProtocolTable] +ADD_SECTION +# COMMDB_ID = 1 + Name=sapshim + ProtocolUid=0x101F7482 + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 2 + Name=ipshim4 + ProtocolUid=0x10281C36 + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 3 + Name=w3sock + ProtocolUid=0x10206FF4 #0x10206FF6 + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 4 + Name=ethernet + ProtocolUid=0x10281DDB + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 5 + Name=rawip + ProtocolUid=0x10281DF2 + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 6 + Name=tunnel + ProtocolUid=0x10281DF7 + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 7 + Name=qosppp + ProtocolUid=0x10281C54 + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 8 + Name=dummynif + ProtocolUid=0x10281C3B + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 9 + Name=hungrynif + ProtocolUid=0x10281C3D + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 10 + Name=panether + ProtocolUid=271070627 + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 11 + Name=rawip2 + ProtocolUid=0x10286AF8 + FIELD_COUNT=2 +END_ADD + +############################################################ +## BearerTypeTable +## +[BearerTypeTable] +ADD_SECTION +# COMMDB_ID = 1 + Name=wsock + Tier=Link.TierTable.271064565 + MCpr=MCprTable.8 + Cpr=CprTable.3 + SCpr=SCprTable.3 + Protocol=ProtocolTable.3 + FIELD_COUNT=6 +END_ADD + +ADD_SECTION +# COMMDB_ID = 2 + Name=ethint + Tier=Link.TierTable.271064565 + MCpr=MCprTable.4 + Cpr=CprTable.3 + SCpr=SCprTable.3 + Protocol=ProtocolTable.4 + FIELD_COUNT=6 +END_ADD + +ADD_SECTION +# COMMDB_ID = 3 + Name=rawip + Tier=Link.TierTable.271064565 + MCpr=MCprTable.5 + Cpr=CprTable.3 + SCpr=SCprTable.3 + Protocol=ProtocolTable.5 + FIELD_COUNT=6 +END_ADD + +ADD_SECTION +# COMMDB_ID = 4 + Name=tunnelnif + Tier=Link.TierTable.271064565 + MCpr=MCprTable.6 + Cpr=CprTable.7 + SCpr=SCprTable.3 + Protocol=ProtocolTable.6 + FIELD_COUNT=6 +END_ADD + +ADD_SECTION +# COMMDB_ID = 5 + Name=qosppp + Tier=Link.TierTable.271064565 + MCpr=MCprTable.7 + Cpr=CprTable.3 + SCpr=SCprTable.5 + Protocol=ProtocolTable.7 + FIELD_COUNT=6 +END_ADD + +ADD_SECTION +# COMMDB_ID = 6 + Name=dummynif + Tier=Link.TierTable.271064565 + MCpr=MCprTable.8 + Cpr=CprTable.3 + SCpr=SCprTable.3 + Protocol=ProtocolTable.8 + FIELD_COUNT=6 +END_ADD + +ADD_SECTION +# COMMDB_ID = 7 + Name=hungrynif + Tier=Link.TierTable.271064565 + MCpr=MCprTable.9 + Cpr=CprTable.3 + SCpr=SCprTable.3 + Protocol=ProtocolTable.9 + FIELD_COUNT=6 +END_ADD + +ADD_SECTION +# COMMDB_ID = 8 + Name=spud-ppp + Tier=Link.TierTable.271064565 + MCpr=MCprTable.10 + Cpr=CprTable.3 + SCpr=SCprTable.4 + Protocol=ProtocolTable.3 + FIELD_COUNT=6 +END_ADD + +ADD_SECTION +# COMMDB_ID = 9 + Name=spud-rawip + Tier=Link.TierTable.271064565 + MCpr=MCprTable.10 + Cpr=CprTable.3 + SCpr=SCprTable.4 + Protocol=ProtocolTable.5 + FIELD_COUNT=6 +END_ADD + +##This record here is the template record for the IPProto level APs generated by CommsDat. +ADD_SECTION +# COMMDB_ID = 10 + ##This name is a predefined name for the template for the IPProto APs. + ##Please don't change it! + Name=IPProtoDefaultTemplate + Tier=Link.TierTable.271064560 + MCpr=MCprTable.2 + Cpr=CprTable.2 + SCpr=SCprTable.2 + Protocol=ProtocolTable.2 + FIELD_COUNT=6 +END_ADD + +##This record here is the template record for the Network level AP generated by CommsDat. +##It's used when processing SNAP config files +ADD_SECTION +# COMMDB_ID = 11 + ##This name is a predefined name for the template for the Network APs. + ##Please don't change it! + Name=NetworkDefaultTemplate + Tier=Link.TierTable.2048 + MCpr=MCprTable.1 + Cpr=CprTable.1 + SCpr=SCprTable.7 + Protocol=ProtocolTable.1 + FIELD_COUNT=6 +END_ADD + +ADD_SECTION +# COMMDB_ID = 12 + Name=rawip2 + Tier=Link.TierTable.271064565 + MCpr=MCprTable.10 + Cpr=CprTable.8 + SCpr=SCprTable.4 + Protocol=ProtocolTable.11 + FIELD_COUNT=6 +END_ADD + +ADD_SECTION +# COMMDB_ID = 13 + Name=spud-rawip2 + Tier=Link.TierTable.271064565 + MCpr=MCprTable.10 + Cpr=CprTable.8 + SCpr=SCprTable.4 + Protocol=ProtocolTable.11 + FIELD_COUNT=6 +END_ADD diff -r ac50fd48361b -r 82fb8aa91b2c sdkcreationmw/sdkruntimes/new_wsock_3pc/data/wsock.esk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdkcreationmw/sdkruntimes/new_wsock_3pc/data/wsock.esk Wed Apr 21 10:32:25 2010 +0530 @@ -0,0 +1,40 @@ +[sockman] +protocols= tcp,udp,icmp,icmp6,tcp.ip6,udp.ip6,icmp.ip6,icmp6.ip6 + +[tcp] +filename= wsock.prt +index= 1 + +[udp] +filename= wsock.prt +index= 2 + +[icmp] +filename= wsock.prt +index= 3 + +[icmp6] +filename= wsock.prt +index= 4 + +[tcp.ip6] +filename= wsock6.prt +index= 1 + +[udp.ip6] +filename= wsock6.prt +index= 2 + +[icmp.ip6] +filename= wsock6.prt +index= 3 + +[icmp6.ip6] +filename= wsock6.prt +index= 4 + +[nifman] +default= wsocka + +[interfaces] +wsocki= wsocki.nif diff -r ac50fd48361b -r 82fb8aa91b2c sdkcreationmw/sdkruntimes/new_wsock_3pc/group/ABLD.BAT --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdkcreationmw/sdkruntimes/new_wsock_3pc/group/ABLD.BAT Wed Apr 21 10:32:25 2010 +0530 @@ -0,0 +1,15 @@ +@ECHO OFF + +REM Bldmake-generated batch file - ABLD.BAT +REM ** DO NOT EDIT ** + +perl -w -S ABLD.PL "\PublicSDK\sdkcreationmw\sdkruntimes\new_wsock_3pc\group\\" %1 %2 %3 %4 %5 %6 %7 %8 %9 +if errorlevel==1 goto CheckPerl +goto End + +:CheckPerl +perl -v >NUL +if errorlevel==1 echo Is Perl, version 5.003_07 or later, installed? +goto End + +:End diff -r ac50fd48361b -r 82fb8aa91b2c sdkcreationmw/sdkruntimes/new_wsock_3pc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdkcreationmw/sdkruntimes/new_wsock_3pc/group/bld.inf Wed Apr 21 10:32:25 2010 +0530 @@ -0,0 +1,28 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +PRJ_PLATFORMS +WINSCW + +PRJ_EXPORTS +..\data\wsock.esk \epoc32\WINSCW\c\private\101f7989\ESock\ip.tcpip.esk + +..\data\meshpreface1.cfg \epoc32\release\winscw\udeb\z\system\data\meshpreface1.cfg +#ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY + +PRJ_MMPFILES +wsock_3pc.mmp + +#endif //SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY diff -r ac50fd48361b -r 82fb8aa91b2c sdkcreationmw/sdkruntimes/new_wsock_3pc/group/wsock_3pc.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdkcreationmw/sdkruntimes/new_wsock_3pc/group/wsock_3pc.mmp Wed Apr 21 10:32:25 2010 +0530 @@ -0,0 +1,46 @@ + +TARGET w3sock.dll +TARGETTYPE PLUGIN + +#include "../inc/WinsockUid.h" + +UID 0x10009D8D KW3sockProtocolUid + +SOURCEPATH ..\src +SOURCE winsockflow.cpp +SOURCE winsockmcpr.cpp +SOURCE winsockbinders.cpp +SOURCE winsockmcprfactory.cpp +SOURCE winsockflowfactory.cpp +SOURCE winsockprovision.cpp +SOURCE ecom_impl.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../../sf/os/networkingsrv/linklayercontrol/networkinterfacemgr/agentprcore/inc +USERINCLUDE ../../../../sf/os/networkingsrv/linklayercontrol/networkinterfacemgr/agentpr/inc + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + + +LIBRARY mbufmgr.lib +LIBRARY euser.lib +LIBRARY esocksvr.lib +LIBRARY serverden.lib +LIBRARY netmeta.lib +LIBRARY coreproviders.lib +LIBRARY commsfw.lib +LIBRARY agentprcore.lib +LIBRARY insock.lib +LIBRARY nodemessages.lib +LIBRARY meshmachine.lib +LIBRARY netinterfaces.lib +LIBRARY virtualconstructors.lib +LIBRARY factories.lib + +START RESOURCE 10281DE7.rss +TARGET w3sock.rsc +END + +CAPABILITY CommDD PowerMgmt ReadDeviceData WriteDeviceData TrustedUI ProtServ NetworkControl NetworkServices LocalServices ReadUserData WriteUserData +UNPAGED + diff -r ac50fd48361b -r 82fb8aa91b2c sdkcreationmw/sdkruntimes/new_wsock_3pc/inc/winsockBinders.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdkcreationmw/sdkruntimes/new_wsock_3pc/inc/winsockBinders.h Wed Apr 21 10:32:25 2010 +0530 @@ -0,0 +1,127 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// tunnelnif.h +// +// + +/** + @file + @internalComponent +*/ + +#ifndef WINSOCKBINDERS_H__ +#define WINSOCKBINDERS_H__ + +#include +#include +#include // TE64Addr +#include +#include +#include "winsockflow.h" // for CTunnelNcp::Info() + +using namespace ESock; + +const TInt KWinsockMtu = 1500; + +class CWinsockFlow; + +NONSHARABLE_CLASS(CWinsockNcp) : public CBase, public ESock::MLowerDataSender, public ESock::MLowerControl + { +public: + // from MLowerControl + virtual TInt GetName(TDes& aName); + virtual TInt BlockFlow(ESock::MLowerControl::TBlockOption /*aOption*/); + + // from MLowerDataSender + virtual ESock::MLowerDataSender::TSendResult Send(RMBufChain& aPdu); + + // Utility functions called from CTunnelFlow + ESock::MLowerDataSender* Bind(ESock::MUpperDataReceiver* aUpperReceiver, ESock::MUpperControl* aUpperControl); + void Unbind(ESock::MUpperDataReceiver* aUpperReceiver, ESock::MUpperControl* aUpperControl); + TBool MatchesUpperControl(const ESock::MUpperControl* aUpperControl); + void StartSending(); + +protected: + CWinsockNcp(CWinsockFlow& aFlow); + inline const TWinsockInfo* Info(); + +protected: + CWinsockFlow* iFlow; + + TInetAddr iNameSer1; + TInetAddr iNameSer2; + + ESock::MUpperControl* iUpperControl; + ESock::MUpperDataReceiver* iUpperReceiver; + }; + +// ====================================================================================== + +NONSHARABLE_CLASS(CWinsockNcp4) : public CWinsockNcp + { +public: + static CWinsockNcp4* ConstructL(CWinsockFlow& aLink); + + // from MLowerDataSender + virtual TInt GetConfig(TBinderConfig& aConfig); + virtual TInt Control(TUint, TUint, TDes8&); + // + + virtual TInt Notification(TWinsockAgentMessage::TTunnelSetAddress& aMessage); + +private: + CWinsockNcp4(CWinsockFlow& aLink); + + TUint32 iLocalAddress; + }; + +// ====================================================================================== + +NONSHARABLE_CLASS(CWinsockNcp6) : public CWinsockNcp + { +public: + static CWinsockNcp6* ConstructL(CWinsockFlow& aLink); + + // from MLowerDataSender + virtual TInt GetConfig(TBinderConfig& aConfig); + virtual TInt Control(TUint, TUint, TDes8&); + // + + virtual TInt Notification(TWinsockAgentMessage::TTunnelSetAddress& aMessage); + +private: + CWinsockNcp6(CWinsockFlow& aLink); + + TInetAddr iLocalAddress; + }; + +// ====================================================================================== + +class CWinsockNcpLog : public CBase + { +public: + static void Write(const TDesC& aDes); + static void Printf(TRefByValue aFmt, ...); + }; + +// +// Inline functions +// + +inline const TWinsockInfo* CWinsockNcp::Info() + { + return iFlow->Info(); + } + +#endif diff -r ac50fd48361b -r 82fb8aa91b2c sdkcreationmw/sdkruntimes/new_wsock_3pc/inc/winsockUid.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdkcreationmw/sdkruntimes/new_wsock_3pc/inc/winsockUid.h Wed Apr 21 10:32:25 2010 +0530 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2004-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef _W3SOCK_UID_H_ +#define _W3SOCK_UID_H_ + + +#define KWinsockFlowUid 0x10206FF4 +#define KWinsockMcprUid 0x10206FF5 +#define KW3sockProtocolUid 0x10206FF4 +#define KWinsockIPv6ProtocolUid 0x10274A0A + +/*#define KW3sockProtocolUid 0xA000EEB0 ///New UID Given By shrinivas +#define KWinsockFlowUid 0xA000EEB0 +#define KWinsockMcprUid 0xA000EEB1*/ + +/* +#define KWinsockAgentUid 0x10206FF4 +#define KWinsockInterfaceUid 0x10206FF5 +#define KWinsockProtocolUid 0x10206FF6 +#define KWinsockIPv6ProtocolUid 0x10274A0A +*/ + +#endif // _WSOCK_UID_H_ diff -r ac50fd48361b -r 82fb8aa91b2c sdkcreationmw/sdkruntimes/new_wsock_3pc/inc/winsockagenthandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdkcreationmw/sdkruntimes/new_wsock_3pc/inc/winsockagenthandler.h Wed Apr 21 10:32:25 2010 +0530 @@ -0,0 +1,118 @@ +/** +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Header file declaring the RawIP Provisioning structures. +* +* +*/ + + + +/** + @file + @internalTechnology +*/ + +#ifndef WINSOCKAGENTHANDLER_H_ +#define WINSOCKAGENTHANDLER_H_ + +#include +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif + +struct TWinsockInfo; + +NONSHARABLE_CLASS(CWinsockAgentHandler) : public CAgentNotificationHandler + { +public: + CWinsockAgentHandler(const TWinsockInfo& aTunnelInfo); + +private: + virtual void ServiceStarted(); + virtual TInt NotificationFromAgent(TAgentToFlowEventType aEvent, TAny* aInfo); + +private: + // Pointer to Tunnel provisioning information in AccessPointConfig. Should remain valid + // whilst TunnelMCPr instance is valid - TunnelMCPr has a longer lifetime that this + // Tunnel Agent Handler class (which TunnelMCPr created/deletes). + const TWinsockInfo& iTunnelInfo; + }; + +class TSigTunnelAddressParams : public Messages::TSignatureBase +/** +Parameters that communicate the IP Address that the Tunnel CFProtocol should use. + +iIsUpdate is EFalse when the address is setup for the first time. Address changes are +signified by iIsUpdate being set to ETrue. This replaces the old notifications +EAgentToNifEventTypeSetAddress and EAgentToNifEventTypeUpdateAddress in the old +Networking architecture. +*/ + { +protected: + inline TSigTunnelAddressParams() {} + explicit TSigTunnelAddressParams(const Messages::TNodeSignal::TMessageId& aMessageId, + TBool aIsUpdate, TInetAddr aAddress, TInetAddr aNameSer1, TInetAddr aNameSer2) + : Messages::TSignatureBase(aMessageId), iIsUpdate(aIsUpdate), iAddress(aAddress), + iNameSer1(aNameSer1), iNameSer2(aNameSer2) + {} + +public: + DECLARE_MVIP_CTR( TSigTunnelAddressParams ) + DATA_VTABLE + + TInetAddr iAddress; + TInetAddr iNameSer1; + TInetAddr iNameSer2; + TBool iIsUpdate; + + }; + +template +struct TWinsockAddressMessage : public TSigTunnelAddressParams, public Messages::TSignatureBase::TTypeToMessageId +/** +Template class specialising TCFUmtsIfMessageSig against the operation subid. + +@internalComponent +*/ + { + explicit TWinsockAddressMessage( + TBool aIsUpdate, TInetAddr aAddress, TInetAddr aNameSer1, TInetAddr aNameSer2) + :TSigTunnelAddressParams(Messages::TNodeSignal::TMessageId(id, realm), + aIsUpdate, aAddress, aNameSer1, aNameSer2) + {} + }; + +class TWinsockAgentMessage + { +public: + enum { ERealmId = 0x10281DF6 }; + +private: + enum + { + ETunnelSetAddress = Messages::KNullMessageId + 1, + }; +public: + typedef TWinsockAddressMessage TTunnelSetAddress; + + static void RegisterL(); + static void DeRegister(); + }; + + +#endif + diff -r ac50fd48361b -r 82fb8aa91b2c sdkcreationmw/sdkruntimes/new_wsock_3pc/inc/winsockflow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdkcreationmw/sdkruntimes/new_wsock_3pc/inc/winsockflow.h Wed Apr 21 10:32:25 2010 +0530 @@ -0,0 +1,156 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// tunnelnif.h +// +// + +/** + @file + @internalComponent +*/ + +#if (!defined WINSOCKFLOW_H__) +#define WINSOCKFLOW_H__ + +#include +#include +#include + +#include +#include +#include "winsockprovision.h" +#include "winsockagenthandler.h" + + +enum TTunnelPanic + { + ETunnelPanic_ObjectNotDeleted, + ETunnelPanic_BadState, + ETunnelPanic_UnexpectedMessage, + ETunnelPanic_BadBind, + ETunnelPanic_BadUnbind + }; + +void Panic(TTunnelPanic aPanic); + +class CWinsockNcp4; +class CWinsockNcp6; +//struct TTunnelInfo; + +/** + * The link controller. + * The purpose of this class in our case is to communicate with + * the agent. + * It is also responsible for creating and maintaining the NCP + */ +NONSHARABLE_CLASS(CWinsockFlow) : public ESock::CSubConnectionFlowBase, public ESock::MFlowBinderControl + { + +public: + CWinsockFlow(ESock::CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConnId, ESock::CProtocolIntfBase* aProtocolIntf); + ~CWinsockFlow(); + + // + // from CSubConnectionFlowBase + // + virtual ESock::MFlowBinderControl* DoGetBinderControlL(); + + // + // from MFlowBinderControl + // + virtual ESock::MLowerControl* GetControlL(const TDesC8& aProtocol); + virtual ESock::MLowerDataSender* BindL(const TDesC8& aProtocol, ESock::MUpperDataReceiver* aReceiver, ESock::MUpperControl* aControl); + virtual void Unbind( ESock::MUpperDataReceiver* aReceiver, ESock::MUpperControl* aControl); + virtual ESock::CSubConnectionFlowBase* Flow(); + + // + // Other Utility functions + // + inline const TWinsockInfo* Info(); + + +protected: + // + // from CSubConnectionFlowBase + // + virtual void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aMessage); + +private: + // + // Utility functions for processing incoming SCPR messages: As per our understanding, need to implement AgentSCPR to load and manage the agent + // + void StartFlowL(); + void StopFlow(TInt aError); + void ProvisionConfig(const ESock::RMetaExtensionContainerC& aConfigData); + void Destroy(); + TInt Notification(TWinsockAgentMessage::TTunnelSetAddress& aMessage); + + // + // Utility functions for sending messages to SCPR : As per our understanding, need to implement AgentSCPR to load and manage the agent + // + void PostProgressMessage(TInt aStage, TInt aError); + inline void PostDataClientStartedMessage(); // inline as only used once + inline void PostFlowDownMessage(TInt aError); // inline as only used once + void MaybePostDataClientIdle(); + +private: + CWinsockNcp4* iNifIf4; // IP4 binder + CWinsockNcp6* iNifIf6; // IP6 binder + enum TMeshMachineFlowState + { + EStopped, + EStarting, + EStarted, + EStopping, + }; + TMeshMachineFlowState iMMState; + + // Provisioning information + const TWinsockInfo* iProvisionInfo; // pointer to Tunnel provisioning information in AccessPointConfig + + TInt iSavedError; // an errors saved from processing ProvisionConfig message (until StartFlow) + }; + +// =========================================================================================== +// +// Inline functions +// + +inline void CWinsockFlow::PostDataClientStartedMessage() +/** +Post a FlowUp message to the SCPR +*/ + { + iSubConnectionProvider.PostMessage(Id(), ESock::TCFDataClient::TStarted().CRef()); + } + +inline void CWinsockFlow::PostFlowDownMessage(TInt aError) +/** +Post a FlowDown message to the SCPR +*/ + { + iSubConnectionProvider.PostMessage(Id(), ESock::TCFDataClient::TStopped(aError).CRef()); + iMMState = EStopped; + } + +inline const TWinsockInfo* CWinsockFlow::Info() +/** +Retrieve the provisioning information +*/ + { + ASSERT(iProvisionInfo); + return iProvisionInfo; + } + +#endif diff -r ac50fd48361b -r 82fb8aa91b2c sdkcreationmw/sdkruntimes/new_wsock_3pc/inc/winsockflowfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdkcreationmw/sdkruntimes/new_wsock_3pc/inc/winsockflowfactory.h Wed Apr 21 10:32:25 2010 +0530 @@ -0,0 +1,52 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Defines the factory class which is used to instantiate the RAW IP. +// +// + +/** + @file +*/ + +#ifndef WINSCOKFLOWFACTORY_H__ +#define WINSCOKFLOWFACTORY_H__ + +#include +#include +#include +#include +#include "WinsockUid.h" + + + +/** +Winsock Flow Implementation UID : Find the +*/ +const TInt KWinsockFlowImplUid = KWinsockFlowUid; + + +class CWinsockFlowFactory : public ESock::CSubConnectionFlowFactoryBase + { +public: + static CWinsockFlowFactory* NewL(TAny* aConstructionParameters); + +protected: + CWinsockFlowFactory(TUid aFactoryId, ESock::CSubConnectionFlowFactoryContainer& aParentContainer); + virtual ESock::CSubConnectionFlowBase* DoCreateFlowL(ESock::CProtocolIntfBase* aProtocol, ESock::TFactoryQueryBase& aQuery); + +private: + //CBttLogger* iTheLogger; // only here to allow use of _LOG_LnCn() macros within factory + }; + +#endif diff -r ac50fd48361b -r 82fb8aa91b2c sdkcreationmw/sdkruntimes/new_wsock_3pc/inc/winsockmcpr.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdkcreationmw/sdkruntimes/new_wsock_3pc/inc/winsockmcpr.h Wed Apr 21 10:32:25 2010 +0530 @@ -0,0 +1,139 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file + @internalTechnology + @prototype +*/ + + +#ifndef WINSOCK_AGENTMCPR_H +#define WINSOCK_AGENTMCPR_H + +#include +#include +#include +#include // for TMDBElementId +//#include "agentmcpr.h" +#include +#include +#include +#include +#include + +class TIp6Addr; +class CAgentNotificationHandler; +class CAvailabilitySubscriber; +class CAgentQueryConnSettingsImpl; +class CAgentProvisionInfo; + +namespace ESock + { + class CCommsDatIapView; + } + + +/*class CWinsockMetaConnectionProvider : public CCoreMetaConnectionProvider, private ESock::MLinkMCprLegacyDataAccessApiExt, + public ITFHIERARCHY_LINK_2(CWinsockMetaConnectionProvider, CCoreMetaConnectionProvider, + ESock::MQueryConnSettingsApiExt, + ESock::MLinkMCprLegacyDataAccessApiExt)*/ +class CWinsockMetaConnectionProvider : public CAgentMetaConnectionProvider + { +//public: + /*typedef ITFHIERARCHY_LINK_2(CWinsockMetaConnectionProvider, CCoreMetaConnectionProvider, + ESock::MQueryConnSettingsApiExt, + ESock::MLinkMCprLegacyDataAccessApiExt) TIfStaticFetcherNearestInHierarchy;*/ + //typedef CWinsockMetaConnectionProviderFactory FactoryType; +public: + static CWinsockMetaConnectionProvider* NewL(ESock::CMetaConnectionProviderFactoryBase& aFactory, const ESock::TProviderInfo& aProviderInfo); + IMPORT_C ~CWinsockMetaConnectionProvider(); + + void ReturnInterfacePtrL(ESock::MLinkMCprLegacyDataAccessApiExt*& aInterface); + void ReturnInterfacePtrL(ESock::MQueryConnSettingsApiExt*& aInterface); + + // Methods for retrieving and decoding CommsDat fields containing IPv4/v6 addresses. + // + // These methods could have been in CCommsDatIapView, but that would have meant ESockSvr + // linking against insock.lib (IP specific and takes up RAM, even if ESockSvr isn't used + // for IP at all). If CCommsDatIapView is moved out of ESockSvr, then these + // methods should be moved into CCommsDatIapView. + IMPORT_C static void GetIp4AddrL(ESock::CCommsDatIapView* aIapView, CommsDat::TMDBElementId aElementId, TUint32& aAddr); + IMPORT_C static TInt GetIp4Addr(ESock::CCommsDatIapView* aIapView, CommsDat::TMDBElementId aElementId, TUint32& aAddr); + IMPORT_C static void GetIp6AddrL(ESock::CCommsDatIapView* aIapView, CommsDat::TMDBElementId aElementId, TIp6Addr& aAddr); + IMPORT_C static TInt GetIp6Addr(ESock::CCommsDatIapView* aIapView, CommsDat::TMDBElementId aElementId, TIp6Addr& aAddr); + + + // From MLinkCprLegacyDataAccessExtApi Interface + +#if 0 + IMPORT_C virtual void GetIntSettingL(const TDesC& aSettingName, TUint32& aValue, ESock::MPlatsecApiExt* aPlatsecItf); + IMPORT_C virtual void GetBoolSettingL(const TDesC& aSettingName, TBool& aValue, ESock::MPlatsecApiExt* aPlatsecItf); + IMPORT_C virtual void GetDes8SettingL(const TDesC& aSettingName, TDes8& aValue, ESock::MPlatsecApiExt* aPlatsecItf); + IMPORT_C virtual void GetDes16SettingL(const TDesC& aSettingName, TDes16& aValue, ESock::MPlatsecApiExt* aPlatsecItf); + IMPORT_C virtual void GetLongDesSettingL(const TDesC& aSettingName, HBufC*& aValue, ESock::MPlatsecApiExt* aPlatsecItf); +#endif + // Utility method + TMDBElementId MapFieldNameL(const TDesC& aSettingName, ESock::MPlatsecApiExt* aPlatsecItf); + TMDBElementId SecondChanceModemBearerLegacyMapFieldNameL(const TDesC& aSettingName, ESock::MPlatsecApiExt* aPlatsecItf); + +protected: + const CAgentProvisionInfo* AgentProvisionInfo(); + + IMPORT_C static void CleanupCloseIapView(TAny* aThis); + + CWinsockMetaConnectionProvider(ESock::CMetaConnectionProviderFactoryBase& aFactory, const ESock::TProviderInfo& aProviderInfo); + + IMPORT_C ESock::CCommsDatIapView* OpenIapViewL(); + IMPORT_C ESock::CCommsDatIapView* OpenIapViewLC(); + IMPORT_C void CloseIapView(); + IMPORT_C ESock::CCommsDatIapView* IapView(); + void DestroyIapView(); + + IMPORT_C void SetAgentNotificationHandlerL(CAgentNotificationHandler* aNotificationHandler); + IMPORT_C void ConstructL(); + + // Messages::ANode Interface - To be implemented by the deriving MCPr + // virtual TInt ReceivedL(Messages::TSignatureBase& aCFMessage); + + IMPORT_C void StartAvailabilityMonitoringL(const Messages::TNodeCtxId& aAvailabilityActivity); + IMPORT_C void CancelAvailabilityMonitoring(); + virtual void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aMessage); + +private: + void ProvisionAgentInfoL (); + CCredentialsConfig* CreateCredentialsInfoL(); + +private: + ESock::CCommsDatIapView* iIapView; + TBool iAgentMCPrDoneWithIapView:1; + TInt32 iIapViewRefCount; + +public: +#ifdef _DEBUG + CAvailabilitySubscriber* iAvailabilitySubscriber; +#else + TAny* iReserved; //Place holder to avoid BC between udeb/urel +#endif + + +protected: + CAgentQueryConnSettingsImpl* iQueryConnSettingsImpl; + }; + + +#endif +// SYMBIAN_AGENTMCPR_H + diff -r ac50fd48361b -r 82fb8aa91b2c sdkcreationmw/sdkruntimes/new_wsock_3pc/inc/winsockmcprfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdkcreationmw/sdkruntimes/new_wsock_3pc/inc/winsockmcprfactory.h Wed Apr 21 10:32:25 2010 +0530 @@ -0,0 +1,40 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// RawIP MCPR Factory +// +// + +/** + @file + @internalComponent +*/ + +#ifndef SYMBIAN_WINSCOKMCPR_FACTORY_H +#define SYMBIAN_WINSCOKMCPR_FACTORY_H + +#include + +class CWinsockMetaConnectionProviderFactory : public ESock::CMetaConnectionProviderFactoryBase + { +public: + enum { iUid = 0x10281e00 }; + static CWinsockMetaConnectionProviderFactory* NewL(TAny* aParentContainer); + +protected: + CWinsockMetaConnectionProviderFactory(TUid aFactoryId, ESock::CMetaConnectionFactoryContainer& aParentContainer); + ESock::ACommsFactoryNodeId* DoCreateObjectL(ESock::TFactoryQueryBase& aQuery); + }; + +#endif +//SYMBIAN_RAWIPMCPR_FACTORY_H diff -r ac50fd48361b -r 82fb8aa91b2c sdkcreationmw/sdkruntimes/new_wsock_3pc/inc/winsockprovision.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdkcreationmw/sdkruntimes/new_wsock_3pc/inc/winsockprovision.h Wed Apr 21 10:32:25 2010 +0530 @@ -0,0 +1,81 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Definitions of Tunnel Provisioning classes. +// +// + +/** + @file + @internalComponent +*/ + +#if (!defined WINSOCKPROVISION_H__) +#define WINSOCKPROVISION_H__ + +#include +#include +#include + +namespace ESock + { + class CCommsDatIapView; + } + +struct TWinsockInfo +/** +Provisioning class embedded within the main TTunnelProvision class +*/ + { +public: + // Rationale: iIfName is effectively TBuf<32> and not an RBuf because Tunnel interface + // names are typically 26-28 characters. + TInterfaceName iIfName; + TUint32 iLocalIap; + TUint32 iLocalNetwork; + }; + +class TWinsockProvision : public Meta::SMetaData +/** +Structure passed to CFProtocol in a ProvisionConfig() message. +*/ + { +public: + enum + { + EUid = 0x10206FF4, // same as Winsock Flow UID (arbitrary convention only) + ETypeId = 1 + }; + +public: + void InitialiseConfigL(ESock::CCommsDatIapView* aIapView); + +public: + TWinsockInfo iInfo; + + // No serialisation takes place in CFProtocol - we only cast an SMetaData* to + // TTunnelProvision* hence DATA_VTABLE is enough. + DATA_VTABLE + }; + +class TWinsockMessages +/** +Methods used to register the Tunnel message virtual constructors +*/ + { +public: + static void RegisterL(); + static void DeRegister(); + }; + +#endif // TUNNELPROVISION_H__ diff -r ac50fd48361b -r 82fb8aa91b2c sdkcreationmw/sdkruntimes/new_wsock_3pc/src/10281DE7.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdkcreationmw/sdkruntimes/new_wsock_3pc/src/10281DE7.rss Wed Apr 21 10:32:25 2010 +0530 @@ -0,0 +1,60 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Registry info for RawIP providers ECOM plug-in +// +// + +/** + @file 10281DF1.RSS +*/ + +#include "ecom/registryinfo.rh" + +RESOURCE REGISTRY_INFO theInfo +{ +dll_uid = 0x10206FF4; +interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x10281C33; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x10206FF4; // + version_no = 1; + display_name = "Winscok Flow Factory"; + default_data = "w3sock"; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = 0x10274546; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x10206FF5; // 0x10206FF4 is UID of Winscok Agent in old arch + version_no = 1; + display_name = "Winsock Meta Connection Provider Factory"; + default_data = "WinsockMCprFactory"; + opaque_data = ""; + } + }; + } + }; +} diff -r ac50fd48361b -r 82fb8aa91b2c sdkcreationmw/sdkruntimes/new_wsock_3pc/src/ecom_impl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdkcreationmw/sdkruntimes/new_wsock_3pc/src/ecom_impl.cpp Wed Apr 21 10:32:25 2010 +0530 @@ -0,0 +1,52 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// ECOM Implementation for the Winsock Provider Factories +// +// + +/** + @file + @internalComponent +*/ + + +#include +#include + +//#include "winsockcprfactory.h" +//#include "winsockscprfactory.h" +//#include "winsocktiermanagerfactory.h" + +#include "winsockflowfactory.h" +#include "winsockmcprfactory.h" +#include "../inc/winsockuid.h" + + +//#include "tunnelagentcprfactory.h" +// ---------------- ECOM Implementation ---------------- + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KWinsockFlowUid, CWinsockFlowFactory::NewL), + IMPLEMENTATION_PROXY_ENTRY(KWinsockMcprUid, CWinsockMetaConnectionProviderFactory::NewL) + }; + + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + + diff -r ac50fd48361b -r 82fb8aa91b2c sdkcreationmw/sdkruntimes/new_wsock_3pc/src/winscokmcprfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdkcreationmw/sdkruntimes/new_wsock_3pc/src/winscokmcprfactory.cpp Wed Apr 21 10:32:25 2010 +0530 @@ -0,0 +1,64 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// RawIP MCPR Factory +// +// + +/** + @file + @internalComponent +*/ + +#include "winsockmcprfactory.h" +#include "winsockmcpr.h" +#include +#include + +#include +#include + +#ifdef __CFLOG_ACTIVE +#define KRawIPMCprFactoryTag KESockMetaConnectionTag +// _LIT8(KRawIPMCprFactorySubTag, "rawipmcprfactory"); +#endif // __CFLOG_ACTIVE + +using namespace ESock; + +//-========================================================= +// +// CWinsockMetaConnectionProviderFactory methods +// +//-========================================================= +CWinsockMetaConnectionProviderFactory* CWinsockMetaConnectionProviderFactory::NewL(TAny* aParentContainer) + { + __CFLOG_VAR((KRawIPMCprFactoryTag, KRawIPMCprFactorySubTag, _L8("CWinsockMetaConnectionProviderFactory ::\tNewL(%08x)"), aParentContainer)); + return new (ELeave) CWinsockMetaConnectionProviderFactory(TUid::Uid(CWinsockMetaConnectionProviderFactory::iUid), *(reinterpret_cast(aParentContainer))); + } + +CWinsockMetaConnectionProviderFactory::CWinsockMetaConnectionProviderFactory(TUid aFactoryId, CMetaConnectionFactoryContainer& aParentContainer) + : CMetaConnectionProviderFactoryBase(aFactoryId,aParentContainer) + { + __CFLOG_VAR((KRawIPMCprFactoryTag, KRawIPMCprFactorySubTag, _L8("CWinsockMetaConnectionProviderFactory %08x:\tCWinsockMetaConnectionProviderFactory Constructor"), this)); + } + +ACommsFactoryNodeId* CWinsockMetaConnectionProviderFactory::DoCreateObjectL(ESock::TFactoryQueryBase& aQuery) + { + const TMetaConnectionFactoryQuery& query = static_cast(aQuery); + CWinscokMetaConnectionProvider* provider = CWinscokMetaConnectionProvider::NewL(*this, query.iProviderInfo); + + //ESOCK_DEBUG_REGISTER_GENERAL_NODE(iUid, provider); + + return provider; + } + diff -r ac50fd48361b -r 82fb8aa91b2c sdkcreationmw/sdkruntimes/new_wsock_3pc/src/winsockbinders.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdkcreationmw/sdkruntimes/new_wsock_3pc/src/winsockbinders.cpp Wed Apr 21 10:32:25 2010 +0530 @@ -0,0 +1,332 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// tunnelnif.cpp +// +// + +#include +//#include + +#include + +//#include "tunnelnifvar.h" +#include "winsockBinders.h" +#include +//#include "TunnelAgentHandler.h" +#include +/* + * This sections defines a whole load of constants etc... not very exciting + */ +#if defined (_DEBUG) + #define LOG(a) a + _LIT(KTunnelIfLogFolder, "Winsock"); + _LIT(KTunnelIfLogFile, "Winsock"); +#else + #define LOG(a) +#endif + +const TUint KConnNifConfig = (1 | KConnReadUserDataBit); + +CWinsockNcp::CWinsockNcp(CWinsockFlow& aFlow) + : iFlow(&aFlow) + { + } + +// +// from ESock::MLowerControl +// + +TInt CWinsockNcp::GetName(TDes& aName) +/** +Return binder name. + +Called from upper layer. + +@param aName return descriptor filled in with binder name +*/ + { + aName.Copy(Info()->iIfName); // Need to Written for Winsock Interface name + return KErrNone; + } + +TInt CWinsockNcp::BlockFlow(MLowerControl::TBlockOption /*aOption*/) + { + return KErrNotSupported; + } + +// +// Utility functions called from CTunnelFlow +// + +MLowerDataSender* CWinsockNcp::Bind(MUpperDataReceiver* aUpperReceiver, MUpperControl* aUpperControl) +/** + * Binds TCP/IP protocol to Flow + * + * @param aUpperReceiver A pointer to Upper layer Receive class + * @param aUpperControl A pointer to Upper layer control class + */ + { + // CWinsockNcpLog::Printf(_L("CWinsockNcp:\tBind()")); + + iUpperReceiver = aUpperReceiver; + iUpperControl = aUpperControl; + return this; + } + +void CWinsockNcp::Unbind(MUpperDataReceiver* aUpperReceiver, MUpperControl* aUpperControl) + { + //CWinsockNcpLog::Printf(_L("CWinsockNcp:\tUnbind()")); + + (void)aUpperReceiver; + (void)aUpperControl; + ASSERT(aUpperReceiver == iUpperReceiver); + ASSERT(aUpperControl == iUpperControl); + iUpperReceiver = NULL; + iUpperControl = NULL; + } + +void CWinsockNcp::StartSending() +/** + * Indicates to the protocol layer that the NIF is ready to send packets. + * + * @param aProtocol A pointer to a protocol + */ + { + //CWinsockNcpLog::Printf(_L("CWinsockNcp:\tStartSending()")); + + // Default implementation. + // Uses iProtocol instead aProtocol. + iUpperControl->StartSending(); + } + +TBool CWinsockNcp::MatchesUpperControl(const ESock::MUpperControl* aUpperControl) + { + return iUpperControl == aUpperControl; + } + +MLowerDataSender::TSendResult CWinsockNcp::Send(RMBufChain& aPdu) + { + // CWinsockNcpLog::Printf(_L("Illegal CWinsockNcp::Send Called, Dropping packet")); + aPdu.Free(); + return MLowerDataSender::ESendAccepted; + } + +// =================================================================================== +// +// NCP4 specific functions +// + +CWinsockNcp4::CWinsockNcp4(CWinsockFlow& aFlow) + : CWinsockNcp(aFlow) + { + } + +CWinsockNcp4* CWinsockNcp4::ConstructL(CWinsockFlow& aFlow) + { + // CWinsockNcpLog::Printf(_L("CWinsockNcp4::ConstructL()")); + + CWinsockNcp4* self = new(ELeave) CWinsockNcp4(aFlow); + CleanupStack::PushL(self); + + // CWinsockNcpLog::Printf(_L("CWinsockNcp4::ConstructL() - Created Nif %S"), &self->Info()->iIfName); + CleanupStack::Pop(self); + return self; + } + +TInt CWinsockNcp4::GetConfig(TBinderConfig& aConfig) + { + TBinderConfig4* config = TBinderConfig::Cast(aConfig); + + if(config == NULL) + { + return KErrNotSupported; + } + + config->iFamily = KAfInet; /* KAfInet - selects TBinderConfig4 */ + + config->iInfo.iFeatures = KIfCanBroadcast | KIfCanMulticast; /* Feature flags */ + config->iInfo.iMtu = KWinsockMtu; /* Maximum transmission unit. */ + config->iInfo.iRMtu = KWinsockMtu; /* Maximum transmission unit for receiving. */ + config->iInfo.iSpeedMetric = 0; /* approximation of the interface speed in Kbps. */ + + config->iNetMask.SetAddress(0); /* IP netmask. */ + config->iBrdAddr.SetAddress(0); /* IP broadcast address. */ + + // do this only if we have a valid address + if(iLocalAddress == 0) + { + TInetAddr unspec(KAFUnspec); + config->iAddress = unspec; + config->iDefGate = unspec; + } + else + { + config->iAddress.SetAddress(iLocalAddress); /* Interface IP address. */ + config->iDefGate.SetAddress(iLocalAddress); /* IP default gateway or peer address (if known). */ + config->iNameSer1 = iNameSer1; /* IP primary name server (if any). */ + config->iNameSer2 = iNameSer2; /* IP secondary name server (if any). */ + } + + return KErrNone; + } + +TInt CWinsockNcp4::Control(TUint aLevel, TUint aName, TDes8& aOption) + { + CWinsockNcpLog::Printf(_L("CWinsockNcp4::Control(aLevel %x, aName %x, ...)"), aLevel, aName); + + if (aLevel == KCOLInterface) + { + if (aName == KConnNifConfig) + { + TInetIfConfig& opt = *(TInetIfConfig*)aOption.Ptr(); + iLocalAddress = opt.iAddress.Address(); + iNameSer1 = opt.iNameSer1; + iNameSer2 = opt.iNameSer2; + return KErrNone; + } + } + return KErrNotSupported; + } + +TInt CWinsockNcp4::Notification(TWinsockAgentMessage::TTunnelSetAddress& aMessage) + { + iLocalAddress = aMessage.iAddress.Address() ; + iNameSer1 = aMessage.iNameSer1; + iNameSer2 = aMessage.iNameSer2; + if ( aMessage.iIsUpdate ) + { + ASSERT(iUpperControl); + iUpperControl->Error(KErrLinkConfigChanged); +// iLink->Notify()->BinderLayerDown((CNifIfBase*)this, KErrLinkConfigChanged, MNifIfNotify::EReconnect); + } + return KErrNone; + } + +// =================================================================================== +// +// NCP6 specific functions +// + +CWinsockNcp6::CWinsockNcp6(CWinsockFlow& aFlow) + : CWinsockNcp(aFlow) + { + } + +CWinsockNcp6* CWinsockNcp6::ConstructL(CWinsockFlow& aLink) + { + CWinsockNcpLog::Printf(_L("CWinsockNcp6::ConstructL()")); + + CWinsockNcp6* self = new(ELeave) CWinsockNcp6(aLink); + CleanupStack::PushL(self); + + // CWinsockNcpLog::Printf(_L("CWinsockNcp::ConstructL() - Created Nif %S"), &self->Info()->iIfName); + CleanupStack::Pop(self); + return self; + } + +TInt CWinsockNcp6::GetConfig(TBinderConfig& aConfig) +/** +Return the configuration information for the binder (e.g. IP address) + +Called from upper layer. + +@param aConfig base class of structure to fill in with configuration information. +*/ + { + if(TBinderConfig::Cast(aConfig) == NULL) + { + return KErrNotSupported; + } + + TBinderConfig6& config = static_cast(aConfig); + + config.iFamily = KAfInet6; /* KAfInet - selects TBinderConfig4 */ + + config.iInfo.iFeatures = KIfCanBroadcast | KIfCanMulticast; /* Feature flags */ + config.iInfo.iMtu = KWinsockMtu; /* Maximum transmission unit. */ + config.iInfo.iRMtu = KWinsockMtu; /* Maximum transmission unit for receiving. */ + config.iInfo.iSpeedMetric = 0; /* approximation of the interface speed in Kbps. */ + + config.iLocalId = iLocalAddress; + //opt.iRemoteId.SetAddress(iLocalAddress); + // Setup static DNS address if required + if (!iNameSer1.IsUnspecified()) + { + config.iNameSer1 = iNameSer1; + if (!iNameSer1.IsUnspecified()) + config.iNameSer2 = iNameSer2; + } + + return KErrNone; + } + +TInt CWinsockNcp6::Control(TUint aLevel, TUint aName, TDes8& aOption) + { + // CWinsockNcpLog::Printf(_L("CWinsockNcp6::Control(aLevel %x, aName %x, ...)"), aLevel, aName); + + if (aLevel == KCOLInterface) + { + if (aName == KConnNifConfig) + { + TSoInet6IfConfig& opt = *(TSoInet6IfConfig*)aOption.Ptr(); + iLocalAddress = opt.iLocalId; + iNameSer1 = opt.iNameSer1; + iNameSer2 = opt.iNameSer2; + return KErrNone; + } + } + + return KErrNotSupported; + } + +TInt CWinsockNcp6::Notification(TWinsockAgentMessage::TTunnelSetAddress& aMessage) + { + iLocalAddress = aMessage.iAddress; + iNameSer1 = aMessage.iNameSer1; + iNameSer2 = aMessage.iNameSer2; + if ( aMessage.iIsUpdate ) + { + ASSERT(iUpperControl); + iUpperControl->Error(KErrLinkConfigChanged); + // iLink->Notify()->BinderLayerDown((CNifIfBase*)this, KErrLinkConfigChanged, MNifIfNotify::EReconnect); + } + return KErrNone; + } + + +void CWinsockNcpLog::Write(const TDesC& aDes) +// +// Write aText to the log +// + { + LOG(RFileLogger::Write(KTunnelIfLogFolder(), KTunnelIfLogFile(), EFileLoggingModeAppend, aDes);) + (void)aDes; + } + +void CWinsockNcpLog::Printf(TRefByValue aFmt,...) +// +// Write a mulitple argument list to the log, trapping and ignoring any leave +// + { + /*LOG( + VA_LIST list; + VA_START(list,aFmt); + RFileLogger::WriteFormat(KTunnelIfLogFolder(), KTunnelIfLogFile(), EFileLoggingModeAppend, aFmt, list); + )*/ + (void)aFmt; + } + + + + diff -r ac50fd48361b -r 82fb8aa91b2c sdkcreationmw/sdkruntimes/new_wsock_3pc/src/winsockflow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdkcreationmw/sdkruntimes/new_wsock_3pc/src/winsockflow.cpp Wed Apr 21 10:32:25 2010 +0530 @@ -0,0 +1,358 @@ +#if 1 +#include +#include +#include "winsockbinders.h" +#include "winsockflow.h" +#include +#include // for SAccessPointConfig +#include +#include +#include + +using namespace Messages; +using namespace MeshMachine; +using namespace ESock; + + +#endif + + +class CWinsockNcp4; +class CWinsockNcp6; +struct TWinsockInfo; +#if 1 +/* + * This sections defines a whole load of constants etc... not very exciting + */ +#if defined (WINSOCK_DEBUG) + #define LOG(a) +#else + #define LOG(a) +#endif + +_LIT8(KDescIp6, "ip6"); +_LIT8(KDescIp, "ip"); + +// Note: The "tunnel" logging string has been repeated here but should be unified throughout +// the Tunnel CFProtocol. The main logging relies on 16-bit RFileLogger calls whereas the +// CFNode logging requires an 8-bit string. An attempt to make everything 8-bit resulted +// in undefined RFileLogger symbols. +#ifdef SYMBIAN_TRACE_ENABLE +_LIT8(KWinsockLog, "W3sock"); +#endif + +/* + * The Link class + */ + +CWinsockFlow::CWinsockFlow(CSubConnectionFlowFactoryBase& aFactory, const TNodeId& aSubConnId, CProtocolIntfBase* aProtocolIntf) + : CSubConnectionFlowBase(aFactory, aSubConnId, aProtocolIntf) +/** +Constructor. + +@param aFactory Reference to the factory which created this object. +@param aSubConnId Id of SubConnection Provider - for sending messages to it. +@param aProtocolIntf Protocol Interface corresponding to the Flow. +*/ + { + LOG_NODE_CREATE(KWinsockLog, CWinsockFlow); + + } + +CWinsockFlow::~CWinsockFlow() + { + LOG_NODE_DESTROY(KWinsockLog, CWinsockFlow); + } + +TInt CWinsockFlow::Notification(TWinsockAgentMessage::TTunnelSetAddress& aMessage) + { + if (iNifIf4) + { + return iNifIf4->Notification(aMessage); + } + if (iNifIf6) + { + return iNifIf6->Notification(aMessage); + } + return KErrNotSupported; + } + + +// ===================================================================================== +// CSubConnectionFlowBase +// ===================================================================================== + +MFlowBinderControl* CWinsockFlow::DoGetBinderControlL() + { + return this; + } + +// ===================================================================================== +// MFlowBinderControl methods +// ===================================================================================== + +MLowerControl* CWinsockFlow::GetControlL(const TDesC8& aProtocol) + { + + if (aProtocol.CompareF(KDescIp6) == 0) + { + if ( iNifIf6 ) + { + //CTunnelNcpLog::Printf(_L("CWinsockFlow:\tGetControlL already bound to %S"), &aProtocol); + User::Leave(KErrInUse); + return NULL; + } + iNifIf6 = CWinsockNcp6::ConstructL(*this); + return iNifIf6; + } + else if (aProtocol.CompareF(KDescIp) == 0) + { + if ( iNifIf4 ) + { + // CTunnelNcpLog::Printf(_L("CWinsockFlow:\tGetControlL already bound to %S"), &aProtocol); + User::Leave(KErrInUse); + return NULL; + } + iNifIf4 = CWinsockNcp4::ConstructL(*this); + return iNifIf4; + } + Panic(ETunnelPanic_BadBind); + return NULL; + } + +MLowerDataSender* CWinsockFlow::BindL(const TDesC8& aProtocol, MUpperDataReceiver* aReceiver, MUpperControl* aControl) +/** + * Binds upper CFProtocol to this CFProtocol + * + * @param aUpperReceiver A pointer to Upper layer Receive class + * @param aUpperControl A pointer to Upper layer control class + */ + { + MLowerDataSender* lowerDataSender = NULL; + if (aProtocol.CompareF(KDescIp6) == 0) + { + ASSERT(iNifIf6); + lowerDataSender = iNifIf6->Bind(aReceiver, aControl); + } + else if (aProtocol.CompareF(KDescIp) == 0) + { + ASSERT(iNifIf4); + lowerDataSender = iNifIf4->Bind(aReceiver, aControl); + } + else + { + // GetControlL() should already have been called. + Panic(ETunnelPanic_BadBind); + } + + if (lowerDataSender) + { + iSubConnectionProvider.PostMessage(Id(), TCFControlProvider::TActive().CRef()); + } + + return lowerDataSender; + } + +void CWinsockFlow::Unbind(MUpperDataReceiver* aUpperReceiver, MUpperControl* aUpperControl) + { + if (iNifIf4 && iNifIf4->MatchesUpperControl(aUpperControl)) + { + iNifIf4->Unbind(aUpperReceiver, aUpperControl); + delete iNifIf4; + iNifIf4 = NULL; + } + else + if (iNifIf6 && iNifIf6->MatchesUpperControl(aUpperControl)) + { + iNifIf6->Unbind(aUpperReceiver, aUpperControl); + delete iNifIf6; + iNifIf6 = NULL; + } + else + { + Panic(ETunnelPanic_BadUnbind); + } + MaybePostDataClientIdle(); + } + +CSubConnectionFlowBase* CWinsockFlow::Flow() +/** +Return the Flow corresponding to the MFlowBinderControl +*/ + { + return this; + } + +// ===================================================================================== +// Messages::ANode +// ===================================================================================== + +void CWinsockFlow::ReceivedL(const TRuntimeCtxId& aSender, const TNodeId& aRecipient, TSignatureBase& aMessage) + { + + + CSubConnectionFlowBase::ReceivedL(aSender, aRecipient, aMessage); + + if (aMessage.IsMessage()) + { + } + else if (TEChild::ERealmId == aMessage.MessageId().Realm()) + { + switch (aMessage.MessageId().MessageId()) + { + case TEChild::TDestroy::EId : + Destroy(); + break; + default: +//TODO - logging + ASSERT(EFalse); + } + } + else if (TCFDataClient::ERealmId == aMessage.MessageId().Realm()) + { + switch (aMessage.MessageId().MessageId()) + { + case TCFDataClient::TStart::EId : + StartFlowL(); + break; + case TCFDataClient::TStop::EId : + StopFlow(static_cast(aMessage).iValue); + break; + case TCFDataClient::TBindTo::EId: + { + TCFDataClient::TBindTo& bindToReq = message_cast(aMessage); + if (!bindToReq.iNodeId.IsNull()) + { + User::Leave(KErrNotSupported); + } + RClientInterface::OpenPostMessageClose(Id(), aSender, TCFDataClient::TBindToComplete().CRef()); + } + break; + case TCFDataClient::TProvisionConfig::EId: + ProvisionConfig(static_cast(aMessage).iConfig); + break; + default: +//TODO - logging + ASSERT(EFalse); + } + } + else // realm is not TCFMessage or TTunnelAgentMessage + { + Panic(ETunnelPanic_UnexpectedMessage); + } + + + } + +// ===================================================================================== +// +// Methods for handling incoming SCPR messages +// + +void CWinsockFlow::StartFlowL() + { + // NOTE: according to the NAF docs the sequence should really be StartSending(), then LinkLayerUp() then Progress() + // for DNS to work. However, this tunnel NIF doesn't support DNS. + // + //CTunnelNcpLog::Write(_L("CWinsockFlow:\tStartFlow()")); + + // Process any errors that may have occurred during processing of the ProvisionConfig message earlier. + // ProvisionConfig has no response, so error the StartFlow here. + User::LeaveIfError(iSavedError); + + + PostDataClientStartedMessage(); + if (iNifIf4) + { + iNifIf4->StartSending(); + } + if (iNifIf6) + { + iNifIf6->StartSending(); + } + iMMState = EStarted; + + + } + +void CWinsockFlow::StopFlow(TInt aError) + { + // CTunnelNcpLog::Printf(_L("CWinsockFlow:\tStop(aError %d)"), aError); + + PostFlowDownMessage(aError); + } + +void CWinsockFlow::MaybePostDataClientIdle() + { + if (iNifIf4 == NULL && iNifIf4 == NULL) + { + iSubConnectionProvider.RNodeInterface::PostMessage(Id(), TCFControlProvider::TIdle().CRef()); + } + } +/* +Provisioning description for Tunnel CFProtocol Flow: + +- on receipt of the TProvisionConfig message, the provisioning information contained within + the AccessPointConfig array is validated: + - TTunnelProvision must be present. It is added by the Tunnel MCPr and populated from CommsDat. A pointer to it + is stored in iProvisionInfo. If missing, TError(TCFDataClient::TStart, KErrCorrupt) message is signalled back + to the SCPr on the next StartFlow message (ProvisionConfig has no response message). +*/ + + +void CWinsockFlow::ProvisionConfig(const ESock::RMetaExtensionContainerC& aConfigData) +/** +Handle ProvisionConfig message from SCPR. +*/ + { + + + iSavedError = KErrNone; + //CTunnelNcpLog::Printf(_L("CWinsockFlow:\tProvisionConfig message received")); + + AccessPointConfig().Close(); + AccessPointConfig().Open(aConfigData); + + +#if 0 // Need to Writen for Winsock + /* Look into Agent MCPR to find the correct class for winscok */ + const TWinsockProvision* provision = static_cast(AccessPointConfig().FindExtension(STypeId::CreateSTypeId(TWinsockProvision::EUid, TWinsockProvision::ETypeId))); + if (provision == NULL) + { + //CTunnelNcpLog::Printf(_L("CWinsockFlow:\tProcessProvisionConfigL() - no Winsock configuration")); + iSavedError = KErrCorrupt; + } + + ASSERT(iProvisionInfo == NULL); + iProvisionInfo = &provision->iInfo; + ASSERT(iProvisionInfo); + + #endif // #if 1 + } + +void CWinsockFlow::Destroy() +/** +Handle Destroy message from SCPR. +*/ + { + ASSERT(iNifIf4 == NULL); // must not still be bound from above before being destroyed + ASSERT(iNifIf6 == NULL); + DeleteThisFlow(); + } + +// +// Utility functions +// + +void CWinsockFlow::PostProgressMessage(TInt aStage, TInt aError) + { + iSubConnectionProvider.RNodeInterface::PostMessage(Id(), TCFMessage::TStateChange(Elements::TStateChange(aStage, aError)).CRef()); + } + +void Panic(TTunnelPanic aPanic) + { + _LIT(KWinsockLogPanicTag, "Winsock"); + User::Panic(KWinsockLogPanicTag, aPanic); + } + +#endif \ No newline at end of file diff -r ac50fd48361b -r 82fb8aa91b2c sdkcreationmw/sdkruntimes/new_wsock_3pc/src/winsockflowfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdkcreationmw/sdkruntimes/new_wsock_3pc/src/winsockflowfactory.cpp Wed Apr 21 10:32:25 2010 +0530 @@ -0,0 +1,68 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Implements the factory class which is used to instantiate the WINSOCK NIF. +// +// + +/** + @file +*/ + +#include "WinsockFlowFactory.h" +#include "WinsockFlow.h" +#include "../inc/winsockUid.h" +#include +//#include "bttlog.h" + +using namespace ESock; + +// ===================================================================================== +// +// RawIP Flow Factory +// + +CWinsockFlowFactory* CWinsockFlowFactory::NewL(TAny* aConstructionParameters) +/** +Constructs a Default SubConnection Flow Factory + +@param aConstructionParameters construction data passed by ECOM + +@returns pointer to a constructed factory +*/ + { + + CWinsockFlowFactory* ptr = new (ELeave) CWinsockFlowFactory(TUid::Uid(KWinsockFlowUid), *(reinterpret_cast(aConstructionParameters))); + return ptr; + } + + +CWinsockFlowFactory::CWinsockFlowFactory(TUid aFactoryId, CSubConnectionFlowFactoryContainer& aParentContainer) + : CSubConnectionFlowFactoryBase(aFactoryId, aParentContainer) +/** +Default SubConnection Flow Factory Constructor + +@param aFactoryId ECOM Implementation Id +@param aParentContainer Object Owner +*/ + { + } + + +CSubConnectionFlowBase* CWinsockFlowFactory::DoCreateFlowL(ESock::CProtocolIntfBase* aProtocol, ESock::TFactoryQueryBase& aQuery) + { + const TDefaultFlowFactoryQuery& query = static_cast(aQuery); + CWinsockFlow* s = new (ELeave) CWinsockFlow(*this, query.iSCprId, aProtocol); + return s; + } + diff -r ac50fd48361b -r 82fb8aa91b2c sdkcreationmw/sdkruntimes/new_wsock_3pc/src/winsockmcpr.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdkcreationmw/sdkruntimes/new_wsock_3pc/src/winsockmcpr.cpp Wed Apr 21 10:32:25 2010 +0530 @@ -0,0 +1,663 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file + @internalTechnology + @prototype +*/ + +#if 0 +#include +#include +#include +#include +#include +#include +#else +#include +#include +#include +#include +#include "winsockprovision.h" +#include "winsockagenthandler.h" +#include "winsockmcpr.h" +#include + +#endif + +using namespace Messages; +using namespace MeshMachine; +using namespace ESock; +using namespace NetStateMachine; +using namespace MCprActivities; + + +#ifdef _DEBUG +// Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module +// (if it could happen through user error then you should give it an explicit, documented, category + code) +_LIT(KSpecAssert_NifManAgtPrCgntm, "NifManAgtPrCgntm"); +#endif + + +#ifdef _DEBUG +#define KWinSockMCprTag KESockMetaConnectionTag +_LIT8(KWinSockMCprSubTag, "winsockmcpr"); +#endif + +// No Bearer Activity +namespace WinsockMCPRNoBearerActivity +{ +DECLARE_DEFINE_NODEACTIVITY(ECFActivityNoBearer, activity, TCFControlProvider::TNoBearer) + FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingNoBearer, MeshMachine::TNoTag) + LAST_NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TSendBearer) +NODEACTIVITY_END() +} + +// Activity Map +namespace WinsockMCprStates +{ +DECLARE_DEFINE_ACTIVITY_MAP(stateMap) + ACTIVITY_MAP_ENTRY(WinsockMCPRNoBearerActivity, activity) +ACTIVITY_MAP_END_BASE(AgentMCprActivities, agentMCprActivities) +} // namespace RawIPMCprStates + +using namespace ESock; +using namespace Messages; +using namespace NetStateMachine; +using namespace CommsDat; +using namespace PRActivities; + + +CWinsockMetaConnectionProvider* CWinsockMetaConnectionProvider::NewL(ESock::CMetaConnectionProviderFactoryBase& aFactory, const ESock::TProviderInfo& aProviderInfo) + { + // coverity[alloc_fn] coverity[alias] coverity[assign] + CWinsockMetaConnectionProvider* winmcpr = new (ELeave) CWinsockMetaConnectionProvider (aFactory, aProviderInfo); + // coverity[push] + CleanupStack::PushL(winmcpr); + // coverity[alias] coverity[double_push] + winmcpr->ConstructL(); + CleanupStack::Pop(winmcpr); + return winmcpr; + } + +/** +Constructor for the Agent Meta Connection Provider +@param aFactory The parent factory which created this MCPr +*/ +EXPORT_C CWinsockMetaConnectionProvider::CWinsockMetaConnectionProvider(CMetaConnectionProviderFactoryBase& aFactory, const ESock::TProviderInfo& aProviderInfo) +:CAgentMetaConnectionProvider(aFactory, aProviderInfo, WinsockMCprStates::stateMap::Self()) + { + LOG_NODE_CREATE(KWinSockMCprSubTag, CWinsockMetaConnectionProvider); + //iQueryConnSettingsImpl = NULL; + } + + +/** +D'tor +*/ +EXPORT_C CWinsockMetaConnectionProvider::~CWinsockMetaConnectionProvider() + { + CWinsockMetaConnectionProvider::CancelAvailabilityMonitoring(); //Don't call virtual for obvious reasons! + DestroyIapView(); + //delete iQueryConnSettingsImpl; + LOG_NODE_DESTROY(KWinSockMCprSubTag, CWinsockMetaConnectionProvider); + } + +EXPORT_C void CWinsockMetaConnectionProvider::ConstructL() + { + CAgentMetaConnectionProvider::ConstructL(); + //CCoreMetaConnectionProvider::ConstructL(); + ProvisionAgentInfoL(); + } + + +void CWinsockMetaConnectionProvider::ReceivedL(const TRuntimeCtxId& aSender, const TNodeId& aRecipient, TSignatureBase& aMessage) + { + __CFLOG_VAR((KWinSockMCprTag, KWinSockMCprSubTag, _L8("CWinsockMetaConnectionProvider %08x:\tReceivedL() aCFMessage=%d"), + this, aMessage.MessageId())); + + ESOCK_DEBUG_MESSAGE_INTERCEPT(aSender, aMessage, aRecipient); + + TNodeContext ctx(*this, aMessage, aSender, aRecipient); + CCoreMetaConnectionProvider::Received(ctx); + User::LeaveIfError(ctx.iReturn); + } +/** +*/ +void CWinsockMetaConnectionProvider::ProvisionAgentInfoL() + { + __CFLOG_VAR((KAgentMCprTag, KAgentMCprSubTag, _L8("CWinsockMetaConnectionProvider %08x:\tProvisionAgentInfoL()"), this)); + + // It is possible that an AgentProvisionInfo structure has previously been allocated + // We create a new one anyway and override it, meaning the reference on the old one can + // possibly be released (handled for us) resulting in its deletion +#if 0 + RMetaExtensionContainer mec; + mec.Open(AccessPointConfig()); + CleanupClosePushL(mec); + + CAgentProvisionInfo* agentProvisionInfo = new (ELeave) CAgentProvisionInfo; + CleanupStack::PushL(agentProvisionInfo); + mec.AppendExtensionL(agentProvisionInfo); + CleanupStack::Pop(agentProvisionInfo); + + HBufC* agentName(NULL); + + OpenIapViewL(); + IapView()->GetTextL(KCDTIdBearerAgent, agentName); + __ASSERT_DEBUG(agentName, User::Panic(KSpecAssert_NifManAgtPrCgntm, 1)); + + + agentProvisionInfo->SetAgentName(*agentName); + delete agentName; + + agentProvisionInfo->SetIapId(IapView()->IapId()); + TUint32 netId; + IapView()->GetIntL(KCDTIdIAPNetwork,netId); + agentProvisionInfo->SetNetworkId(netId); + agentProvisionInfo->SetBearerSet(0xFF); + + TUint32 reconnectAttempts = 0; + IapView()->GetIntL(KCDTIdMaxConnectionAttempts, reconnectAttempts); + agentProvisionInfo->SetReconnectAttempts(reconnectAttempts); + + + agentProvisionInfo->SetCredentials(CreateCredentialsInfoL()); + iAgentMCPrDoneWithIapView = ETrue; + CloseIapView(); + + // Safely reached the end, commit the changes + AccessPointConfig().Close(); + AccessPointConfig().Open(mec); + CleanupStack::PopAndDestroy(&mec); + +#endif + } + + +/** +Create the Credentials structure in the Agent Provisioning Info, and populate it +with initial values from CommsDat. + +Assumes that IapView() has been setup. +*/ +CCredentialsConfig* CWinsockMetaConnectionProvider::CreateCredentialsInfoL() + { + __ASSERT_DEBUG(IapView(), User::Panic(KSpecAssert_NifManAgtPrCgntm, 2)); + CCredentialsConfig* pCredentialsConfig = CCredentialsConfig::NewLC(IapView()); + CleanupStack::Pop(pCredentialsConfig); + return pCredentialsConfig; + } + + +/** +Opens a ref counted Iap View. This must be closed with a call to CloseIapView +once the view has been finished with. +@return A pointer to the populated CCommsDatIapView. +*/ +EXPORT_C CCommsDatIapView* CWinsockMetaConnectionProvider::OpenIapViewL() + { + if (iIapView == NULL) + { + iIapView = CCommsDatIapView::NewL(ProviderInfo().APId()); + } + + iIapViewRefCount++; + + return iIapView; + } + + +/** +Opens a ref counted Iap View adding the returned object to the cleanup stack. +This must be closed with a call to CloseIapView once the view has been finished +with. +@return A pointer to the populated CCommsDatIapView. +*/ +EXPORT_C CCommsDatIapView* CWinsockMetaConnectionProvider::OpenIapViewLC() + { + CCommsDatIapView* iapView = OpenIapViewL(); + CleanupStack::PushL(TCleanupItem(CleanupCloseIapView, this)); + return iapView; + } + + +/** +The cleanup stack method used to cleanly release the Iap View +@note Removal of the item from the cleanup stack may not always cause deletion +of the object. It still remains ref counted, and is only releasable once both +the ref count has reached zero and the AgentMCPr base class has had a chance +to use it for Provisioning. +*/ +EXPORT_C void CWinsockMetaConnectionProvider::CleanupCloseIapView(TAny* aThis) + { + reinterpret_cast(aThis)->CloseIapView(); + } + + +/** +Closes a reference to the Iap View. +@note The Iap View may not be deleted after this call. It is only deleted once +both the ref count has reached zero and the AgentMCPr base class has had a +chance to use it for Provisioning. +*/ +EXPORT_C void CWinsockMetaConnectionProvider::CloseIapView() + { + if (iAgentMCPrDoneWithIapView && --iIapViewRefCount == 0) + { + DestroyIapView(); + } + } + +void CWinsockMetaConnectionProvider::DestroyIapView() + { + delete iIapView; + iIapView = NULL; + } + + +/** +Gets a pointer to the current Iap View. +@return A pointer to the current Iap View. +@note A call to OpenIapViewL or OpenIapViewLC must be made prior to calling +this method to ensure the returned value is valid. +*/ +EXPORT_C CCommsDatIapView* CWinsockMetaConnectionProvider::IapView() + { + __ASSERT_DEBUG(iIapView, User::Panic(KSpecAssert_NifManAgtPrCgntm, 4)); + return iIapView; + } + +/** +Sets the Agent Notification Handler to be used by the AgentSCPr +@param aNotificationHandler - Pointer to an implementation of the +CAgentNotificationHandler class. This must exist for the lifetime of the MCPr. +*/ +EXPORT_C void CWinsockMetaConnectionProvider::SetAgentNotificationHandlerL (CAgentNotificationHandler* aNotificationHandler) + { +#if 0 + CAgentProvisionInfo* agentProvisionInfo = const_cast(static_cast(AccessPointConfig().FindExtension(CAgentProvisionInfo::TypeId()))); + if (aNotificationHandler || agentProvisionInfo) + { + if (agentProvisionInfo==NULL) + { + RMetaExtensionContainer mec; + mec.Open(AccessPointConfig()); + CleanupClosePushL(mec); + + agentProvisionInfo = new (ELeave) CAgentProvisionInfo; + CleanupStack::PushL(agentProvisionInfo); + mec.AppendExtensionL(agentProvisionInfo); + CleanupStack::Pop(agentProvisionInfo); + + AccessPointConfig().Close(); + AccessPointConfig().Open(mec); + + CleanupStack::PopAndDestroy(&mec); + } + + agentProvisionInfo->SetAgentNotificationHandler(aNotificationHandler); + } + +#endif + } + +/** +Retreives an IPv4 address from a CCommsDatIapView +@param aIapView - A pointer to a CCommsDatIapView to obtain the field from +@param aElementId - The commsdat element Id of the field containing the IPv4 address +@param aAddr - The variable to receive the IPv4 address +*/ +EXPORT_C void CWinsockMetaConnectionProvider::GetIp4AddrL(CCommsDatIapView* aIapView, TMDBElementId aElementId, TUint32& aAddr) + { + User::LeaveIfError(GetIp4Addr(aIapView, aElementId, aAddr)); + } + + +/** +Non-leaving version of GetIp4AddrL. Retreives an IPv4 address from a CCommsDatIapView. +@param aIapView - A pointer to a CCommsDatIapView to obtain the field from +@param aElementId - The commsdat element Id of the field containing the IPv4 address +@param aAddr - The variable to receive the IPv4 address +@return A system-wide error code. KErrNone on success. +*/ +EXPORT_C TInt CWinsockMetaConnectionProvider::GetIp4Addr(CCommsDatIapView* aIapView, TMDBElementId aElementId, TUint32& aAddr) + { + aAddr = KInetAddrNone; + HBufC* buf = NULL; + TInt err = aIapView->GetText(aElementId, buf); + if (err == KErrNone) + { + __ASSERT_DEBUG(buf, User::Panic(KSpecAssert_NifManAgtPrCgntm, 5)); + + TInetAddr addr; + if ((err = addr.Input(*buf)) == KErrNone) + { + aAddr = addr.Address(); + } + delete buf; + } + +#ifdef _DEBUG + if (err != KErrNone) + { + __CFLOG_VAR((KAgentMCprTag, KAgentMCprSubTag, _L8("CWinsockMetaConnectionProvider:\tGetIp4Addr(): error %d reading CommsDat field %08x"), + err, aElementId)); + } +#endif + + return err; + } + + +/** +Retreives an IPv6 address from a CCommsDatIapView. +@param aIapView - A pointer to a CCommsDatIapView to obtain the field from +@param aElementId - The commsdat element Id of the field containing the IPv6 address +@param aAddr - The variable to receive the IPv6 address +*/ +EXPORT_C void CWinsockMetaConnectionProvider::GetIp6AddrL(CCommsDatIapView* aIapView, TMDBElementId aElementId, TIp6Addr& aAddr) + { + User::LeaveIfError(GetIp6Addr(aIapView, aElementId, aAddr)); + } + + +/** +Non-leaving version of GetIp6AddrL. Retreives an IPv6 address from a CCommsDatIapView. +@param aIapView - A pointer to a CCommsDatIapView to obtain the field from +@param aElementId - The commsdat element Id of the field containing the IPv6 address +@param aAddr - The variable to receive the IPv6 address +@return A system-wide error code. KErrNone on success. +*/ +EXPORT_C TInt CWinsockMetaConnectionProvider::GetIp6Addr(CCommsDatIapView* aIapView, TMDBElementId aElementId, TIp6Addr& aAddr) + { + aAddr = KInet6AddrNone; + HBufC* buf = NULL; + TInt err = aIapView->GetText(aElementId, buf); + if (err == KErrNone) + { + __ASSERT_DEBUG(buf, User::Panic(KSpecAssert_NifManAgtPrCgntm, 6)); + + TInetAddr ip6Addr; + if ((err = ip6Addr.Input(*buf)) == KErrNone) + { + aAddr = ip6Addr.Ip6Address(); + } + delete buf; + } + +#ifdef _DEBUG + if (err != KErrNone) + { + __CFLOG_VAR((KAgentMCprTag, KAgentMCprSubTag, _L8("CWinsockMetaConnectionProvider:\tGetIp6Addr(): error %d reading CommsDat field %08x"), + err, aElementId)); + } +#endif + + return err; + } + + +#ifdef _DEBUG +EXPORT_C void CWinsockMetaConnectionProvider::StartAvailabilityMonitoringL(const TNodeCtxId& aAvailabilityActivity) + { + __ASSERT_DEBUG(iAvailabilitySubscriber==NULL, User::Panic(KSpecAssert_NifManAgtPrCgntm, 7)); //Only one start allowed from the availability activity! +// iAvailabilitySubscriber = CAvailabilitySubscriber::NewL(aAvailabilityActivity, ProviderInfo().APId()); +// AddClientL(iAvailabilitySubscriber->Id(), TClientType(TClientType::ERegistrar, TCFClientType::EAvailabilityProvider)); +#else +EXPORT_C void CWinsockMetaConnectionProvider::StartAvailabilityMonitoringL(const Messages::TNodeCtxId& /*aAvailabilityActivity*/) + { +#endif + } + +EXPORT_C void CWinsockMetaConnectionProvider::CancelAvailabilityMonitoring() + { +#ifdef _DEBUG + if (iAvailabilitySubscriber) + { + // RemoveClient(iAvailabilitySubscriber->Id()); + iAvailabilitySubscriber = NULL; //iAvailabilitySubscriber will delete itself when cancelled from the availability activity + } +#endif + } + +/** +Retrieves the MLinkCprLegacyDataAccessExtApi implementation +@param aInterface Pointer to the interface implementation. +*/ +void CWinsockMetaConnectionProvider::ReturnInterfacePtrL(MLinkMCprLegacyDataAccessApiExt*& aInterface) + { + //aInterface = this; + } + +/** +Retrieves the MQueryConnSettingsApiExt implementation +@param aInterface Pointer to the interface implementation. + +*/ + +void CWinsockMetaConnectionProvider::ReturnInterfacePtrL(MQueryConnSettingsApiExt*& aInterface) + { + +#if 0 // Need to be written for winsock + if (!iQueryConnSettingsImpl) + { + const CAgentProvisionInfo* provisionInfo = AgentProvisionInfo(); + iQueryConnSettingsImpl = new (ELeave)CAgentQueryConnSettingsImpl(*provisionInfo, AccessPointConfig()); + } + aInterface = iQueryConnSettingsImpl; +#endif + } + + +#if 0 +EXPORT_C void CWinsockMetaConnectionProvider::GetIntSettingL(const TDesC& aSettingName, TUint32& aValue, MPlatsecApiExt* aPlatsecItf) + { + const CAgentProvisionInfo* provisionInfo = AgentProvisionInfo(); + if (!provisionInfo) + { + User::Leave (KErrNotReady); + } + + TMDBElementId elementId = MapFieldNameL(aSettingName, aPlatsecItf); + MQueryConnSettingsApiExt* queryItf; + ReturnInterfacePtrL(queryItf); + + TInt err = queryItf->GetInt(elementId, aValue, aPlatsecItf); + if (err == KErrNotFound) + { + elementId = SecondChanceModemBearerLegacyMapFieldNameL(aSettingName, aPlatsecItf); + err = queryItf->GetInt(elementId, aValue, aPlatsecItf); + } + User::LeaveIfError(err); + } + + +EXPORT_C void CWinsockMetaConnectionProvider::GetBoolSettingL(const TDesC& aSettingName, TBool& aValue, MPlatsecApiExt* aPlatsecItf) + { + const CAgentProvisionInfo* provisionInfo = AgentProvisionInfo(); + if (!provisionInfo) + { + User::Leave (KErrNotReady); + } + + TMDBElementId elementId = MapFieldNameL(aSettingName, aPlatsecItf); + MQueryConnSettingsApiExt* queryItf; + ReturnInterfacePtrL(queryItf); + + TInt err = queryItf->GetBool(elementId, aValue, aPlatsecItf); + if (err == KErrNotFound) + { + elementId = SecondChanceModemBearerLegacyMapFieldNameL(aSettingName, aPlatsecItf); + err = queryItf->GetBool(elementId, aValue, aPlatsecItf); + } + User::LeaveIfError(err); + } + + +EXPORT_C void CWinsockMetaConnectionProvider::GetDes8SettingL(const TDesC& aSettingName, TDes8& aValue, MPlatsecApiExt* aPlatsecItf) + { + const CAgentProvisionInfo* provisionInfo = AgentProvisionInfo(); + if (!provisionInfo) + { + User::Leave (KErrNotReady); + } + + TMDBElementId elementId = MapFieldNameL(aSettingName, aPlatsecItf); + MQueryConnSettingsApiExt* queryItf; + ReturnInterfacePtrL(queryItf); + + HBufC8* value; + TInt err = queryItf->GetText(elementId, value, aPlatsecItf); + if (err == KErrNotFound) + { + elementId = SecondChanceModemBearerLegacyMapFieldNameL(aSettingName, aPlatsecItf); + err = queryItf->GetText(elementId, value, aPlatsecItf); + } + User::LeaveIfError(err); + aValue = *value; + delete value; + } + + +EXPORT_C void CWinsockMetaConnectionProvider::GetDes16SettingL(const TDesC& aSettingName, TDes16& aValue, MPlatsecApiExt* aPlatsecItf) + { + const CAgentProvisionInfo* provisionInfo = AgentProvisionInfo(); + if (!provisionInfo) + { + User::Leave (KErrNotReady); + } + + TMDBElementId elementId = MapFieldNameL(aSettingName, aPlatsecItf); + MQueryConnSettingsApiExt* queryItf; + ReturnInterfacePtrL(queryItf); + + HBufC* value; + TInt err = queryItf->GetText(elementId, value, aPlatsecItf); + if (err == KErrNotFound) + { + elementId = SecondChanceModemBearerLegacyMapFieldNameL(aSettingName, aPlatsecItf); + err = queryItf->GetText(elementId, value, aPlatsecItf); + } + User::LeaveIfError(err); + aValue = *value; + delete value; + } + + +EXPORT_C void CWinsockMetaConnectionProvider::GetLongDesSettingL(const TDesC& aSettingName, HBufC*& aValue, MPlatsecApiExt* aPlatsecItf) + { + aValue = NULL; + + const CAgentProvisionInfo* provisionInfo = AgentProvisionInfo(); + if (!provisionInfo) + { + User::Leave (KErrNotReady); + } + + TMDBElementId elementId = MapFieldNameL(aSettingName, aPlatsecItf); + MQueryConnSettingsApiExt* queryItf; + ReturnInterfacePtrL(queryItf); + + TInt err = queryItf->GetText(elementId, aValue, aPlatsecItf); + if (err == KErrNotFound) + { + elementId = SecondChanceModemBearerLegacyMapFieldNameL(aSettingName, aPlatsecItf); + err = queryItf->GetText(elementId, aValue, aPlatsecItf); + } + User::LeaveIfError(err); + + } + +#endif +TMDBElementId CWinsockMetaConnectionProvider::MapFieldNameL(const TDesC& aSettingName, MPlatsecApiExt* aPlatsecItf) + { + _LIT(KSlash, "\\"); + TInt pos = aSettingName.Find(KSlash); + if (pos != KErrNotFound) + { + // return CommDbShimUtil::GetElementIdFromFieldNameL(aSettingName); + } + + MQueryConnSettingsApiExt* queryItf; + ReturnInterfacePtrL(queryItf); + + HBufC16* serviceTable; + User::LeaveIfError(queryItf->GetText(KCDTIdIAPServiceType, serviceTable, aPlatsecItf)); + + const TInt KMaxFieldSize = 2*KCommsDbSvrMaxFieldLength + 1; + TBuf field; + + field = *serviceTable; + delete serviceTable; + + field.Append(KSlash); + field.Append(aSettingName); + //return CommDbShimUtil::GetElementIdFromFieldNameL(field); + } + +TMDBElementId CWinsockMetaConnectionProvider::SecondChanceModemBearerLegacyMapFieldNameL(const TDesC& aSettingName, MPlatsecApiExt* aPlatsecItf) + { + //This nasty looking method re-implements the lagacy behaviour whereat, despite the current IAP not + //featuring the ModemBearer table (because it represnts LAN for instance) would still serve queries + //addressed to "ModemBearer\\>" assuming the local equivallent of the ModemBearer (e.g: LanBearer) + //table is actually meant. + _LIT(KSlash, "\\"); + TInt pos = aSettingName.Find(KSlash); + if (pos != KErrNotFound) + { + TPtrC left = aSettingName.Left(pos); + TPtrC right = aSettingName.Mid(pos+1); + if (left.CompareC(TPtrC(MODEM_BEARER)) == 0) + { + HBufC16* bearerTable; + + MQueryConnSettingsApiExt* queryItf; + ReturnInterfacePtrL(queryItf); + + User::LeaveIfError(queryItf->GetText(KCDTIdIAPBearerType, bearerTable, aPlatsecItf)); + + const TInt KMaxFieldSize = 2*KCommsDbSvrMaxFieldLength + 1; + TBuf field; + + field = *bearerTable; + delete bearerTable; + + field.Append(KSlash); + field.Append(right); + return MapFieldNameL(field, aPlatsecItf); + } + } + User::Leave(KErrNotFound); + return 0; + } + +/** +Retrieves the Agent Provider specific provisioning information as given by the MCpr +transition. + +@internalTechnology +*/ +const CAgentProvisionInfo* CWinsockMetaConnectionProvider::AgentProvisionInfo() + { +#if 0 + } + const CAgentProvisionInfo* agentProvisionInfo = static_cast(AccessPointConfig().FindExtension(CAgentProvisionInfo::TypeId())); + __ASSERT_DEBUG(agentProvisionInfo, User::Panic(KSpecAssert_NifManAgtPrCgntm, 8)); + return agentProvisionInfo; +#endif + } + diff -r ac50fd48361b -r 82fb8aa91b2c sdkcreationmw/sdkruntimes/new_wsock_3pc/src/winsockmcprfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdkcreationmw/sdkruntimes/new_wsock_3pc/src/winsockmcprfactory.cpp Wed Apr 21 10:32:25 2010 +0530 @@ -0,0 +1,64 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// RawIP MCPR Factory +// +// + +/** + @file + @internalComponent +*/ + +#include "winsockmcprfactory.h" +#include "winsockmcpr.h" +#include +#include + +#include +#include + +#ifdef __CFLOG_ACTIVE +#define KRawIPMCprFactoryTag KESockMetaConnectionTag +// _LIT8(KRawIPMCprFactorySubTag, "rawipmcprfactory"); +#endif // __CFLOG_ACTIVE + +using namespace ESock; + +//-========================================================= +// +// CWinsockMetaConnectionProviderFactory methods +// +//-========================================================= +CWinsockMetaConnectionProviderFactory* CWinsockMetaConnectionProviderFactory::NewL(TAny* aParentContainer) + { + //__CFLOG_VAR((KRawIPMCprFactoryTag, KRawIPMCprFactorySubTag, _L8("CWinsockMetaConnectionProviderFactory ::\tNewL(%08x)"), aParentContainer)); + return new (ELeave) CWinsockMetaConnectionProviderFactory(TUid::Uid(CWinsockMetaConnectionProviderFactory::iUid), *(reinterpret_cast(aParentContainer))); + } + +CWinsockMetaConnectionProviderFactory::CWinsockMetaConnectionProviderFactory(TUid aFactoryId, CMetaConnectionFactoryContainer& aParentContainer) + : CMetaConnectionProviderFactoryBase(aFactoryId,aParentContainer) + { + __CFLOG_VAR((KRawIPMCprFactoryTag, KRawIPMCprFactorySubTag, _L8("CWinsockMetaConnectionProviderFactory %08x:\tCWinsockMetaConnectionProviderFactory Constructor"), this)); + } + +ACommsFactoryNodeId* CWinsockMetaConnectionProviderFactory::DoCreateObjectL(ESock::TFactoryQueryBase& aQuery) + { + const TMetaConnectionFactoryQuery& query = static_cast(aQuery); + CWinsockMetaConnectionProvider* provider = CWinsockMetaConnectionProvider::NewL(*this, query.iProviderInfo); + + //ESOCK_DEBUG_REGISTER_GENERAL_NODE(iUid, provider); + + return provider; + } + diff -r ac50fd48361b -r 82fb8aa91b2c sdkcreationmw/sdkruntimes/new_wsock_3pc/src/winsockprovision.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdkcreationmw/sdkruntimes/new_wsock_3pc/src/winsockprovision.cpp Wed Apr 21 10:32:25 2010 +0530 @@ -0,0 +1,60 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// TunnelMCPR.CPP +// Tunnel MCPR +// +// + +/** + @file + @internalComponent +*/ + +#include "winsockprovision.h" +#include +#include + +using namespace ESock; +using namespace CommsDat; + +void TWinsockProvision::InitialiseConfigL(CCommsDatIapView* aIapView) + { + iInfo.iLocalIap = aIapView->IapId(); // IAP + + TUint32 val; + + aIapView->GetIntL(KCDTIdIAPNetwork, val); // Network Id + iInfo.iLocalNetwork = val; + + TInt err; + err = aIapView->GetInt(KCDTIdVPNIAPRecord, val); // VPN IAP + if(err == KErrNotFound) + val = 0; /* Hard code to 0 for SNAP, should be backed up by appropriate configuration*/ + else if(err != KErrNone) + User::Leave(err); + val = (val & KCDMaskShowRecordId) >> 8; + + // form the Tunnel CFProtocol name + _LIT(KNifNameFormat, "tunnelnif[0x%08x][%d:%d]"); + + iInfo.iIfName.Format(KNifNameFormat, this, iInfo.iLocalIap, val); + } + +// +// Attribute table for provisioning structure passed to CFProtocol +// + +START_ATTRIBUTE_TABLE(TWinsockProvision, TWinsockProvision::EUid, TWinsockProvision::ETypeId) +// No attributes defined - no serialisation performed +END_ATTRIBUTE_TABLE()