Updated to release 1.7.1
[siplcs.git] / src / sip-sec-mech.h
blob9d7ffeb8a6dc3474166955bf27142b7626658316
1 /**
2 * @file sip-sec-mech.h
4 * pidgin-sipe
6 * Copyright (C) 2009 pier11 <pier11@operamail.com>
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 /* 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 #ifndef _SIP_SEC_MECH_H
32 #define _SIP_SEC_MECH_H
34 #define SIP_SEC_E_OK 0
35 #define SIP_SEC_E_INTERNAL_ERROR (-2146893052)
36 #define SIP_SEC_I_CONTINUE_NEEDED 590610
38 typedef unsigned long sip_uint32;
40 typedef struct {
41 gsize length;
42 void *value;
43 } SipSecBuffer;
46 typedef SipSecContext
47 (*sip_sec_create_context_func)(SipSecAuthType type);
49 typedef sip_uint32
50 (*sip_sec_acquire_cred_func)(SipSecContext context,
51 const char *domain,
52 const char *username,
53 const char *password);
55 typedef sip_uint32
56 (*sip_sec_init_context_func)(SipSecContext context,
57 SipSecBuffer in_buff,
58 SipSecBuffer *out_buff,
59 const char *service_name);
61 typedef void
62 (*sip_sec_destroy_context_func)(SipSecContext context);
64 typedef sip_uint32
65 (*sip_sec_make_signature_func)(SipSecContext context,
66 const char *message,
67 SipSecBuffer *signature);
69 typedef sip_uint32
70 (*sip_sec_verify_signature_func)(SipSecContext context,
71 const char *message,
72 SipSecBuffer signature);
74 struct sip_sec_context {
75 sip_sec_acquire_cred_func acquire_cred_func;
76 sip_sec_init_context_func init_context_func;
77 sip_sec_destroy_context_func destroy_context_func;
78 sip_sec_make_signature_func make_signature_func;
79 sip_sec_verify_signature_func verify_signature_func;
80 /** Single Sign-On request flag 0=FALSE */
81 int sso;
82 /** Security Context expiration interval in seconds */
83 int expires;
86 /// Utility methods (implemented in sip-sec.c)
88 /**
89 * Converts a string of hex digits into bytes.
91 * Allocates memory for 'bytes', must be freed after use
93 void hex_str_to_bytes(const char *hex_str, SipSecBuffer *bytes);
94 void free_bytes_buffer(SipSecBuffer *bytes);
96 /** Allocates memory for output, must be freed after use */
97 char *bytes_to_hex_str(SipSecBuffer *bytes);
99 #endif /* _SIP_SEC_MECH_H */