]> git.proxmox.com Git - mirror_edk2.git/blob - NetworkPkg/IpSecDxe/IkePacket.h
NetworkPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / NetworkPkg / IpSecDxe / IkePacket.h
1 /** @file
2 IKE Packet related definitions and function declarations.
3
4 Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #ifndef _IKE_V1_PACKET_H_
11 #define _IKE_V1_PACKET_H_
12
13 #include "Ike.h"
14
15 #define IKE_PACKET_REF(p) ((p)->RefCount++)
16
17 /**
18 Allocate a buffer for the IKE_PACKET and intitalize its Header and payloadlist.
19
20 @return The pointer of the IKE_PACKET.
21
22 **/
23 IKE_PACKET *
24 IkePacketAlloc (
25 VOID
26 );
27
28
29 /**
30 Free the IkePacket by the specified IKE_PACKET pointer.
31
32 @param[in] IkePacket The pointer of the IKE_PACKET to be freed.
33
34 **/
35 VOID
36 IkePacketFree (
37 IN IKE_PACKET *IkePacket
38 );
39
40
41 /**
42 Copy the NetBuf into a IKE_PACKET sturcture.
43
44 Create a IKE_PACKET and fill the received IKE header into the header of IKE_PACKET
45 and copy the recieved packet without IKE HEADER to the PayloadBuf of IKE_PACKET.
46
47 @param[in] Netbuf The pointer of the Netbuf which contains the whole received
48 IKE packet.
49
50 @return The pointer of the IKE_PACKET which contains the received packet.
51
52 **/
53 IKE_PACKET *
54 IkePacketFromNetbuf (
55 IN NET_BUF *Netbuf
56 );
57
58 /**
59 Convert the format from IKE_PACKET to NetBuf.
60
61 @param[in] SessionCommon Pointer of related IKE_COMMON_SESSION
62 @param[in] IkePacket Pointer of IKE_PACKET to be copy to NetBuf
63 @param[in] IkeType The IKE type to pointer the packet is for which IKE
64 phase. Now it supports IKE_SA_TYPE, IKE_CHILDSA_TYPE,
65 IKE_INFO_TYPE.
66
67 @return A pointer of Netbuff which contains the contents of the IKE_PACKE in network order.
68 **/
69 NET_BUF *
70 IkeNetbufFromPacket (
71 IN UINT8 *SessionCommon,
72 IN IKE_PACKET *IkePacket,
73 IN UINTN IkeType
74 );
75
76 #endif