2 * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2010
3 * Free Software Foundation, Inc.
5 * Author: Nikos Mavrogiannopoulos
7 * This file is part of GnuTLS.
9 * The GnuTLS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1 of
12 * the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
26 #ifndef GNUTLS_EXTENSIONS_H
27 #define GNUTLS_EXTENSIONS_H
29 int _gnutls_parse_extensions (gnutls_session_t session
,
30 gnutls_ext_parse_type_t parse_type
,
31 const opaque
* data
, int data_size
);
32 int _gnutls_gen_extensions (gnutls_session_t session
, opaque
* data
,
33 size_t data_size
, gnutls_ext_parse_type_t
);
34 int _gnutls_ext_init (void);
35 void _gnutls_ext_deinit (void);
37 void _gnutls_extension_list_add (gnutls_session_t session
, uint16_t type
);
39 typedef void (*gnutls_ext_deinit_data_func
) (extension_priv_data_t data
);
40 typedef int (*gnutls_ext_pack_func
) (extension_priv_data_t data
,
41 gnutls_buffer_st
* packed_data
);
42 typedef int (*gnutls_ext_unpack_func
) (gnutls_buffer_st
* packed_data
,
43 extension_priv_data_t
* data
);
45 void _gnutls_ext_free_session_data (gnutls_session_t session
);
47 /* functions to be used by extensions internally
49 void _gnutls_ext_unset_session_data (gnutls_session_t session
, uint16_t type
);
50 void _gnutls_ext_set_session_data (gnutls_session_t session
, uint16_t type
,
51 extension_priv_data_t
);
52 int _gnutls_ext_get_session_data (gnutls_session_t session
,
53 uint16_t type
, extension_priv_data_t
*);
54 int _gnutls_ext_get_resumed_session_data (gnutls_session_t session
,
56 extension_priv_data_t
* data
);
58 void _gnutls_ext_restore_resumed_session (gnutls_session_t session
);
60 /* for session packing */
61 int _gnutls_ext_pack (gnutls_session_t session
, gnutls_buffer_st
* packed
);
62 int _gnutls_ext_unpack (gnutls_session_t session
, gnutls_buffer_st
* packed
);
68 gnutls_ext_parse_type_t parse_type
;
70 /* this function must return 0 when Not Applicable
71 * size of extension data if ok
74 gnutls_ext_recv_func recv_func
;
76 /* this function must return 0 when Not Applicable
77 * size of extension data if ok
78 * GNUTLS_E_INT_RET_0 if extension data size is zero
81 gnutls_ext_send_func send_func
;
83 gnutls_ext_deinit_data_func deinit_func
; /* this will be called to deinitialize
86 gnutls_ext_pack_func pack_func
; /* packs internal data to machine independent format */
87 gnutls_ext_unpack_func unpack_func
; /* unpacks internal data */
91 int _gnutls_ext_register (extension_entry_st
*);