]> git.ipfire.org Git - thirdparty/openssl.git/blobdiff - ssl/quic/quic_local.h
SSL object refactoring using SSL_CONNECTION object
[thirdparty/openssl.git] / ssl / quic / quic_local.h
index 8bd40cf9163fe8af77a2e702e329947a9c2d27c4..e0d172979ff0cf9ac4216e73ba6ac9200895b6cd 100644 (file)
 # include <openssl/ssl.h>
 # include "../ssl_local.h"
 
+typedef struct quic_conn_st {
+    /* type identifier and common data */
+    struct ssl_st ssl;
+    /* the associated tls-1.3 connection data */
+    SSL *tls;
+    /* just an example member */
+    uint64_t conn_id;
+} QUIC_CONNECTION;
+
+# define QUIC_CONNECTION_FROM_SSL_int(ssl, c)   \
+    ((ssl) == NULL ? NULL                       \
+     : ((ssl)->type == SSL_TYPE_QUIC_CONNECTION \
+        ? (c QUIC_CONNECTION *)(ssl)            \
+        : NULL))
+
+# define SSL_CONNECTION_FROM_QUIC_SSL_int(ssl, c)               \
+    ((ssl) == NULL ? NULL                                       \
+     : ((ssl)->type == SSL_TYPE_QUIC_CONNECTION                 \
+        ? (c SSL_CONNECTION *)((c QUIC_CONNECTION *)(ssl))->tls \
+        : NULL))
+
+# define QUIC_CONNECTION_FROM_SSL(ssl) \
+    QUIC_CONNECTION_FROM_SSL_int(ssl, SSL_CONNECTION_NO_CONST)
+# define QUIC_CONNECTION_FROM_CONST_SSL(ssl) \
+    QUIC_CONNECTION_FROM_SSL_int(ssl, const)
+# define SSL_CONNECTION_FROM_QUIC_SSL(ssl) \
+    SSL_CONNECTION_FROM_QUIC_SSL_int(ssl, SSL_CONNECTION_NO_CONST)
+# define SSL_CONNECTION_FROM_CONST_QUIC_SSL(ssl) \
+    SSL_CONNECTION_FROM_CONST_QUIC_SSL_int(ssl, const)
+
 # define OSSL_QUIC_ANY_VERSION 0xFFFFF
 
 # define IMPLEMENT_quic_meth_func(version, func_name, q_accept, \
@@ -24,8 +54,11 @@ const SSL_METHOD *func_name(void)  \
                 0, \
                 0, \
                 ossl_quic_new, \
-                ossl_quic_clear, \
                 ossl_quic_free, \
+                ossl_quic_reset, \
+                ossl_quic_init, \
+                ossl_quic_clear, \
+                ossl_quic_deinit, \
                 q_accept, \
                 q_connect, \
                 ossl_quic_read, \
@@ -53,8 +86,11 @@ const SSL_METHOD *func_name(void)  \
         return &func_name##_data; \
         }
 
-__owur int ossl_quic_new(SSL *s);
+__owur SSL *ossl_quic_new(SSL_CTX *ctx);
+__owur int ossl_quic_init(SSL *s);
+void ossl_quic_deinit(SSL *s);
 void ossl_quic_free(SSL *s);
+int ossl_quic_reset(SSL *s);
 int ossl_quic_clear(SSL *s);
 __owur int ossl_quic_accept(SSL *s);
 __owur int ossl_quic_connect(SSL *s);
@@ -63,9 +99,9 @@ __owur int ossl_quic_peek(SSL *s, void *buf, size_t len, size_t *readbytes);
 __owur int ossl_quic_write(SSL *s, const void *buf, size_t len, size_t *written);
 __owur int ossl_quic_shutdown(SSL *s);
 __owur long ossl_quic_ctrl(SSL *s, int cmd, long larg, void *parg);
-__owur long ossl_quic_ctx_ctrl(SSL_CTX *s, int cmd, long larg, void *parg);
+__owur long ossl_quic_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg);
 __owur long ossl_quic_callback_ctrl(SSL *s, int cmd, void (*fp) (void));
-__owur long ossl_quic_ctx_callback_ctrl(SSL_CTX *s, int cmd, void (*fp) (void));
+__owur long ossl_quic_ctx_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp) (void));
 __owur size_t ossl_quic_pending(const SSL *s);
 __owur long ossl_quic_default_timeout(void);
 __owur int ossl_quic_num_ciphers(void);