xref: /titanic_41/usr/src/lib/libsip/common/sip.h (revision 8d4e547db823a866b8f73efc0acdc423e2963caf)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SIP_H
28 #define	_SIP_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/types.h>
37 #include <netinet/in.h>
38 
39 /* Send a SIP message statefully */
40 #define	SIP_SEND_STATEFUL	0x0001
41 
42 /* Enable multiple dialogs if a request is forked */
43 #define	SIP_DIALOG_ON_FORK	0x0010
44 
45 #define	SIP_CRLF 		"\r\n"
46 #define	SKIP_CRLF(msg_ptr)	(msg_ptr = msg_ptr + 2)
47 #define	SIP_VERSION		"SIP/2.0"
48 #define	SIP			"SIP"
49 
50 /* SIP headers */
51 #define	SIP_TO				"TO"
52 #define	SIP_FROM			"FROM"
53 #define	SIP_TAG				"TAG="
54 #define	SIP_CONTENT_LENGTH		"CONTENT-LENGTH"
55 #define	SIP_CONTENT_TYPE		"CONTENT-TYPE"
56 #define	SIP_CALL_ID			"CALL-ID"
57 #define	SIP_CSEQ			"CSEQ"
58 #define	SIP_MAX_FORWARDS		"MAX-FORWARDS"
59 #define	SIP_CONTACT			"CONTACT"
60 #define	SIP_VIA				"Via"
61 #define	SIP_RECORD_ROUTE		"RECORD-ROUTE"
62 #define	SIP_ROUTE			"ROUTE"
63 #define	SIP_ACCEPT			"ACCEPT"
64 #define	SIP_ACCEPT_ENCODE		"ACCEPT-ENCODING"
65 #define	SIP_ACCEPT_LANG			"ACCEPT-LANGUAGE"
66 #define	SIP_ALERT_INFO			"ALERT-INFO"
67 #define	SIP_ALLOW			"ALLOW"
68 #define	SIP_CALL_INFO			"CALL-INFO"
69 #define	SIP_CONTENT_DIS			"CONTENT-DISPOSITION"
70 #define	SIP_CONTENT_ENCODE		"CONTENT-ENCODING"
71 #define	SIP_CONTENT_LANG		"CONTENT-LANGUAGE"
72 #define	SIP_DATE			"DATE"
73 #define	SIP_ERROR_INFO			"ERROR-INFO"
74 #define	SIP_EXPIRE			"EXPIRES"
75 #define	SIP_IN_REPLY_TO			"IN-REPLY-TO"
76 #define	SIP_MIN_EXPIRE			"MIN-EXPIRES"
77 #define	SIP_MIME_VERSION		"MIME-VERSION"
78 #define	SIP_ORGANIZATION		"ORGANIZATION"
79 #define	SIP_PRIORITY			"PRIORITY"
80 #define	SIP_REQUIRE			"REQUIRE"
81 #define	SIP_REPLYTO			"REPLY-TO"
82 #define	SIP_RETRY_AFTER			"RETRY-AFTER"
83 #define	SIP_SERVER			"SERVER"
84 #define	SIP_SUBJECT			"SUBJECT"
85 #define	SIP_SUPPORT			"SUPPORTED"
86 #define	SIP_TIMESTAMP			"TIMESTAMP"
87 #define	SIP_UNSUPPORT			"UNSUPPORTED"
88 #define	SIP_USER_AGENT			"USER-AGENT"
89 #define	SIP_WARNING			"WARNING"
90 #define	SIP_ALLOW_EVENTS		"ALLOW-EVENTS"
91 #define	SIP_EVENT			"EVENT"
92 #define	SIP_SUBSCRIPTION_STATE		"SUBSCRIPTION-STATE"
93 #define	SIP_WWW_AUTHEN			"WWW-AUTHENTICATE"
94 #define	SIP_AUTHOR			"AUTHORIZATION"
95 #define	SIP_AUTHEN_INFO			"AUTHENTICATION-INFO"
96 #define	SIP_PROXY_AUTHOR		"PROXY-AUTHORIZATION"
97 #define	SIP_PROXY_AUTHEN		"PROXY-AUTHENTICATE"
98 #define	SIP_PROXY_REQ			"PROXY-REQUIRE"
99 #define	SIP_PASSERTEDID			"P-ASSERTED-IDENTITY"
100 #define	SIP_PPREFERREDID		"P-PREFERRED-IDENTITY"
101 #define	SIP_PRIVACY			"PRIVACY"
102 #define	SIP_RACK			"RACK"
103 #define	SIP_RSEQ			"RSEQ"
104 
105 /* SIP Response Codes */
106 
107 /* 1XX - Provisional */
108 #define	SIP_TRYING			100
109 #define	SIP_RINGING			180
110 #define	SIP_CALL_IS_BEING_FORWARDED 	181
111 #define	SIP_QUEUED			182
112 #define	SIP_SESSION_PROGRESS		183
113 
114 /* 2XX - Success */
115 #define	SIP_OK				200
116 #define	SIP_ACCEPTED			202
117 
118 /* 3XX - Redirection */
119 #define	SIP_MULTIPLE_CHOICES		300
120 #define	SIP_MOVED_PERMANENTLY		301
121 #define	SIP_MOVED_TEMPORARILY		302
122 #define	SIP_USE_PROXY			303
123 #define	SIP_ALTERNATIVE_SERVICE		304
124 
125 /* 4XX - Request Failed */
126 #define	SIP_BAD_REQUEST			400
127 #define	SIP_UNAUTHORIZED		401
128 #define	SIP_PAYMENT_REQUIRED		402
129 #define	SIP_FORBIDDEN			403
130 #define	SIP_NOT_FOUND			404
131 #define	SIP_METHOD_NOT_ALLOWED		405
132 #define	SIP_NOT_ACCEPTABLE		406
133 #define	SIP_PROXY_AUTH_REQUIRED		407
134 #define	SIP_REQUEST_TIMEOUT		408
135 #define	SIP_GONE			410
136 #define	SIP_REQUEST_ENTITY_2_LARGE	413
137 #define	SIP_REQUEST_URI_2_LONG		414
138 #define	SIP_UNSUPPORTED_MEDIA_TYPE	415
139 #define	SIP_UNSUPPORTED_URI_SCHEME	416
140 #define	SIP_BAD_EXTENSION		420
141 #define	SIP_EXTENSION_REQUIRED		421
142 #define	SIP_INTERVAL_2_BRIEF		423
143 #define	SIP_TEMPORARILY_UNAVAIL		480
144 #define	SIP_CALL_NON_EXISTANT		481
145 #define	SIP_LOOP_DETECTED		482
146 #define	SIP_TOO_MANY_HOOPS		483
147 #define	SIP_ADDRESS_INCOMPLETE		484
148 #define	SIP_AMBIGUOUS			485
149 #define	SIP_BUSY_HERE			486
150 #define	SIP_REQUEST_TERMINATED		487
151 #define	SIP_NOT_ACCEPTABLE_HERE		488
152 #define	SIP_BAD_EVENT			489
153 #define	SIP_REQUEST_PENDING		491
154 #define	SIP_UNDECIPHERABLE		493
155 
156 /* 5XX - Server Failure */
157 #define	SIP_SERVER_INTERNAL_ERROR	500
158 #define	SIP_NOT_IMPLEMENTED		501
159 #define	SIP_BAD_GATEWAY			502
160 #define	SIP_SERVICE_UNAVAILABLE		503
161 #define	SIP_SERVER_TIMEOUT		504
162 #define	SIP_VERSION_NOT_SUPPORTED	505
163 #define	SIP_MESSAGE_2_LARGE		513
164 
165 /* 6XX - Global Failures */
166 #define	SIP_BUSY_EVERYWHERE		600
167 #define	SIP_DECLINE			601
168 #define	SIP_DOES_NOT_EXIST_ANYWHERE 	604
169 #define	SIP_NOT_ACCEPTABLE_ANYWHERE	606
170 
171 /* Response error types */
172 #define	SIP_PROVISIONAL_RESP(resp)	((resp) >= 100 && (resp) < 200)
173 #define	SIP_FINAL_RESP(resp)		((resp) >= 200 && (resp) < 700)
174 #define	SIP_OK_RESP(resp)		((resp) >= 200 && (resp) < 300)
175 #define	SIP_NONOK_FINAL_RESP(resp)	((resp) >= 300 && (resp) < 700)
176 #define	SIP_REDIRECT_RESP(resp)		((resp) >= 300 && (resp) < 400)
177 #define	SIP_REQFAIL_RESP(resp)		((resp) >= 400 && (resp) < 500)
178 #define	SIP_SRVFAIL_RESP(resp)		((resp) >= 500 && (resp) < 600)
179 #define	SIP_GLOBFAIL_RESP(resp)		((resp) >= 600 && (resp) < 700)
180 
181 /* Types of transactions */
182 #define	SIP_CLIENT_TRANSACTION		1
183 #define	SIP_SERVER_TRANSACTION		2
184 
185 /* Transaction states */
186 #define	SIP_NEW_TRANSACTION		0
187 
188 /* Client Transaction States */
189 #define	SIP_CLNT_CALLING		1
190 #define	SIP_CLNT_INV_PROCEEDING 	2
191 #define	SIP_CLNT_INV_TERMINATED 	3
192 #define	SIP_CLNT_INV_COMPLETED		4
193 #define	SIP_CLNT_TRYING		5
194 #define	SIP_CLNT_NONINV_PROCEEDING 	6
195 #define	SIP_CLNT_NONINV_TERMINATED 	7
196 #define	SIP_CLNT_NONINV_COMPLETED	8
197 
198 /* Server Transaction States */
199 #define	SIP_SRV_INV_PROCEEDING		9
200 #define	SIP_SRV_INV_COMPLETED		10
201 #define	SIP_SRV_CONFIRMED		11
202 #define	SIP_SRV_INV_TERMINATED		12
203 #define	SIP_SRV_TRYING			13
204 #define	SIP_SRV_NONINV_PROCEEDING	14
205 #define	SIP_SRV_NONINV_COMPLETED	15
206 #define	SIP_SRV_NONINV_TERMINATED	16
207 
208 /* Dialog types */
209 #define	SIP_UAC_DIALOG			1
210 #define	SIP_UAS_DIALOG			2
211 
212 /* Dialog state */
213 typedef enum dialog_state {
214 	SIP_DLG_NEW = 0,	/* New dialog, no reply received yet */
215 	SIP_DLG_EARLY,		/* Early dialog, provisional reply received */
216 	SIP_DLG_CONFIRMED,	/* Confirmed dialog, 2xx reply received */
217 	SIP_DLG_DESTROYED	/* Destroyed dialog */
218 } dialog_state_t;
219 
220 /* SIP URI parse errors */
221 #define	SIP_URIERR_SCHEME	0x00000001 /* invalid URL SCHEME name */
222 #define	SIP_URIERR_USER		0x00000002 /* invalid user name */
223 #define	SIP_URIERR_PASS		0x00000004 /* invalid password  */
224 #define	SIP_URIERR_HOST		0x00000008 /* invalid domain name */
225 #define	SIP_URIERR_PORT		0x00000010 /* invalid port number */
226 #define	SIP_URIERR_PARAM	0x00000020 /* parameter specific error */
227 #define	SIP_URIERR_HEADER	0x00000040 /* headers specific error */
228 #define	SIP_URIERR_OPAQUE	0x00000080 /* opaque specific error */
229 #define	SIP_URIERR_QUERY	0x00000100 /* query specific error */
230 #define	SIP_URIERR_PATH		0x00000200 /* path specific error */
231 #define	SIP_URIERR_REGNAME	0x00000400 /* reg-name specific error */
232 #define	SIP_URIERR_NOURI	0x00000800 /* No URI */
233 #define	SIP_URIERR_MEMORY	0x00001000 /* out of memory */
234 
235 #ifdef		__linux__
236 #define		B_FALSE		0
237 #define		B_TRUE		1
238 
239 typedef int		boolean_t;
240 typedef unsigned char	uchar_t;
241 typedef unsigned int	uint_t;
242 typedef unsigned int	uint32_t;
243 #endif
244 
245 typedef struct sip_message	*sip_msg_t;
246 typedef struct sip_header	*sip_header_t;
247 typedef struct sip_value	*sip_header_value_t;
248 typedef struct sip_dialog	*sip_dialog_t;
249 typedef struct sip_uri		*sip_uri_t;
250 typedef struct sip_conn_object	*sip_conn_object_t;
251 typedef	struct sip_xaction	*sip_transaction_t;
252 
253 typedef struct sip_str {
254 	char	*sip_str_ptr;
255 	int	sip_str_len;
256 }sip_str_t;
257 
258 
259 /* SIP parameter */
260 typedef struct sip_param {
261 	sip_str_t	param_name;
262 	sip_str_t	param_value;
263 	struct sip_param *param_next;
264 }sip_param_t;
265 
266 
267 /* Parsed header structure */
268 typedef struct sip_parsed_header {
269 	int		 sip_parsed_header_version;
270 	struct sip_value *value;
271 	sip_header_t	sip_header;
272 }sip_parsed_header_t;
273 
274 #define	SIP_PARSED_HEADER_VERSION_1	1
275 
276 /* Value states */
277 typedef enum {
278 	SIP_VALUE_ACTIVE = 0,
279 	SIP_VALUE_BAD,
280 	SIP_VALUE_DELETED
281 }sip_value_state_t;
282 
283 /* SIP header value */
284 typedef struct sip_value {
285 	int			sip_value_version;
286 	void			*next;
287 	sip_param_t		*param_list;
288 	sip_value_state_t	value_state; /* Active/Deleted */
289 	sip_parsed_header_t	*parsed_header;
290 	char			*value_start;
291 	char			*value_end;
292 	sip_str_t		*sip_value_uri_str;
293 	sip_uri_t		sip_value_parse_uri;
294 }sip_value_t;
295 
296 #define	SIP_VALUE_VERSION_1	1
297 
298 typedef struct sip_header_general {
299 	char			*sip_hdr_start;
300 	char			*sip_hdr_end;
301 	char			*sip_hdr_current;
302 	sip_parsed_header_t	*sip_hdr_parsed;
303 }sip_hdr_general_t;
304 
305 /* SIP methods */
306 typedef enum {
307 	UNKNOWN = 0,
308 	INVITE,
309 	ACK,
310 	OPTIONS,
311 	BYE,
312 	CANCEL,
313 	REGISTER,
314 	REFER,
315 	INFO,
316 	SUBSCRIBE,
317 	NOTIFY,
318 	PRACK
319 }sip_method_t;
320 
321 #define	MAX_SIP_METHODS	12
322 
323 typedef struct sip_methods {
324 	char *name;	/* Name of the method */
325 	int  len;	/* Length for comparison */
326 }sip_methods_t;
327 
328 extern sip_methods_t sip_methods[];
329 
330 /* SIP header function table */
331 typedef struct header_function_table {
332 	char		*header_name;
333 	char		*header_short_name;
334 	int		(*header_parse_func)(struct sip_header *,
335 			    struct sip_parsed_header **);
336 	boolean_t	(*header_check_compliance)(struct sip_parsed_header *);
337 	boolean_t	(*header_is_equal)(struct sip_parsed_header *,
338 			    struct sip_parsed_header *);
339 	void		(*header_free)(struct sip_parsed_header *);
340 }sip_header_function_t;
341 
342 /* Connection Manager interface */
343 typedef struct sip_io_pointers_s {
344 	int	(*sip_conn_send)(const sip_conn_object_t, char *, int);
345 	void	(*sip_hold_conn_object)(sip_conn_object_t);
346 	void	(*sip_rel_conn_object)(sip_conn_object_t);
347 	boolean_t	(*sip_conn_is_stream)(sip_conn_object_t);
348 	boolean_t	(*sip_conn_is_reliable)(sip_conn_object_t);
349 	int 	(*sip_conn_remote_address)(sip_conn_object_t, struct sockaddr *,
350 		    socklen_t *);
351 	int 	(*sip_conn_local_address)(sip_conn_object_t, struct sockaddr *,
352 		    socklen_t *);
353 	int	(*sip_conn_transport)(sip_conn_object_t);
354 	int	(*sip_conn_timer1)(sip_conn_object_t);
355 	int	(*sip_conn_timer2)(sip_conn_object_t);
356 	int	(*sip_conn_timer4)(sip_conn_object_t);
357 	int	(*sip_conn_timerd)(sip_conn_object_t);
358 }sip_io_pointers_t;
359 
360 /* Upper layer registerations */
361 typedef struct sip_ulp_pointers_s {
362 	void		(*sip_ulp_recv)(const sip_conn_object_t,
363 			    sip_msg_t, const sip_dialog_t);
364 	uint_t		(*sip_ulp_timeout)(void *, void (*func)(void *),
365 			    struct timeval *);
366 	boolean_t	(*sip_ulp_untimeout)(uint_t);
367 	int		(*sip_ulp_trans_error)(sip_transaction_t, int, void *);
368 	void		(*sip_ulp_dlg_del)(sip_dialog_t, sip_msg_t, void *);
369 	void		(*sip_ulp_trans_state_cb)(sip_transaction_t,
370 			    sip_msg_t, int, int);
371 	void		(*sip_ulp_dlg_state_cb)(sip_dialog_t, sip_msg_t, int,
372 			    int);
373 }sip_ulp_pointers_t;
374 
375 /* SIP stack initialization structure */
376 typedef struct sip_stack_init_s {
377 	int			sip_version;
378 	int			sip_stack_flags;
379 	sip_io_pointers_t	*sip_io_pointers;
380 	sip_ulp_pointers_t	*sip_ulp_pointers;
381 	sip_header_function_t	*sip_function_table;
382 }sip_stack_init_t;
383 
384 /* SIP stack version */
385 #define	SIP_STACK_VERSION		1
386 
387 /* Flags for sip_stack_flags */
388 #define	SIP_STACK_DIALOGS		0x0001
389 
390 extern int		sip_init_conn_object(sip_conn_object_t);
391 extern void		sip_clear_stale_data(sip_conn_object_t);
392 extern void		sip_conn_destroyed(sip_conn_object_t);
393 
394 extern int		(*sip_stack_send)(const sip_conn_object_t, char *, int);
395 extern void		(*sip_refhold_conn)(sip_conn_object_t);
396 extern void		(*sip_refrele_conn)(sip_conn_object_t);
397 extern boolean_t	(*sip_is_conn_stream)(sip_conn_object_t);
398 extern boolean_t	(*sip_is_conn_reliable)(sip_conn_object_t);
399 extern int 		(*sip_conn_rem_addr)(sip_conn_object_t,
400 			    struct sockaddr *, socklen_t *);
401 extern int		(*sip_conn_local_addr)(sip_conn_object_t,
402 			    struct sockaddr *, socklen_t *);
403 extern int		(*sip_conn_transport)(sip_conn_object_t);
404 extern int		(*sip_conn_timer1)(sip_conn_object_t);
405 extern int		(*sip_conn_timer2)(sip_conn_object_t);
406 extern int		(*sip_conn_timer4)(sip_conn_object_t);
407 extern int		(*sip_conn_timerd)(sip_conn_object_t);
408 
409 extern uint_t		(*sip_stack_timeout)(void *, void (*func)(void *),
410 			    struct timeval *);
411 extern boolean_t	(*sip_stack_untimeout)(uint_t);
412 
413 extern sip_msg_t	sip_new_msg();
414 extern void		sip_free_msg(sip_msg_t);
415 extern void		sip_hold_msg(sip_msg_t);
416 extern int		sip_stack_init(sip_stack_init_t *);
417 extern int		sip_sendmsg(sip_conn_object_t, sip_msg_t, sip_dialog_t,
418 			    uint32_t);
419 extern void		sip_process_new_packet(sip_conn_object_t, void *,
420 			    size_t);
421 extern char 		*sip_guid();
422 extern char		*sip_sent_by_to_str(int *);
423 extern int		sip_register_sent_by(char *);
424 extern void		sip_unregister_sent_by(char *);
425 extern void		sip_unregister_all_sent_by();
426 extern char 		*sip_branchid(sip_msg_t);
427 extern uint32_t		sip_get_cseq();
428 extern uint32_t		sip_get_rseq();
429 extern int		sip_get_num_via(sip_msg_t, int *);
430 
431 extern int 		sip_add_from(sip_msg_t, char *, char *, char *,
432 			    boolean_t, char *);
433 extern int 		sip_add_to(sip_msg_t, char *, char *, char *,
434 			    boolean_t, char *);
435 extern int 		sip_add_response_line(sip_msg_t, int, char *);
436 extern int 		sip_add_request_line(sip_msg_t, sip_method_t, char *);
437 extern int 		sip_add_via(sip_msg_t, char *, char *, int, char *);
438 extern int 		sip_add_maxforward(sip_msg_t, uint_t);
439 extern int 		sip_add_callid(sip_msg_t, char *);
440 extern int 		sip_add_cseq(sip_msg_t, sip_method_t, uint32_t);
441 extern int 		sip_add_content_type(sip_msg_t, char *, char *);
442 extern int 		sip_add_content(sip_msg_t, char *);
443 extern int 		sip_add_contact(sip_msg_t, char *, char *, boolean_t,
444 			    char *);
445 extern int 		sip_add_route(sip_msg_t, char *, char *, char *);
446 extern int 		sip_add_record_route(sip_msg_t, char *, char *, char *);
447 extern int 		sip_add_branchid_to_via(sip_msg_t, char *);
448 extern int 		sip_add_accept(sip_msg_t, char *, char *, char *,
449 			    char *);
450 extern int		sip_add_author(sip_msg_t, char *,  char *);
451 extern int		sip_add_authen_info(sip_msg_t, char *);
452 extern int		sip_add_proxy_authen(sip_msg_t, char *,  char *);
453 extern int		sip_add_proxy_author(sip_msg_t, char *, char *);
454 extern int		sip_add_proxy_require(sip_msg_t, char *);
455 extern int		sip_add_www_authen(sip_msg_t, char *, char *);
456 extern int		sip_add_accept_enc(sip_msg_t, char *, char *);
457 extern int		sip_add_accept_lang(sip_msg_t, char *, char *);
458 extern int		sip_add_alert_info(sip_msg_t, char *, char *);
459 extern int		sip_add_allow(sip_msg_t, sip_method_t);
460 extern int		sip_add_call_info(sip_msg_t, char *, char *);
461 extern int		sip_add_content_disp(sip_msg_t, char *, char *);
462 extern int		sip_add_content_enc(sip_msg_t, char *);
463 extern int		sip_add_content_lang(sip_msg_t, char *);
464 extern int		sip_add_date(sip_msg_t, char *);
465 extern int		sip_add_error_info(sip_msg_t, char *, char *);
466 extern int		sip_add_expires(sip_msg_t, int);
467 extern int		sip_add_in_reply_to(sip_msg_t, char *);
468 extern int		sip_add_mime_version(sip_msg_t, char *);
469 extern int		sip_add_min_expires(sip_msg_t, int);
470 extern int		sip_add_org(sip_msg_t, char *);
471 extern int		sip_add_priority(sip_msg_t, char *);
472 extern int		sip_add_reply_to(sip_msg_t, char *, char *, char *,
473 			    boolean_t);
474 extern int		sip_add_require(sip_msg_t, char *);
475 extern int		sip_add_retry_after(sip_msg_t, int, char *, char *);
476 extern int		sip_add_server(sip_msg_t, char *);
477 extern int		sip_add_subject(sip_msg_t, char *);
478 extern int		sip_add_supported(sip_msg_t, char *);
479 extern int		sip_add_tstamp(sip_msg_t, char *, char *);
480 extern int		sip_add_unsupported(sip_msg_t, char *);
481 extern int		sip_add_user_agent(sip_msg_t, char *);
482 extern int		sip_add_warning(sip_msg_t, int, char *, char *);
483 extern int		sip_add_allow_events(sip_msg_t, char *);
484 extern int		sip_add_event(sip_msg_t, char *, char *);
485 extern int		sip_add_substate(sip_msg_t, char *, char *);
486 extern int		sip_add_privacy(sip_msg_t, char *);
487 extern int		sip_add_passertedid(sip_msg_t, char *, char *,
488 			    boolean_t);
489 extern int		sip_add_ppreferredid(sip_msg_t, char *, char *,
490 			    boolean_t);
491 extern int		sip_add_rack(sip_msg_t, int, int, sip_method_t);
492 extern int		sip_add_rseq(sip_msg_t, int);
493 extern const sip_str_t *sip_get_author_scheme(sip_msg_t, int *);
494 extern const sip_str_t *sip_get_author_param(sip_msg_t, char *, int *);
495 extern const sip_str_t *sip_get_authen_info(sip_header_value_t, int *);
496 extern const sip_str_t *sip_get_proxy_authen_scheme(sip_msg_t, int *);
497 extern const sip_str_t *sip_get_proxy_authen_param(sip_msg_t, char *, int *);
498 extern const sip_str_t *sip_get_proxy_author_scheme(sip_msg_t, int *);
499 extern const sip_str_t *sip_get_proxy_author_param(sip_msg_t, char *, int *);
500 extern const sip_str_t *sip_get_proxy_require(sip_header_value_t, int *);
501 extern const sip_str_t *sip_get_www_authen_scheme(sip_msg_t, int *);
502 extern const sip_str_t *sip_get_www_authen_param(sip_msg_t, char *, int *);
503 extern const sip_str_t	*sip_get_allow_events(sip_header_value_t, int *);
504 extern const sip_str_t	*sip_get_event(sip_msg_t, int *);
505 extern const sip_str_t	*sip_get_substate(sip_msg_t, int *);
506 extern const sip_str_t	*sip_get_accept_type(sip_header_value_t, int *);
507 extern const sip_str_t	*sip_get_accept_sub_type(sip_header_value_t, int *);
508 extern const sip_str_t	*sip_get_accept_enc(sip_header_value_t, int *);
509 extern const sip_str_t	*sip_get_accept_lang(sip_header_value_t, int *);
510 extern const sip_str_t	*sip_get_alert_info_uri(sip_header_value_t, int *);
511 extern sip_method_t	sip_get_allow_method(sip_header_value_t, int *);
512 extern int		sip_get_min_expires(sip_msg_t, int *);
513 extern const sip_str_t	*sip_get_mime_version(sip_msg_t, int *);
514 extern const sip_str_t	*sip_get_org(sip_msg_t, int *);
515 extern const sip_str_t	*sip_get_priority(sip_msg_t, int *);
516 extern const sip_str_t	*sip_get_replyto_display_name(sip_msg_t, int *);
517 extern const sip_str_t	*sip_get_replyto_uri_str(sip_msg_t, int *);
518 extern const sip_str_t	*sip_get_date_time(sip_msg_t, int *);
519 extern int		sip_get_date_day(sip_msg_t, int *);
520 extern const sip_str_t	*sip_get_date_month(sip_msg_t, int *);
521 extern const sip_str_t	*sip_get_date_wkday(sip_msg_t, int *);
522 extern int		sip_get_date_year(sip_msg_t, int *);
523 extern const sip_str_t	*sip_get_date_timezone(sip_msg_t, int *);
524 extern const sip_str_t	*sip_get_content_disp(sip_msg_t, int *);
525 extern const sip_str_t	*sip_get_content_lang(sip_header_value_t, int *);
526 extern const sip_str_t	*sip_get_content_enc(sip_header_value_t, int *);
527 extern const sip_str_t	*sip_get_error_info_uri(sip_header_value_t, int *);
528 extern int		sip_get_expires(sip_msg_t, int *);
529 extern const sip_str_t	*sip_get_require(sip_header_value_t, int *);
530 extern const sip_str_t	*sip_get_subject(sip_msg_t, int *);
531 extern const sip_str_t	*sip_get_supported(sip_header_value_t, int *);
532 extern const sip_str_t	*sip_get_tstamp_delay(sip_msg_t, int *);
533 extern const sip_str_t	*sip_get_tstamp_value(sip_msg_t, int *);
534 extern const sip_str_t	*sip_get_unsupported(sip_header_value_t, int *);
535 extern const sip_str_t	*sip_get_server(sip_msg_t, int *);
536 extern const sip_str_t	*sip_get_user_agent(sip_msg_t, int *);
537 extern int		sip_get_warning_code(sip_header_value_t, int *);
538 extern const sip_str_t	*sip_get_warning_agent(sip_header_value_t, int *);
539 extern const sip_str_t	*sip_get_warning_text(sip_header_value_t, int *);
540 extern const sip_str_t	*sip_get_call_info_uri(sip_header_value_t, int *);
541 extern const sip_str_t	*sip_get_in_reply_to(sip_header_value_t, int *);
542 extern int		sip_get_retry_after_time(sip_msg_t, int *);
543 extern const sip_str_t	*sip_get_retry_after_cmts(sip_msg_t, int *);
544 extern const sip_str_t	*sip_get_passertedid_display_name(sip_header_value_t,
545 			    int *);
546 extern const sip_str_t	*sip_get_passertedid_uri_str(sip_header_value_t,
547 			    int *);
548 extern const sip_str_t	*sip_get_ppreferredid_display_name(sip_header_value_t,
549 			    int *);
550 extern const sip_str_t	*sip_get_ppreferredid_uri_str(sip_header_value_t,
551 			    int *);
552 extern const sip_str_t	*sip_get_priv_value(sip_header_value_t, int *);
553 extern int		sip_get_rack_resp_num(sip_msg_t, int *);
554 extern int		sip_get_rack_cseq_num(sip_msg_t, int *);
555 extern sip_method_t	sip_get_rack_method(sip_msg_t, int *);
556 extern int		sip_get_rseq_resp_num(sip_msg_t, int *);
557 
558 extern int		sip_copy_start_line(sip_msg_t, sip_msg_t);
559 extern int		sip_delete_start_line(sip_msg_t sip_msg);
560 extern int		sip_copy_header(sip_msg_t, sip_header_t, char *);
561 extern int		sip_copy_header_by_name(sip_msg_t, sip_msg_t, char *,
562 			    char *);
563 extern int		sip_copy_all_headers(sip_msg_t, sip_msg_t);
564 extern int		sip_delete_header_by_name(sip_msg_t, char *);
565 extern int		sip_add_header(sip_msg_t, char *);
566 extern sip_header_t	sip_add_param(sip_header_t, char *, int *);
567 extern int		sip_delete_header(sip_header_t);
568 extern int		sip_delete_value(sip_header_t, sip_header_value_t);
569 extern sip_msg_t	sip_clone_msg(const sip_msg_t);
570 extern sip_msg_t	sip_create_response(const sip_msg_t, int, char *,
571 			    char *, char *);
572 extern int		sip_create_OKack(const sip_msg_t, sip_msg_t, char *,
573 			    char *, int, char *);
574 extern char 		*sip_get_resp_desc(int);
575 extern char		*sip_get_branchid(const sip_msg_t, int *);
576 
577 extern const struct sip_header	*sip_get_header(sip_msg_t, char *, sip_header_t,
578 				    int *);
579 extern const struct sip_value	*sip_get_header_value(
580 				    const struct sip_header *, int *);
581 extern const struct sip_value	*sip_get_next_value(sip_header_value_t, int *);
582 extern const sip_str_t		*sip_get_param_value(sip_header_value_t,
583 				    char *, int *);
584 extern const sip_param_t	*sip_get_params(sip_header_value_t, int *);
585 extern boolean_t		sip_is_param_present(const sip_param_t *,
586 				    char *, int);
587 
588 extern char		*sip_msg_to_str(sip_msg_t, int *);
589 extern char		*sip_hdr_to_str(sip_header_t, int *);
590 extern char		*sip_reqline_to_str(sip_msg_t, int *);
591 extern char		*sip_respline_to_str(sip_msg_t, int *);
592 extern boolean_t	sip_msg_is_request(const sip_msg_t, int *);
593 extern boolean_t	sip_msg_is_response(const sip_msg_t, int *);
594 extern sip_method_t	sip_get_request_method(const sip_msg_t, int *);
595 extern const sip_str_t	*sip_get_request_uri_str(sip_msg_t, int *);
596 extern int		sip_get_response_code(sip_msg_t, int *);
597 extern const sip_str_t	*sip_get_response_phrase(sip_msg_t, int *);
598 extern const sip_str_t	*sip_get_sip_version(sip_msg_t, int *);
599 extern int		sip_get_msg_len(sip_msg_t, int *);
600 extern const sip_str_t	*sip_get_route_uri_str(sip_header_value_t, int *);
601 extern const sip_str_t	*sip_get_route_display_name(sip_header_value_t, int *);
602 extern const sip_str_t	*sip_get_contact_uri_str(sip_header_value_t, int *);
603 extern const sip_str_t	*sip_get_contact_display_name(sip_header_value_t,
604 			    int *);
605 extern const sip_str_t	*sip_get_from_uri_str(sip_msg_t, int *);
606 extern const sip_str_t	*sip_get_from_display_name(sip_msg_t, int *);
607 extern const sip_str_t	*sip_get_from_tag(sip_msg_t, int *);
608 extern const sip_str_t	*sip_get_to_uri_str(sip_msg_t, int *);
609 extern const sip_str_t	*sip_get_to_display_name(sip_msg_t, int *);
610 extern const sip_str_t	*sip_get_to_tag(sip_msg_t, int *);
611 extern const sip_str_t	*sip_get_callid(sip_msg_t, int *);
612 extern int		sip_get_callseq_num(sip_msg_t, int *);
613 extern sip_method_t	sip_get_callseq_method(sip_msg_t, int *);
614 extern const sip_str_t	*sip_get_via_sent_by_host(sip_header_value_t, int *);
615 extern int		sip_get_via_sent_by_port(sip_header_value_t, int *);
616 extern const sip_str_t	*sip_get_via_sent_protocol_version(sip_header_value_t,
617 			    int *);
618 extern const sip_str_t	*sip_get_via_sent_protocol_name(sip_header_value_t,
619 			    int *);
620 extern const sip_str_t	*sip_get_via_sent_transport(sip_header_value_t,
621 			    int *);
622 extern int 		sip_get_maxforward(sip_msg_t, int *);
623 extern int 		sip_get_content_length(sip_msg_t, int *);
624 extern const sip_str_t	*sip_get_content_type(sip_msg_t, int *);
625 extern const sip_str_t	*sip_get_content_sub_type(sip_msg_t, int *);
626 extern char		*sip_get_content(sip_msg_t, int *);
627 extern sip_msg_t	sip_create_dialog_req(sip_method_t, sip_dialog_t,
628 			    char *, char *, int, char *, uint32_t, int);
629 
630 extern int			sip_get_dialog_state(sip_dialog_t, int *);
631 extern int			sip_get_dialog_method(sip_dialog_t, int *);
632 extern const sip_str_t		*sip_get_dialog_callid(sip_dialog_t, int *);
633 extern const sip_str_t		*sip_get_dialog_local_tag(sip_dialog_t, int *);
634 extern const sip_str_t		*sip_get_dialog_remote_tag(sip_dialog_t, int *);
635 extern const struct sip_uri	*sip_get_dialog_local_uri(sip_dialog_t, int *);
636 extern const struct sip_uri	*sip_get_dialog_remote_uri(sip_dialog_t, int *);
637 extern const struct sip_uri	*sip_get_dialog_remote_target_uri(sip_dialog_t,
638 				    int *);
639 extern const sip_str_t		*sip_get_dialog_route_set(sip_dialog_t, int *);
640 extern boolean_t		sip_is_dialog_secure(sip_dialog_t, int *);
641 extern uint32_t			sip_get_dialog_local_cseq(sip_dialog_t, int *);
642 extern uint32_t			sip_get_dialog_remote_cseq(sip_dialog_t, int *);
643 extern int			sip_get_dialog_type(sip_dialog_t dialog, int *);
644 
645 extern void			sip_hold_dialog(sip_dialog_t);
646 extern void			sip_release_dialog(sip_dialog_t);
647 extern void			sip_delete_dialog(sip_dialog_t);
648 
649 extern sip_uri_t		sip_parse_uri(sip_str_t *, int *);
650 extern void			sip_free_parsed_uri(sip_uri_t);
651 extern boolean_t		sip_is_sipuri(const struct sip_uri *);
652 extern const sip_str_t		*sip_get_uri_scheme(const struct sip_uri *,
653 				    int *);
654 extern const sip_str_t		*sip_get_uri_user(const struct sip_uri *,
655 				    int *);
656 extern const sip_str_t		*sip_get_uri_password(const struct sip_uri *,
657 				    int *);
658 extern const sip_str_t		*sip_get_uri_host(const struct sip_uri *,
659 				    int *);
660 extern int			sip_get_uri_port(const struct sip_uri *,
661 				    int *error);
662 extern const sip_param_t	*sip_get_uri_params(const struct sip_uri *,
663 				    int *);
664 extern const sip_str_t		*sip_get_uri_headers(const struct sip_uri *,
665 				    int *);
666 extern const sip_str_t		*sip_get_uri_opaque(const struct sip_uri *,
667 				    int *);
668 extern const sip_str_t		*sip_get_uri_query(const struct sip_uri *,
669 				    int *);
670 extern const sip_str_t		*sip_get_uri_path(const struct sip_uri *,
671 				    int *);
672 extern const sip_str_t		*sip_get_uri_regname(const struct sip_uri *,
673 				    int *);
674 extern boolean_t		sip_is_uri_teluser(const struct sip_uri *);
675 extern int			sip_get_uri_errflags(const struct sip_uri *,
676 				    int *);
677 extern char			*sip_uri_errflags_to_str(int);
678 
679 extern const struct sip_uri	*sip_get_request_uri(sip_msg_t, int *);
680 extern const struct sip_uri	*sip_get_uri_parsed(sip_header_value_t, int *);
681 
682 /* Transaction functions */
683 extern const struct sip_xaction	*sip_get_trans(sip_msg_t, int, int *);
684 extern char 			*sip_get_trans_branchid(sip_transaction_t,
685 				    int *);
686 extern sip_method_t		sip_get_trans_method(sip_transaction_t,
687 				    int *);
688 extern int			sip_get_trans_state(sip_transaction_t, int *);
689 extern const struct sip_message	*sip_get_trans_resp_msg(sip_transaction_t,
690 				    int *);
691 extern const struct sip_message	*sip_get_trans_orig_msg(sip_transaction_t,
692 				    int *);
693 extern void			sip_hold_trans(sip_transaction_t);
694 extern void			sip_release_trans(sip_transaction_t);
695 extern const struct sip_conn_object	*sip_get_trans_conn_obj(
696 					    sip_transaction_t, int *);
697 #ifdef	__cplusplus
698 }
699 #endif
700 
701 #endif	/* _SIP_H */
702