tls: internalize state handling
[siplcs.git] / src / core / sipe-tls.h
blobe74d4fe7cce34b22861dcc7b2a1d1725148a02c6
1 /**
2 * @file sipe-tls.h
4 * pidgin-sipe
6 * Copyright (C) 2011 SIPE Project <http://sipe.sourceforge.net/>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 * Interface dependencies:
27 * <glib.h>
30 /**
31 * Public part of TLS state tracking
33 * If @c session_key != @c NULL then handshake is complete
35 struct sipe_tls_state {
36 const guchar *in_buffer;
37 guchar *out_buffer;
38 gsize in_length;
39 gsize out_length;
40 guchar *session_key;
41 gsize key_length;
44 /**
45 * Initialize TLS state
47 * @param certificate opaque pointer to the user certificate
49 * @return TLS state structure
51 struct sipe_tls_state *sipe_tls_start(gpointer certificate);
53 /**
54 * Proceed to next TLS state
56 * @param state pointer to TLS state structure
57 * @param incoming pointer to incoming message (NULL for initial transition)
58 * @param in_length length of incoming message
60 * @return TLS state structure
62 gboolean sipe_tls_next(struct sipe_tls_state *state);
64 /**
65 * Free TLS state
67 * @param state pointer to TLS state structure
69 void sipe_tls_free(struct sipe_tls_state *state);