belle-sip.h 5.92 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/*
	belle-sip - SIP (RFC3261) library.
    Copyright (C) 2010  Belledonne Communications SARL

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BELLE_SIP_H
#define BELLE_SIP_H

21 22
#include <stdlib.h>

23 24 25 26 27 28 29 30
#ifdef __cplusplus
#define BELLE_SIP_BEGIN_DECLS		extern "C"{
#define BELLE_SIP_END_DECLS		}
#else
#define BELLE_SIP_BEGIN_DECLS
#define BELLE_SIP_END_DECLS
#endif

Simon Morlat's avatar
Simon Morlat committed
31
#include "belle-sip/object.h"
32

Simon Morlat's avatar
Simon Morlat committed
33 34 35
/**
 * This enum declares all object types used in belle-sip (see belle_sip_object_t)
**/
Simon Morlat's avatar
Simon Morlat committed
36
BELLE_SIP_DECLARE_TYPES_BEGIN(belle_sip,1)
37 38 39 40
	BELLE_SIP_TYPE_ID(belle_sip_stack_t),
	BELLE_SIP_TYPE_ID(belle_sip_listening_point_t),
	BELLE_SIP_TYPE_ID(belle_sip_datagram_listening_point_t),
	BELLE_SIP_TYPE_ID(belle_sip_udp_listening_point_t),
jehan's avatar
jehan committed
41
	BELLE_SIP_TYPE_ID(belle_sip_stream_listening_point_t),
jehan's avatar
jehan committed
42
	BELLE_SIP_TYPE_ID(belle_sip_tls_listening_point_t),
43 44
	BELLE_SIP_TYPE_ID(belle_sip_channel_t),
	BELLE_SIP_TYPE_ID(belle_sip_udp_channel_t),
jehan's avatar
jehan committed
45
	BELLE_SIP_TYPE_ID(belle_sip_stream_channel_t),
jehan's avatar
jehan committed
46
	BELLE_SIP_TYPE_ID(belle_sip_tls_channel_t),
47 48 49
	BELLE_SIP_TYPE_ID(belle_sip_provider_t),
	BELLE_SIP_TYPE_ID(belle_sip_main_loop_t),
	BELLE_SIP_TYPE_ID(belle_sip_source_t),
Simon Morlat's avatar
Simon Morlat committed
50
	BELLE_SIP_TYPE_ID(belle_sip_resolver_context_t),
Simon Morlat's avatar
Simon Morlat committed
51 52 53
	BELLE_SIP_TYPE_ID(belle_sip_transaction_t),
	BELLE_SIP_TYPE_ID(belle_sip_server_transaction_t),
	BELLE_SIP_TYPE_ID(belle_sip_client_transaction_t),
Simon Morlat's avatar
Simon Morlat committed
54 55 56 57
	BELLE_SIP_TYPE_ID(belle_sip_ict_t),
	BELLE_SIP_TYPE_ID(belle_sip_nict_t),
	BELLE_SIP_TYPE_ID(belle_sip_ist_t),
	BELLE_SIP_TYPE_ID(belle_sip_nist_t),
58
	BELLE_SIP_TYPE_ID(belle_sip_dialog_t),
jehan's avatar
jehan committed
59 60 61 62 63 64
	BELLE_SIP_TYPE_ID(belle_sip_header_address_t),
	BELLE_SIP_TYPE_ID(belle_sip_header_contact_t),
	BELLE_SIP_TYPE_ID(belle_sip_header_from_t),
	BELLE_SIP_TYPE_ID(belle_sip_header_to_t),
	BELLE_SIP_TYPE_ID(belle_sip_header_via_t),
	BELLE_SIP_TYPE_ID(belle_sip_uri_t),
65 66 67
	BELLE_SIP_TYPE_ID(belle_sip_message_t),
	BELLE_SIP_TYPE_ID(belle_sip_request_t),
	BELLE_SIP_TYPE_ID(belle_sip_response_t),
jehan's avatar
jehan committed
68 69
	BELLE_SIP_TYPE_ID(belle_sip_object_t),
	BELLE_SIP_TYPE_ID(belle_sip_parameters_t),
jehan's avatar
jehan committed
70
	BELLE_SIP_TYPE_ID(belle_sip_header_call_id_t),
71 72
	BELLE_SIP_TYPE_ID(belle_sip_header_cseq_t),
	BELLE_SIP_TYPE_ID(belle_sip_header_content_type_t),
jehan's avatar
jehan committed
73 74
	BELLE_SIP_TYPE_ID(belle_sip_header_route_t),
	BELLE_SIP_TYPE_ID(belle_sip_header_record_route_t),
jehan's avatar
jehan committed
75
	BELLE_SIP_TYPE_ID(belle_sip_header_user_agent_t),
jehan's avatar
jehan committed
76
	BELLE_SIP_TYPE_ID(belle_sip_header_content_length_t),
jehan's avatar
jehan committed
77
	BELLE_SIP_TYPE_ID(belle_sip_header_t),
jehan's avatar
jehan committed
78
	BELLE_SIP_TYPE_ID(belle_sip_header_extension_t),
79
	BELLE_SIP_TYPE_ID(belle_sip_header_authorization_t),
80
	BELLE_SIP_TYPE_ID(belle_sip_header_proxy_authorization_t),
jehan's avatar
jehan committed
81 82
	BELLE_SIP_TYPE_ID(belle_sip_header_www_authenticate_t),
	BELLE_SIP_TYPE_ID(belle_sip_header_proxy_authenticate_t),
jehan's avatar
jehan committed
83
	BELLE_SIP_TYPE_ID(belle_sip_header_max_forwards_t),
jehan's avatar
jehan committed
84 85
	BELLE_SIP_TYPE_ID(belle_sip_header_expires_t),
	BELLE_SIP_TYPE_ID(belle_sip_header_allow_t),
jehan's avatar
jehan committed
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
	BELLE_SIP_TYPE_ID(belle_sdp_attribute_t),
	BELLE_SIP_TYPE_ID(belle_sdp_bandwidth_t),
	BELLE_SIP_TYPE_ID(belle_sdp_connection_t),
	BELLE_SIP_TYPE_ID(belle_sdp_email_t),
	BELLE_SIP_TYPE_ID(belle_sdp_info_t),
	BELLE_SIP_TYPE_ID(belle_sdp_key_t),
	BELLE_SIP_TYPE_ID(belle_sdp_media_t),
	BELLE_SIP_TYPE_ID(belle_sdp_media_description_t),
	BELLE_SIP_TYPE_ID(belle_sdp_origin_t),
	BELLE_SIP_TYPE_ID(belle_sdp_phone_t),
	BELLE_SIP_TYPE_ID(belle_sdp_repeate_time_t),
	BELLE_SIP_TYPE_ID(belle_sdp_session_description_t),
	BELLE_SIP_TYPE_ID(belle_sdp_session_name_t),
	BELLE_SIP_TYPE_ID(belle_sdp_time_t),
	BELLE_SIP_TYPE_ID(belle_sdp_time_description_t),
	BELLE_SIP_TYPE_ID(belle_sdp_uri_t),
	BELLE_SIP_TYPE_ID(belle_sdp_version_t),
jehan's avatar
jehan committed
103
	BELLE_SIP_TYPE_ID(belle_sdp_base_description_t),
104
	BELLE_SIP_TYPE_ID(belle_sdp_mime_parameter_t),
105
	BELLE_SIP_TYPE_ID(belle_sip_callbacks_t),
Simon Morlat's avatar
Simon Morlat committed
106
BELLE_SIP_DECLARE_TYPES_END
107 108


Simon Morlat's avatar
Simon Morlat committed
109
enum belle_sip_interface_ids{
110
	belle_sip_interface_id_first=1,
111 112
	BELLE_SIP_INTERFACE_ID(belle_sip_channel_listener_t),
	BELLE_SIP_INTERFACE_ID(belle_sip_listener_t)
Simon Morlat's avatar
Simon Morlat committed
113
};
Simon Morlat's avatar
Simon Morlat committed
114

115 116
BELLE_SIP_BEGIN_DECLS

117 118 119 120 121 122
void *belle_sip_malloc(size_t size);
void *belle_sip_malloc0(size_t size);
void *belle_sip_realloc(void *ptr, size_t size);
void belle_sip_free(void *ptr);
char * belle_sip_strdup(const char *s);

123 124
BELLE_SIP_END_DECLS

Simon Morlat's avatar
Simon Morlat committed
125
/*these types are declared here because they are widely used in many headers included after*/
126 127 128 129

typedef struct belle_sip_listening_point belle_sip_listening_point_t;
typedef struct belle_sip_stack belle_sip_stack_t;
typedef struct belle_sip_provider belle_sip_provider_t;
130
typedef struct belle_sip_dialog belle_sip_dialog_t;
Simon Morlat's avatar
Simon Morlat committed
131 132 133 134 135 136
typedef struct belle_sip_transaction belle_sip_transaction_t;
typedef struct belle_sip_server_transaction belle_sip_server_transaction_t;
typedef struct belle_sip_client_transaction belle_sip_client_transaction_t;
typedef struct _belle_sip_message belle_sip_message_t;
typedef struct _belle_sip_request belle_sip_request_t;
typedef struct _belle_sip_response belle_sip_response_t;
137

Simon Morlat's avatar
Simon Morlat committed
138
#include "belle-sip/utils.h"
139
#include "belle-sip/list.h"
Simon Morlat's avatar
Simon Morlat committed
140
#include "belle-sip/listener.h"
141
#include "belle-sip/mainloop.h"
Simon Morlat's avatar
Simon Morlat committed
142
#include "belle-sip/uri.h"
143
#include "belle-sip/headers.h"
jehan's avatar
jehan committed
144
#include "belle-sip/parameters.h"
145 146
#include "belle-sip/message.h"
#include "belle-sip/transaction.h"
147
#include "belle-sip/dialog.h"
148 149
#include "belle-sip/sipstack.h"
#include "belle-sip/listeningpoint.h"
150
#include "belle-sip/provider.h"
jehan's avatar
jehan committed
151
#include "belle-sip/auth-helper.h"
152

153

154 155 156 157 158 159 160
#undef TRUE
#define TRUE 1


#undef FALSE
#define FALSE 0

Simon Morlat's avatar
Simon Morlat committed
161 162 163 164

#define BELLE_SIP_POINTER_TO_INT(p)	((int)(long)(p))
#define BELLE_SIP_INT_TO_POINTER(i)	((void*)(long)(i))

165
#endif
Simon Morlat's avatar
Simon Morlat committed
166