1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/contentmgmt/cafstreamingsupport/source/ipsec/ipseckeystreamsink.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,86 @@
1.4 +/*
1.5 +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +/**
1.23 +@file
1.24 +
1.25 +@internalComponent
1.26 +@released
1.27 +*/
1.28 +
1.29 +#include <caf/streaming/keystreamsink.h>
1.30 +#include <caf/streaming/keyassociation.h>
1.31 +
1.32 +#include <in_sock.h>
1.33 +#include <lib_pfkey.h>
1.34 +#include <pfkey_send.h>
1.35 +#include <ipsecpolapi.h>
1.36 +
1.37 +#ifndef __IPSECKEYSTREAMSINK_H__
1.38 +#define __IPSECKEYSTREAMSINK_H__
1.39 +
1.40 +class RDesReadStream;
1.41 +
1.42 +namespace StreamAccess
1.43 +{
1.44 + NONSHARABLE_CLASS(CIpSecKeyStreamSink) : public CKeyStreamSink
1.45 + {
1.46 + public:
1.47 + static CIpSecKeyStreamSink* NewLC(RReadStream& aReadStream);
1.48 + static CIpSecKeyStreamSink* NewLC(const TInetAddr& aSrcAddr, const TInetAddr& aDstAddr);
1.49 + ~CIpSecKeyStreamSink();
1.50 +
1.51 + // CKeyStreamSink interface
1.52 + CKeyStreamSink* CloneLC() const;
1.53 + void ProcessNewKeyAssociationL(const CKeyAssociation& aKeyAssociation);
1.54 + void SetEncryptionAlgorithmL(const TEncryptionAlgorithm& aEncryptionAlgorithm);
1.55 + void SetAuthenticationAlgorithmL(const TAuthenticationAlgorithm& aAuthenticationAlgorithm);
1.56 + protected:
1.57 + void DoExternalizeL(RWriteStream& aStream) const;
1.58 + private:
1.59 + void ConstructL();
1.60 + void SetPolicyL();
1.61 + void RemoveSaL(TUint32 aSpi);
1.62 + void SynchronousSendAndVerifyMessageL(TPfkeySendMsg& aMessage, TInt aMessageType, TUint32 aSpi);
1.63 + TBool CompareReceivedMessageExtensionsL(TPfkeyRecvMsg &aReceivedReply, TUint32 aSpi) const;
1.64 + void VerifyAssociationsNotSentL() const;
1.65 + CIpSecKeyStreamSink(const TInetAddr& aSrcAddr, const TInetAddr& aDstAddr);
1.66 + void AddAssociationL(TPfkeySendMsg& aMessage, TUint32 aSpi);
1.67 + private:
1.68 + RSocketServ iSocketServ;
1.69 + /** Handle to policy server */
1.70 + RIpsecPolicyServ iPolicyServer;
1.71 + /** Handle to SADB socket */
1.72 + RSADB iSADB;
1.73 + TInetAddr iSourceAddr;
1.74 + TInetAddr iDestinationAddr;
1.75 + TUint8 iAuthAlg;
1.76 + TUint8 iEncAlg;
1.77 + TUint32 iSequenceNumber;
1.78 + /** Signifies whether a security policy has already been set */
1.79 + TBool iPolicySet;
1.80 + TPolicyHandlePckg iPolicyHandle;
1.81 + /** Used for removing old SA-s, managed as a FIFO queue */
1.82 + RArray<TUint32> iSubmittedSpiList;
1.83 + /** Number of supported concurrent SA-s */
1.84 + TInt iMaxSpiNumber;
1.85 + };
1.86 +} // namespace StreamAccess
1.87 +#endif /* __IPSECKEYSTREAMSINK_H__ */
1.88 +
1.89 +