diff -r 000000000000 -r f5a58ecadc66 servicediscoveryandcontrol/pnp/test/upnp/Client/upnpplugin/inc/pnputils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/servicediscoveryandcontrol/pnp/test/upnp/Client/upnpplugin/inc/pnputils.h Tue Feb 02 01:12:20 2010 +0200 @@ -0,0 +1,79 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "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 __PNPUTILS_H_ +#define __PNPUTILS_H_ +#include +#include +#include +#include +#include +#include +#include + +/* Utilities class + @internalComponent + */ +class CUPnPUtils : public CBase + { + +public: + /* + * Converts a RSubConParameterBundle to CSubConParameterBundle and vice-versa + */ + template + static TUint ReplicateToReverseBundle (const T1& aSrcBundle,T2& aTargetBundle); + + enum TClientDllPanic + { + EPnpServiceDiscoveryHandleNotOpen + }; + enum TUriType + { + EService, + EDevice, + EAny + }; + TUriType iUriType; + static void ResolveHostAddressL ( RHostResolver& aResolver,const TDesC8& aUri, TInetAddr& aSockAddr ); + static TInt GenericUriValidity ( const TDesC8& aUri ,TUriType aType); + +private: + static const TUint KOffset=3; + static const TUint KIpv4MaxAddrSize = 20; + }; + +template +TUint CUPnPUtils::ReplicateToReverseBundle (const T1& aSrcBundle,T2& aTargetBundle) + + { + TUint length = aSrcBundle.Length(); + RBuf8 serializedBuffer; + TUint err; + if((err=serializedBuffer.Create(length))!=KErrNone) + return err; + //Create a serailized version of the cscparambundle and store it in tempdata + if((err=aSrcBundle.Store(serializedBuffer))!=KErrNone) + return err; + //Deserialize tempData to rsubconparambundle + if((err=aTargetBundle.Load(serializedBuffer))!=KErrNone) + return err; + serializedBuffer.Close(); + return KErrNone; + } + + + +#endif /*PNPUTILS_H_*/