Callback revision.
[openssl.git] / ssl / ssl.h
index 2498c3191d6b696862465cc7be967d22cefd7147..8c59ed35207037eb0ab2ed2de4813660b1e01741 100644 (file)
--- a/ssl/ssl.h
+++ b/ssl/ssl.h
@@ -390,10 +390,10 @@ typedef int (*tls_session_secret_cb_fn)(SSL *s, void *secret, int *secret_len, S
 
 #ifndef OPENSSL_NO_TLSEXT
 /* Callbacks and structures for handling custom TLS Extensions: 
- *   cli_ext_first_cb  - sends data for ClientHello TLS Extension
- *   cli_ext_second_cb - receives data from ServerHello TLS Extension
- *   srv_ext_first_cb  - receives data from ClientHello TLS Extension
- *   srv_ext_second_cb - sends data for ServerHello TLS Extension
+ *   cli_ext_add_cb   - sends data for ClientHello TLS Extension
+ *   cli_ext_parse_cb - receives data from ServerHello TLS Extension
+ *   srv_ext_parse_cb - receives data from ClientHello TLS Extension
+ *   srv_ext_add_cb   - sends data for ServerHello TLS Extension
  *
  *   All these functions return nonzero on success.  Zero will terminate
  *   the handshake (and return a specific TLS Fatal alert, if the function
@@ -410,21 +410,16 @@ typedef int (*tls_session_secret_cb_fn)(SSL *s, void *secret, int *secret_len, S
  *     fatal TLS alert, if the callback returns zero.
  */
 
-typedef int (*custom_ext_add_cb)(SSL *s, unsigned short ext_type,
+typedef int (*custom_ext_add_cb)(SSL *s, unsigned int ext_type,
                                          const unsigned char **out,
-                                         unsigned short *outlen, int *al,
+                                         size_t *outlen, int *al,
                                           void *arg);
 
-typedef int (*custom_ext_parse_cb)(SSL *s, unsigned short ext_type,
+typedef int (*custom_ext_parse_cb)(SSL *s, unsigned int ext_type,
                                           const unsigned char *in,
-                                          unsigned short inlen, int *al,
+                                          size_t inlen, int *al,
                                           void *arg);
 
-typedef custom_ext_add_cb custom_cli_ext_first_cb_fn;
-typedef custom_ext_parse_cb custom_cli_ext_second_cb_fn;
-typedef custom_ext_add_cb custom_srv_ext_second_cb_fn;
-typedef custom_ext_parse_cb custom_srv_ext_first_cb_fn;
-
 #endif
 
 #ifndef OPENSSL_NO_SSL_INTERN
@@ -1276,22 +1271,22 @@ const char *SSL_get_psk_identity(const SSL *s);
  * handled by OpenSSL will fail.
  *
  * NULL can be registered for any callback function.  For the client
- * functions, a NULL custom_cli_ext_first_cb_fn sends an empty ClientHello
- * Extension, and a NULL custom_cli_ext_second_cb_fn ignores the ServerHello
+ * functions, a NULL custom_ext_add_cb sends an empty ClientHello
+ * Extension, and a NULL custom_ext_parse_cb ignores the ServerHello
  * response (if any).
  *
- * For the server functions, a NULL custom_srv_ext_first_cb_fn means the
+ * For the server functions, a NULL custom_ext_parse means the
  * ClientHello extension's data will be ignored, but the extension will still
- * be noted and custom_srv_ext_second_cb_fn will still be invoked.  A NULL
+ * be noted and custom_ext_add_cb will still be invoked.  A NULL
  * custom_srv_ext_second_cb doesn't send a ServerHello extension.
  */
-int SSL_CTX_set_custom_cli_ext(SSL_CTX *ctx, unsigned short ext_type,
-                              custom_cli_ext_first_cb_fn fn1
-                              custom_cli_ext_second_cb_fn fn2, void *arg);
+int SSL_CTX_set_custom_cli_ext(SSL_CTX *ctx, unsigned int ext_type,
+                              custom_ext_add_cb add_cb
+                              custom_ext_parse_cb parse_cb, void *arg);
 
-int SSL_CTX_set_custom_srv_ext(SSL_CTX *ctx, unsigned short ext_type,
-                              custom_srv_ext_first_cb_fn fn1
-                              custom_srv_ext_second_cb_fn fn2, void *arg);
+int SSL_CTX_set_custom_srv_ext(SSL_CTX *ctx, unsigned int ext_type,
+                              custom_ext_parse_cb parse_cb
+                              custom_ext_add_cb add_cb, void *arg);
 
 #endif