1 | /** @file
|
---|
2 | IKE Packet related definitions and function declarations.
|
---|
3 |
|
---|
4 | Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
---|
5 |
|
---|
6 | This program and the accompanying materials
|
---|
7 | are licensed and made available under the terms and conditions of the BSD License
|
---|
8 | which accompanies this distribution. The full text of the license may be found at
|
---|
9 | http://opensource.org/licenses/bsd-license.php.
|
---|
10 |
|
---|
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
---|
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
---|
13 |
|
---|
14 | **/
|
---|
15 |
|
---|
16 | #ifndef _IKE_V1_PACKET_H_
|
---|
17 | #define _IKE_V1_PACKET_H_
|
---|
18 |
|
---|
19 | #include "Ike.h"
|
---|
20 |
|
---|
21 | #define IKE_PACKET_REF(p) ((p)->RefCount++)
|
---|
22 |
|
---|
23 | /**
|
---|
24 | Allocate a buffer for the IKE_PACKET and intitalize its Header and payloadlist.
|
---|
25 |
|
---|
26 | @return The pointer of the IKE_PACKET.
|
---|
27 |
|
---|
28 | **/
|
---|
29 | IKE_PACKET *
|
---|
30 | IkePacketAlloc (
|
---|
31 | VOID
|
---|
32 | );
|
---|
33 |
|
---|
34 |
|
---|
35 | /**
|
---|
36 | Free the IkePacket by the specified IKE_PACKET pointer.
|
---|
37 |
|
---|
38 | @param[in] IkePacket The pointer of the IKE_PACKET to be freed.
|
---|
39 |
|
---|
40 | **/
|
---|
41 | VOID
|
---|
42 | IkePacketFree (
|
---|
43 | IN IKE_PACKET *IkePacket
|
---|
44 | );
|
---|
45 |
|
---|
46 |
|
---|
47 | /**
|
---|
48 | Copy the NetBuf into a IKE_PACKET sturcture.
|
---|
49 |
|
---|
50 | Create a IKE_PACKET and fill the received IKE header into the header of IKE_PACKET
|
---|
51 | and copy the recieved packet without IKE HEADER to the PayloadBuf of IKE_PACKET.
|
---|
52 |
|
---|
53 | @param[in] Netbuf The pointer of the Netbuf which contains the whole received
|
---|
54 | IKE packet.
|
---|
55 |
|
---|
56 | @return The pointer of the IKE_PACKET which contains the received packet.
|
---|
57 |
|
---|
58 | **/
|
---|
59 | IKE_PACKET *
|
---|
60 | IkePacketFromNetbuf (
|
---|
61 | IN NET_BUF *Netbuf
|
---|
62 | );
|
---|
63 |
|
---|
64 | /**
|
---|
65 | Convert the format from IKE_PACKET to NetBuf.
|
---|
66 |
|
---|
67 | @param[in] SessionCommon Pointer of related IKE_COMMON_SESSION
|
---|
68 | @param[in] IkePacket Pointer of IKE_PACKET to be copy to NetBuf
|
---|
69 | @param[in] IkeType The IKE type to pointer the packet is for which IKE
|
---|
70 | phase. Now it supports IKE_SA_TYPE, IKE_CHILDSA_TYPE,
|
---|
71 | IKE_INFO_TYPE.
|
---|
72 |
|
---|
73 | @return A pointer of Netbuff which contains the contents of the IKE_PACKE in network order.
|
---|
74 | **/
|
---|
75 | NET_BUF *
|
---|
76 | IkeNetbufFromPacket (
|
---|
77 | IN UINT8 *SessionCommon,
|
---|
78 | IN IKE_PACKET *IkePacket,
|
---|
79 | IN UINTN IkeType
|
---|
80 | );
|
---|
81 |
|
---|
82 | #endif
|
---|