tls: dtls initial implementation
[vpp.git] / src / vnet / tls / tls.h
index eaba3c0..2038fdf 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef SRC_VNET_TLS_TLS_H_
 #define SRC_VNET_TLS_TLS_H_
 
-#define TLS_DEBUG              0
+#define TLS_DEBUG              0
 #define TLS_DEBUG_LEVEL_CLIENT         0
 #define TLS_DEBUG_LEVEL_SERVER         0
 
@@ -49,6 +49,7 @@ typedef struct tls_cxt_id_
   u32 listener_ctx_index;
   u8 tcp_is_ip4;
   u8 tls_engine_id;
+  void *migrate_ctx;
 } tls_ctx_id_t;
 /* *INDENT-ON* */
 
@@ -73,12 +74,17 @@ typedef struct tls_ctx_
   /* Temporary storage for session open opaque. Overwritten once
    * underlying tcp connection is established */
 #define parent_app_api_context c_tls_ctx_id.parent_app_api_ctx
+#define migration_ctx         c_tls_ctx_id.migrate_ctx
 
   u8 is_passive_close;
   u8 resume;
   u8 app_closed;
   u8 no_app_session;
+  u8 is_migrated;
   u8 *srv_hostname;
+  u32 evt_index;
+  u32 ckpair_index;
+  transport_proto_t tls_type;
 } tls_ctx_t;
 
 typedef struct tls_main_
@@ -102,13 +108,17 @@ typedef struct tls_main_
 typedef struct tls_engine_vft_
 {
   u32 (*ctx_alloc) (void);
+  u32 (*ctx_alloc_w_thread) (u32 thread_index);
   void (*ctx_free) (tls_ctx_t * ctx);
+  void *(*ctx_detach) (tls_ctx_t *ctx);
+  u32 (*ctx_attach) (u32 thread_index, void *ctx);
   tls_ctx_t *(*ctx_get) (u32 ctx_index);
   tls_ctx_t *(*ctx_get_w_thread) (u32 ctx_index, u8 thread_index);
   int (*ctx_init_client) (tls_ctx_t * ctx);
   int (*ctx_init_server) (tls_ctx_t * ctx);
   int (*ctx_read) (tls_ctx_t * ctx, session_t * tls_session);
-  int (*ctx_write) (tls_ctx_t * ctx, session_t * app_session);
+  int (*ctx_write) (tls_ctx_t * ctx, session_t * app_session,
+                   transport_send_params_t * sp);
     u8 (*ctx_handshake_is_over) (tls_ctx_t * ctx);
   int (*ctx_start_listen) (tls_ctx_t * ctx);
   int (*ctx_stop_listen) (tls_ctx_t * ctx);
@@ -118,13 +128,13 @@ typedef struct tls_engine_vft_
 
 tls_main_t *vnet_tls_get_main (void);
 void tls_register_engine (const tls_engine_vft_t * vft,
-                         tls_engine_type_t type);
+                         crypto_engine_type_t type);
 int tls_add_vpp_q_rx_evt (session_t * s);
 int tls_add_vpp_q_tx_evt (session_t * s);
 int tls_add_vpp_q_builtin_tx_evt (session_t * s);
 int tls_add_vpp_q_builtin_rx_evt (session_t * s);
 int tls_notify_app_accept (tls_ctx_t * ctx);
-int tls_notify_app_connected (tls_ctx_t * ctx, u8 is_failed);
+int tls_notify_app_connected (tls_ctx_t * ctx, session_error_t err);
 void tls_notify_app_enqueue (tls_ctx_t * ctx, session_t * app_session);
 void tls_disconnect_transport (tls_ctx_t * ctx);
 #endif /* SRC_VNET_TLS_TLS_H_ */