Updated to release 1.10.0
[siplcs.git] / src / api / sipe-backend.h
blob68adac77e6d266c9cf827d2aab11f48939693fda
1 /**
2 * @file sipe-backend.h
4 * pidgin-sipe
6 * Copyright (C) 2010 SIPE Project <http://sipe.sourceforge.net/>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 /** CRYPT ********************************************************************/
25 void sipe_backend_encrypt_des(const guchar *key,
26 const guchar *plaintext, gsize plaintext_length,
27 guchar *encrypted_text);
29 void sipe_backend_encrypt_rc4(const guchar *key, gsize key_length,
30 const guchar *plaintext, gsize plaintext_length,
31 guchar *encrypted_text);
33 /* Stream RC4 cipher for file transfer */
34 gpointer sipe_backend_crypt_ft_start(const guchar *key);
35 void sipe_backend_crypt_ft_stream(gpointer context,
36 const guchar *in, gsize length,
37 guchar *out);
38 void sipe_backend_crypt_ft_destroy(gpointer context);
40 /** DEBUGGING ****************************************************************/
42 typedef enum {
43 SIPE_DEBUG_LEVEL_INFO,
44 SIPE_DEBUG_LEVEL_WARNING,
45 SIPE_DEBUG_LEVEL_ERROR,
46 SIPE_DEBUG_LEVEL_FATAL,
47 } sipe_debug_level;
49 /**
50 * Output debug information
52 * Shouldn't be used directly. Instead use SIPE_DEBUG_xxx() macros
54 * @param level debug level
55 * @param format format string. "\n" will be automatically appended.
57 void sipe_backend_debug(sipe_debug_level level,
58 const gchar *format,
59 ...) G_GNUC_PRINTF(2, 3);
61 /* Convenience macros */
62 #define SIPE_DEBUG_INFO(fmt, ...) sipe_backend_debug(SIPE_DEBUG_LEVEL_INFO, fmt, __VA_ARGS__)
63 #define SIPE_DEBUG_INFO_NOFORMAT(msg) sipe_backend_debug(SIPE_DEBUG_LEVEL_INFO, msg)
64 #define SIPE_DEBUG_WARNING(fmt, ...) sipe_backend_debug(SIPE_DEBUG_LEVEL_WARNING, fmt, __VA_ARGS__)
65 #define SIPE_DEBUG_WARNING_NOFORMAT(msg) sipe_backend_debug(SIPE_DEBUG_LEVEL_WARNING, msg)
66 #define SIPE_DEBUG_ERROR(fmt, ...) sipe_backend_debug(SIPE_DEBUG_LEVEL_ERROR, fmt, __VA_ARGS__)
67 #define SIPE_DEBUG_ERROR_NOFORMAT(msg) sipe_backend_debug(SIPE_DEBUG_LEVEL_ERROR, msg)
68 #define SIPE_DEBUG_FATAL(fmt, ...) sipe_backend_debug(SIPE_DEBUG_LEVEL_FATAL, fmt, __VA_ARGS__)
69 #define SIPE_DEBUG_FATAL_NOFORMAT(msg) sipe_backend_debug(SIPE_DEBUG_LEVEL_FATAL, msg)
71 /** DIGEST *******************************************************************/
73 #define SIPE_DIGEST_HMAC_MD5_LENGTH 16
74 void sipe_backend_digest_hmac_md5(const guchar *key, gsize key_length,
75 const guchar *data, gsize data_length,
76 guchar *digest);
78 #define SIPE_DIGEST_MD4_LENGTH 16
79 void sipe_backend_digest_md4(const guchar *data, gsize length, guchar *digest);
81 #define SIPE_DIGEST_MD5_LENGTH 16
82 void sipe_backend_digest_md5(const guchar *data, gsize length, guchar *digest);
84 #define SIPE_DIGEST_SHA1_LENGTH 20
85 void sipe_backend_digest_sha1(const guchar *data, gsize length, guchar *digest);
87 /* Stream HMAC(SHA1) digest for file transfer */
88 #define SIPE_DIGEST_FILETRANSFER_LENGTH 20
89 gpointer sipe_backend_digest_ft_start(const guchar *sha1_digest);
90 void sipe_backend_digest_ft_update(gpointer context, const guchar *data, gsize length);
91 void sipe_backend_digest_ft_end(gpointer context, guchar *digest);
92 void sipe_backend_digest_ft_destroy(gpointer context);
94 /** MARKUP *******************************************************************/
96 gchar *sipe_backend_markup_css_property(const gchar *style,
97 const gchar *option);
98 gchar *sipe_backend_markup_strip_html(const gchar *html);
100 /** NETWORK ******************************************************************/
102 const gchar *sipe_backend_network_ip_address(void);