security: add is_ready flag to context
[siplcs.git] / src / core / sip-sec-mech.h
blob7474cbd3b34b51147dd03ac8eecc07afa77cb75e
1 /**
2 * @file sip-sec-mech.h
4 * pidgin-sipe
6 * Copyright (C) 2011 SIPE Project <http://sipe.sourceforge.net/>
7 * Copyright (C) 2009 pier11 <pier11@operamail.com>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 /* Mechanism wrappers API (Inspired by GSS-API)
26 * All mechanisms should implement this API
28 * Current mechanisms are: Kerberos/GSS-API, sipe's NTLM and SSPI.
31 #define SIP_SEC_E_OK 0
32 #define SIP_SEC_E_INTERNAL_ERROR (-2146893052)
33 #define SIP_SEC_I_CONTINUE_NEEDED 590610
35 typedef unsigned long sip_uint32;
37 typedef struct {
38 gsize length;
39 guint8 *value;
40 } SipSecBuffer;
42 typedef SipSecContext
43 (*sip_sec_create_context_func)(guint type);
45 typedef sip_uint32
46 (*sip_sec_acquire_cred_func)(SipSecContext context,
47 const char *domain,
48 const char *username,
49 const char *password);
51 typedef sip_uint32
52 (*sip_sec_init_context_func)(SipSecContext context,
53 SipSecBuffer in_buff,
54 SipSecBuffer *out_buff,
55 const char *service_name);
57 typedef void
58 (*sip_sec_destroy_context_func)(SipSecContext context);
60 typedef sip_uint32
61 (*sip_sec_make_signature_func)(SipSecContext context,
62 const char *message,
63 SipSecBuffer *signature);
65 typedef sip_uint32
66 (*sip_sec_verify_signature_func)(SipSecContext context,
67 const char *message,
68 SipSecBuffer signature);
70 struct sip_sec_context {
71 sip_sec_acquire_cred_func acquire_cred_func;
72 sip_sec_init_context_func init_context_func;
73 sip_sec_destroy_context_func destroy_context_func;
74 sip_sec_make_signature_func make_signature_func;
75 sip_sec_verify_signature_func verify_signature_func;
76 /** Single Sign-On request flag 0=FALSE */
77 int sso;
78 /** Security Context expiration interval in seconds */
79 int expires;
80 /** 0 - FALSE; otherwise TRUE */
81 int is_connection_based;
82 /** 0 - FALSE, otherwise TRUE */
83 int is_ready;