SIP Witch 1.9.15
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
eX_setup.h
Go to the documentation of this file.
1 /*
2  eXosip - This is the eXtended osip library.
3  Copyright (C) 2001-2012 Aymeric MOIZARD amoizard@antisip.com
4 
5  eXosip is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  eXosip is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 
20 
21 #ifdef ENABLE_MPATROL
22 #include <mpatrol.h>
23 #endif
24 
25 #ifndef __EX_SETUP_H__
26 #define __EX_SETUP_H__
27 
28 #include <eXosip2/eXosip.h>
30 
31 #include <time.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37  struct eXosip_t;
38  struct osip_srv_record;
39  struct osip_naptr;
40 
61  struct eXosip_t *eXosip_malloc (void);
62 
68  int eXosip_init (struct eXosip_t *excontext);
69 
75  void eXosip_quit (struct eXosip_t *excontext);
76 
82  int eXosip_lock (struct eXosip_t *excontext);
83 
89  int eXosip_unlock (struct eXosip_t *excontext);
90 
96  int eXosip_execute (struct eXosip_t *excontext);
97 
98 #define EXOSIP_OPT_BASE_OPTION 0
99 #define EXOSIP_OPT_UDP_KEEP_ALIVE (EXOSIP_OPT_BASE_OPTION+1)
100 #define EXOSIP_OPT_UDP_LEARN_PORT (EXOSIP_OPT_BASE_OPTION+2)
101 #define EXOSIP_OPT_USE_RPORT (EXOSIP_OPT_BASE_OPTION+7)
102 #define EXOSIP_OPT_SET_IPV4_FOR_GATEWAY (EXOSIP_OPT_BASE_OPTION+8)
103 #define EXOSIP_OPT_ADD_DNS_CACHE (EXOSIP_OPT_BASE_OPTION+9)
104 #define EXOSIP_OPT_DELETE_DNS_CACHE (EXOSIP_OPT_BASE_OPTION+10)
105 #define EXOSIP_OPT_SET_IPV6_FOR_GATEWAY (EXOSIP_OPT_BASE_OPTION+12)
106 #define EXOSIP_OPT_ADD_ACCOUNT_INFO (EXOSIP_OPT_BASE_OPTION+13)
107 #define EXOSIP_OPT_DNS_CAPABILITIES (EXOSIP_OPT_BASE_OPTION+14)
108 #define EXOSIP_OPT_SET_DSCP (EXOSIP_OPT_BASE_OPTION+15)
109 #define EXOSIP_OPT_REGISTER_WITH_DATE (EXOSIP_OPT_BASE_OPTION+16)
110 #define EXOSIP_OPT_SET_HEADER_USER_AGENT (EXOSIP_OPT_BASE_OPTION+17)
112 #define EXOSIP_OPT_SET_TLS_VERIFY_CERTIFICATE (EXOSIP_OPT_BASE_OPTION+500)
113 #define EXOSIP_OPT_SET_TLS_CERTIFICATES_INFO (EXOSIP_OPT_BASE_OPTION+501)
114 #define EXOSIP_OPT_SET_TLS_CLIENT_CERTIFICATE_NAME (EXOSIP_OPT_BASE_OPTION+502)
115 #define EXOSIP_OPT_SET_TLS_SERVER_CERTIFICATE_NAME (EXOSIP_OPT_BASE_OPTION+503)
117  /* non standard option: need a compilation flag to activate */
118 #define EXOSIP_OPT_KEEP_ALIVE_OPTIONS_METHOD (EXOSIP_OPT_BASE_OPTION+1000)
119 
125  char host[1024];
126  char ip[256];
127  };
128 
130  char proxy[1024];
131  char nat_ip[256];
132  int nat_port;
133  };
134 
136  char pszCallId[64];
138  char pszCNonce[64];
141  };
142 
152  int eXosip_set_option (struct eXosip_t *excontext, int opt, const void *value);
153 
154 
160  typedef struct eXosip_tls_credentials_s {
161  char priv_key[1024];
162  char priv_key_pw[1024];
163  char cert[1024];
165 
171  typedef struct eXosip_tls_ctx_s {
172  char random_file[1024];
173  char dh_param[1024];
174  char root_ca_cert[1024];
178 
182  typedef enum {
183  TLS_OK = 0,
190 
201  struct osip_naptr *eXosip_dnsutils_naptr (struct eXosip_t *excontext, const char *domain, const char *protocol, const char *transport, int keep_in_cache);
202 
209  int eXosip_dnsutils_dns_process (struct osip_naptr *output_record, int force);
210 
216  int eXosip_dnsutils_rotate_srv (struct osip_srv_record *output_record);
217 
228  int eXosip_listen_addr (struct eXosip_t *excontext, int transport, const char *addr, int port, int family, int secure);
229 
235  int eXosip_reset_transports (struct eXosip_t *excontext);
236 
237 
246  int eXosip_set_socket (struct eXosip_t *excontext, int transport, int socket, int port);
247 
254  void eXosip_set_user_agent (struct eXosip_t *excontext, const char *user_agent);
255 
260  const char *eXosip_get_version (void);
261 
262  typedef void (*CbSipCallback) (osip_message_t * msg, int received);
263 
270  int eXosip_set_cbsip_message (struct eXosip_t *excontext, CbSipCallback cbsipCallback);
271 
277  void eXosip_enable_ipv6 (int ipv6_enable);
278 
293  void eXosip_masquerade_contact (struct eXosip_t *excontext, const char *public_address, int port);
294 
303  int eXosip_find_free_port (struct eXosip_t *excontext, int free_port, int transport);
304 
305 #ifndef DOXYGEN
306 
312 #ifndef OSIP_MONOTHREAD
313  void eXosip_wakeup_event (struct eXosip_t *excontext);
314 #else
315 #define eXosip_wakeup_event(A) ;
316 #endif
317 
318 #endif
319 
335  int eXosip_transport_set (osip_message_t * msg, const char *transport);
336 
345  int eXosip_guess_localip (struct eXosip_t *excontext, int family, char *address, int size);
346 
350 #ifdef __cplusplus
351 }
352 #endif
353 #endif
Structure for SIP Message (REQUEST and RESPONSE).
Definition: osip_message.h:55
no password was specified
Definition: eX_setup.h:186
osip_proxy_authenticate_t * wa
Definition: eX_setup.h:137
void eXosip_set_user_agent(struct eXosip_t *excontext, const char *user_agent)
Set the SIP User-Agent: header string.
char nat_ip[256]
Definition: eX_setup.h:131
int eXosip_lock(struct eXosip_t *excontext)
Lock the eXtented oSIP library.
Structure for NAPTR record entry.
Definition: osip.h:340
structure used to for inserting a DNS cache entry and avoid DNS resolution.
Definition: eX_setup.h:124
int eXosip_dnsutils_rotate_srv(struct osip_srv_record *output_record)
Rotate first SRV entry to last SRV entry.
char host[1024]
Definition: eX_setup.h:125
int eXosip_init(struct eXosip_t *excontext)
Initiate the eXtented oSIP library.
int eXosip_find_free_port(struct eXosip_t *excontext, int free_port, int transport)
This method is used to find out an free IPPROTO_UDP or IPPROTO_TCP port.
void eXosip_quit(struct eXosip_t *excontext)
Release ressource used by the eXtented oSIP library.
void(* CbSipCallback)(osip_message_t *msg, int received)
Definition: eX_setup.h:262
const char * eXosip_get_version(void)
Get the eXosip version as a sring.
struct osip_naptr * eXosip_dnsutils_naptr(struct eXosip_t *excontext, const char *domain, const char *protocol, const char *transport, int keep_in_cache)
Start and return osip_naptr context.
struct eXosip_tls_credentials_s eXosip_tls_credentials_t
no absolute path to the rootCA file was specified
Definition: eX_setup.h:187
int eXosip_set_cbsip_message(struct eXosip_t *excontext, CbSipCallback cbsipCallback)
Set a callback to get sent and received SIP messages.
char dh_param[1024]
absolute path to a file necessary for diffie hellman key exchange
Definition: eX_setup.h:173
something is missing: the private key or the certificate
Definition: eX_setup.h:188
char pszCallId[64]
Definition: eX_setup.h:136
no absolute path to the diifie hellman file was specified
Definition: eX_setup.h:185
char pszCNonce[64]
Definition: eX_setup.h:138
int eXosip_transport_set(osip_message_t *msg, const char *transport)
Modify the transport protocol used to send SIP message.
char random_file[1024]
absolute path to a file with random(!) data
Definition: eX_setup.h:172
int eXosip_unlock(struct eXosip_t *excontext)
UnLock the eXtented oSIP library.
int eXosip_set_option(struct eXosip_t *excontext, int opt, const void *value)
Set eXosip options.
struct eXosip_tls_ctx_s eXosip_tls_ctx_t
char ip[256]
Definition: eX_setup.h:126
char priv_key_pw[1024]
Definition: eX_setup.h:162
structure to describe the whole TLS-context for eXosip consists of a certificate, a corresponding pri...
Definition: eX_setup.h:171
eXosip_tls_credentials_t server
credential of the server
Definition: eX_setup.h:176
char * value[96]
Definition: cgiserver.cpp:90
struct eXosip_t * eXosip_malloc(void)
Allocate an eXosip context.
oSIP SIP Message Accessor Routines
eXosip_tls_credentials_t client
credential of the client
Definition: eX_setup.h:175
int keep_in_cache
keep in cache value
Definition: osip.h:344
char proxy[1024]
Definition: eX_setup.h:130
no absolute path to the random file was specified
Definition: eX_setup.h:184
structure used to describe credentials for a client or server consists of a certificate, a corresponding private key and its password
Definition: eX_setup.h:160
eXosip API
char domain[512]
domain
Definition: osip.h:341
int eXosip_set_socket(struct eXosip_t *excontext, int transport, int socket, int port)
Listen on a specified socket.
int eXosip_dnsutils_dns_process(struct osip_naptr *output_record, int force)
Continue to process asynchronous DNS request (if implemented).
int eXosip_execute(struct eXosip_t *excontext)
Process (non-threaded mode ONLY) eXosip events.
void eXosip_masquerade_contact(struct eXosip_t *excontext, const char *public_address, int port)
This method is used to replace contact address with the public address of your NAT.
int eXosip_guess_localip(struct eXosip_t *excontext, int family, char *address, int size)
Find the current localip (interface with default route).
char root_ca_cert[1024]
absolute path to the file with known rootCAs
Definition: eX_setup.h:174
yippieh, everything is fine :)
Definition: eX_setup.h:183
int eXosip_reset_transports(struct eXosip_t *excontext)
Reset transport sockets.
Definition of the WWW-Authenticate header.
eXosip_tls_ctx_error
An enumeration which describes the error which can occur while setting the eXosip_tls_ctx.
Definition: eX_setup.h:182
int eXosip_listen_addr(struct eXosip_t *excontext, int transport, const char *addr, int port, int family, int secure)
Listen on a specified socket.
Structure for SRV record entry.
Definition: osip.h:312
void eXosip_enable_ipv6(int ipv6_enable)
Use IPv6 instead of IPv4.
void eXosip_wakeup_event(struct eXosip_t *excontext)
Wake Up the eXosip_event_wait method.