sl@0: /* sl@0: * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: sl@0: #include sl@0: #include sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #ifndef __IPSECKEYSTREAMSINK_H__ sl@0: #define __IPSECKEYSTREAMSINK_H__ sl@0: sl@0: class RDesReadStream; sl@0: sl@0: namespace StreamAccess sl@0: { sl@0: NONSHARABLE_CLASS(CIpSecKeyStreamSink) : public CKeyStreamSink sl@0: { sl@0: public: sl@0: static CIpSecKeyStreamSink* NewLC(RReadStream& aReadStream); sl@0: static CIpSecKeyStreamSink* NewLC(const TInetAddr& aSrcAddr, const TInetAddr& aDstAddr); sl@0: ~CIpSecKeyStreamSink(); sl@0: sl@0: // CKeyStreamSink interface sl@0: CKeyStreamSink* CloneLC() const; sl@0: void ProcessNewKeyAssociationL(const CKeyAssociation& aKeyAssociation); sl@0: void SetEncryptionAlgorithmL(const TEncryptionAlgorithm& aEncryptionAlgorithm); sl@0: void SetAuthenticationAlgorithmL(const TAuthenticationAlgorithm& aAuthenticationAlgorithm); sl@0: protected: sl@0: void DoExternalizeL(RWriteStream& aStream) const; sl@0: private: sl@0: void ConstructL(); sl@0: void SetPolicyL(); sl@0: void RemoveSaL(TUint32 aSpi); sl@0: void SynchronousSendAndVerifyMessageL(TPfkeySendMsg& aMessage, TInt aMessageType, TUint32 aSpi); sl@0: TBool CompareReceivedMessageExtensionsL(TPfkeyRecvMsg &aReceivedReply, TUint32 aSpi) const; sl@0: void VerifyAssociationsNotSentL() const; sl@0: CIpSecKeyStreamSink(const TInetAddr& aSrcAddr, const TInetAddr& aDstAddr); sl@0: void AddAssociationL(TPfkeySendMsg& aMessage, TUint32 aSpi); sl@0: private: sl@0: RSocketServ iSocketServ; sl@0: /** Handle to policy server */ sl@0: RIpsecPolicyServ iPolicyServer; sl@0: /** Handle to SADB socket */ sl@0: RSADB iSADB; sl@0: TInetAddr iSourceAddr; sl@0: TInetAddr iDestinationAddr; sl@0: TUint8 iAuthAlg; sl@0: TUint8 iEncAlg; sl@0: TUint32 iSequenceNumber; sl@0: /** Signifies whether a security policy has already been set */ sl@0: TBool iPolicySet; sl@0: TPolicyHandlePckg iPolicyHandle; sl@0: /** Used for removing old SA-s, managed as a FIFO queue */ sl@0: RArray iSubmittedSpiList; sl@0: /** Number of supported concurrent SA-s */ sl@0: TInt iMaxSpiNumber; sl@0: }; sl@0: } // namespace StreamAccess sl@0: #endif /* __IPSECKEYSTREAMSINK_H__ */ sl@0: sl@0: