1+ /**
2+ * @file tlshd.h
3+ * @brief Generic definitions and forward declarations for tlshd
4+ */
5+
16/*
2- * Generic definitions and forward declarations for tlshd.
3- *
47 * ktls-utils is free software; you can redistribute it and/or
58 * modify it under the terms of the GNU General Public License as
69 * published by the Free Software Foundation; version 2.
1821
1922#include <linux/netlink.h>
2023
24+ /**
25+ * @def ARRAY_SIZE
26+ * @brief Generate the number of elements in an array
27+ */
2128#define ARRAY_SIZE (a ) (sizeof(a) / sizeof((a)[0]))
2229
2330extern int tlshd_debug ;
@@ -27,21 +34,27 @@ extern int tlshd_stderr;
2734
2835struct nl_sock ;
2936
37+ /**
38+ * @struct tlshd_handshake_parms
39+ * @brief Handshake parameters (global)
40+ */
3041struct tlshd_handshake_parms {
31- char * peername ;
32- char * peeraddr ;
33- int sockfd ;
34- int ip_proto ;
35- uint32_t handshake_type ;
36- unsigned int timeout_ms ;
37- uint32_t auth_mode ;
38- key_serial_t keyring ;
39- key_serial_t x509_cert ;
40- key_serial_t x509_privkey ;
41- GArray * peerids ;
42- GArray * remote_peerids ;
43-
44- unsigned int session_status ;
42+ /*@{*/
43+ char * peername ; /**< Remote's DNS label */
44+ char * peeraddr ; /**< Remote's IP address */
45+ int sockfd ; /**< Socket on which to perform the handshake */
46+ int ip_proto ; /**< Transport protocol number */
47+ uint32_t handshake_type ; /**< Handshake interaction to perform */
48+ unsigned int timeout_ms ; /**< How long to wait for completion */
49+ uint32_t auth_mode ; /**< x.509, PSK, etc. */
50+ key_serial_t keyring ; /**< Keyring containing auth material */
51+ key_serial_t x509_cert ; /**< Key serial of our x.509 cert */
52+ key_serial_t x509_privkey ; /**< Key serial of our x.509 private key */
53+ GArray * peerids ; /**< Peer identities to present to servers */
54+ GArray * remote_peerids ; /**< Peer identities presented by clients */
55+
56+ unsigned int session_status ; /**< Handshake completion status */
57+ /*@}*/
4558};
4659
4760enum peer_type {
@@ -134,13 +147,21 @@ extern void tlshd_quic_serverhello_handshake(struct tlshd_handshake_parms *parms
134147#define TLSHD_QUIC_MAX_DATA_LEN 4096
135148#define TLSHD_QUIC_MAX_ALPNS_LEN 128
136149
150+ /**
151+ * @struct tlshd_quic_msg
152+ * @brief QUIC message format
153+ */
137154struct tlshd_quic_msg {
138155 struct tlshd_quic_msg * next ;
139156 uint8_t data [TLSHD_QUIC_MAX_DATA_LEN ];
140157 uint32_t len ;
141158 uint8_t level ;
142159};
143160
161+ /**
162+ * @struct tlshd_quic_conn
163+ * @brief QUIC connection object
164+ */
144165struct tlshd_quic_conn {
145166 struct tlshd_handshake_parms * parms ;
146167 char alpns [TLSHD_QUIC_MAX_ALPNS_LEN ];
@@ -161,16 +182,39 @@ struct tlshd_quic_conn {
161182 struct tlshd_quic_msg recv_msg ;
162183};
163184
164- /* quic.c */
165185extern int tlshd_quic_conn_create (struct tlshd_quic_conn * * conn_p ,
166186 struct tlshd_handshake_parms * parms );
167187extern void tlshd_quic_conn_destroy (struct tlshd_quic_conn * conn );
168188extern void tlshd_quic_start_handshake (struct tlshd_quic_conn * conn );
189+
169190#endif
170191
192+ /**
193+ * @def TLS_DEFAULT_PSK_TYPE
194+ * @brief Default type of pre-shared key
195+ */
171196#define TLS_DEFAULT_PSK_TYPE "psk"
197+
198+ /**
199+ * @def TLS_NO_PEERID
200+ * @brief No peer ID provided via keyring
201+ */
172202#define TLS_NO_PEERID (0)
203+
204+ /**
205+ * @def TLS_NO_CERT
206+ * @brief No certificate provided via keyring
207+ */
173208#define TLS_NO_CERT (0)
209+
210+ /**
211+ * @def TLS_NO_PRIVKEY
212+ * @brief No private key provided via keyring
213+ */
174214#define TLS_NO_PRIVKEY (0)
175- /* Max number of (chained) certs to load */
215+
216+ /**
217+ * @def TLSHD_MAX_CERTS
218+ * @brief Maximum number of (chained) certs to load
219+ */
176220#define TLSHD_MAX_CERTS 10
0 commit comments