xref: /dpdk/lib/net/rte_tls.h (revision fba9875559906e04eaeb74532f4cfd51194259a2)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2023 Marvell.
3  */
4 
5 #ifndef RTE_TLS_H
6 #define RTE_TLS_H
7 
8 /**
9  * @file
10  *
11  * Transport layer security (TLS) related defines.
12  */
13 
14 #include <rte_byteorder.h>
15 
16 #define RTE_TLS_TYPE_INVALID              0 /**< Invalid TLS message type. */
17 #define RTE_TLS_TYPE_CHANGE_CIPHER_SPEC  20 /**< Change cipher spec message. */
18 #define RTE_TLS_TYPE_ALERT               21 /**< Alert message. */
19 #define RTE_TLS_TYPE_HANDSHAKE           22 /**< Handshake message for TLS. */
20 #define RTE_TLS_TYPE_APPDATA             23 /**< TLS application data message. */
21 #define RTE_TLS_TYPE_HEARTBEAT           24 /**< TLS 1.3 heartbeat message. */
22 #define RTE_TLS_TYPE_MAX                255 /**< Maximum value as TLS content type. */
23 
24 #define RTE_TLS_VERSION_1_2    0x0303 /**< TLS 1.2 version. */
25 #define RTE_TLS_VERSION_1_3    0x0304 /**< TLS 1.3 version. */
26 
27 /**
28  * TLS Header
29  */
30 __extension__
31 struct __rte_packed_begin rte_tls_hdr {
32 	/** Content type of TLS packet. Defined as RTE_TLS_TYPE_*. */
33 	uint8_t type;
34 	/** TLS Version defined as RTE_TLS_VERSION*. */
35 	rte_be16_t version;
36 	/** The length (in bytes) of the following TLS packet. */
37 	rte_be16_t length;
38 } __rte_packed_end;
39 
40 #endif /* RTE_TLS_H */
41