sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@file
|
sl@0
|
21 |
|
sl@0
|
22 |
@internalComponent
|
sl@0
|
23 |
@released
|
sl@0
|
24 |
*/
|
sl@0
|
25 |
|
sl@0
|
26 |
#include <caf/streaming/keystreamsink.h>
|
sl@0
|
27 |
#include <caf/streaming/keyassociation.h>
|
sl@0
|
28 |
|
sl@0
|
29 |
#include <in_sock.h>
|
sl@0
|
30 |
#include <lib_pfkey.h>
|
sl@0
|
31 |
#include <pfkey_send.h>
|
sl@0
|
32 |
#include <ipsecpolapi.h>
|
sl@0
|
33 |
|
sl@0
|
34 |
#ifndef __IPSECKEYSTREAMSINK_H__
|
sl@0
|
35 |
#define __IPSECKEYSTREAMSINK_H__
|
sl@0
|
36 |
|
sl@0
|
37 |
class RDesReadStream;
|
sl@0
|
38 |
|
sl@0
|
39 |
namespace StreamAccess
|
sl@0
|
40 |
{
|
sl@0
|
41 |
NONSHARABLE_CLASS(CIpSecKeyStreamSink) : public CKeyStreamSink
|
sl@0
|
42 |
{
|
sl@0
|
43 |
public:
|
sl@0
|
44 |
static CIpSecKeyStreamSink* NewLC(RReadStream& aReadStream);
|
sl@0
|
45 |
static CIpSecKeyStreamSink* NewLC(const TInetAddr& aSrcAddr, const TInetAddr& aDstAddr);
|
sl@0
|
46 |
~CIpSecKeyStreamSink();
|
sl@0
|
47 |
|
sl@0
|
48 |
// CKeyStreamSink interface
|
sl@0
|
49 |
CKeyStreamSink* CloneLC() const;
|
sl@0
|
50 |
void ProcessNewKeyAssociationL(const CKeyAssociation& aKeyAssociation);
|
sl@0
|
51 |
void SetEncryptionAlgorithmL(const TEncryptionAlgorithm& aEncryptionAlgorithm);
|
sl@0
|
52 |
void SetAuthenticationAlgorithmL(const TAuthenticationAlgorithm& aAuthenticationAlgorithm);
|
sl@0
|
53 |
protected:
|
sl@0
|
54 |
void DoExternalizeL(RWriteStream& aStream) const;
|
sl@0
|
55 |
private:
|
sl@0
|
56 |
void ConstructL();
|
sl@0
|
57 |
void SetPolicyL();
|
sl@0
|
58 |
void RemoveSaL(TUint32 aSpi);
|
sl@0
|
59 |
void SynchronousSendAndVerifyMessageL(TPfkeySendMsg& aMessage, TInt aMessageType, TUint32 aSpi);
|
sl@0
|
60 |
TBool CompareReceivedMessageExtensionsL(TPfkeyRecvMsg &aReceivedReply, TUint32 aSpi) const;
|
sl@0
|
61 |
void VerifyAssociationsNotSentL() const;
|
sl@0
|
62 |
CIpSecKeyStreamSink(const TInetAddr& aSrcAddr, const TInetAddr& aDstAddr);
|
sl@0
|
63 |
void AddAssociationL(TPfkeySendMsg& aMessage, TUint32 aSpi);
|
sl@0
|
64 |
private:
|
sl@0
|
65 |
RSocketServ iSocketServ;
|
sl@0
|
66 |
/** Handle to policy server */
|
sl@0
|
67 |
RIpsecPolicyServ iPolicyServer;
|
sl@0
|
68 |
/** Handle to SADB socket */
|
sl@0
|
69 |
RSADB iSADB;
|
sl@0
|
70 |
TInetAddr iSourceAddr;
|
sl@0
|
71 |
TInetAddr iDestinationAddr;
|
sl@0
|
72 |
TUint8 iAuthAlg;
|
sl@0
|
73 |
TUint8 iEncAlg;
|
sl@0
|
74 |
TUint32 iSequenceNumber;
|
sl@0
|
75 |
/** Signifies whether a security policy has already been set */
|
sl@0
|
76 |
TBool iPolicySet;
|
sl@0
|
77 |
TPolicyHandlePckg iPolicyHandle;
|
sl@0
|
78 |
/** Used for removing old SA-s, managed as a FIFO queue */
|
sl@0
|
79 |
RArray<TUint32> iSubmittedSpiList;
|
sl@0
|
80 |
/** Number of supported concurrent SA-s */
|
sl@0
|
81 |
TInt iMaxSpiNumber;
|
sl@0
|
82 |
};
|
sl@0
|
83 |
} // namespace StreamAccess
|
sl@0
|
84 |
#endif /* __IPSECKEYSTREAMSINK_H__ */
|
sl@0
|
85 |
|
sl@0
|
86 |
|