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.
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.
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]
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
38 #include "sip_miscdefs.h"
41 * Returns number of digits in the given int
44 sip_num_of_digits(int num
)
52 return (num_of_bytes
);
56 * Return the int as a string
69 * the following two loops convert int i to str
73 while ((t
= t
/ 10) != 0) {
77 str
= calloc(1, sizeof (char) * count
+ 1);
81 for (x
= 0; x
< count
; x
++) {
84 str
[count
- 1 - x
] = a
+ '0';
92 * Add quotes to the give str and return the quoted string
95 sip_add_aquot_to_str(char *str
, boolean_t
*alloc
)
101 while (isspace(*tmp
))
105 if (*tmp
!= SIP_LAQUOT
) {
106 size
= strlen(str
) + 2 * sizeof (char);
107 new_str
= calloc(1, size
+ 1);
110 new_str
[0] = SIP_LAQUOT
;
112 (void) strncat(new_str
, str
, strlen(str
));
113 (void) strncat(new_str
, ">", 1);
114 new_str
[size
] = '\0';
123 * Add an empty header
126 sip_add_empty_hdr(sip_msg_t sip_msg
, char *hdr_name
)
128 _sip_header_t
*new_header
;
130 _sip_msg_t
*_sip_msg
;
131 int csize
= sizeof (char);
133 if (sip_msg
== NULL
|| hdr_name
== NULL
)
135 _sip_msg
= (_sip_msg_t
*)sip_msg
;
136 (void) pthread_mutex_lock(&_sip_msg
->sip_msg_mutex
);
137 if (_sip_msg
->sip_msg_cannot_be_modified
) {
138 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
142 header_size
= strlen(hdr_name
) + SIP_SPACE_LEN
+ csize
;
144 new_header
= sip_new_header(header_size
);
145 if (new_header
== NULL
) {
146 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
150 (void) snprintf(new_header
->sip_hdr_start
, header_size
+ 1,
151 "%s %c", hdr_name
, SIP_HCOLON
);
153 _sip_add_header(_sip_msg
, new_header
, B_TRUE
, B_FALSE
, hdr_name
);
154 if (_sip_msg
->sip_msg_buf
!= NULL
)
155 _sip_msg
->sip_msg_modified
= B_TRUE
;
156 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
162 * Generic function to add a header with two strings to message
165 sip_add_2strs_to_msg(sip_msg_t sip_msg
, char *hdr_name
, char *str1
,
166 boolean_t qstr1
, char *str2
, char *plist
, char sep
)
168 _sip_header_t
*new_header
;
170 _sip_msg_t
*_sip_msg
;
171 int csize
= sizeof (char);
173 if (sip_msg
== NULL
|| str1
== NULL
|| str2
== NULL
||
174 (str1
!= NULL
&& str1
[0] == '\0') ||
175 (str2
!= NULL
&& str2
[0] == '\0')) {
178 _sip_msg
= (_sip_msg_t
*)sip_msg
;
179 (void) pthread_mutex_lock(&_sip_msg
->sip_msg_mutex
);
180 if (_sip_msg
->sip_msg_cannot_be_modified
) {
181 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
186 header_size
= strlen(hdr_name
) + SIP_SPACE_LEN
+ csize
+
187 SIP_SPACE_LEN
+ strlen(str1
) + csize
+ strlen(str2
) +
190 header_size
= strlen(hdr_name
) + SIP_SPACE_LEN
+ csize
+
191 SIP_SPACE_LEN
+ strlen(str1
) + csize
+ strlen(str2
) +
192 csize
+ strlen(plist
) + strlen(SIP_CRLF
);
195 header_size
+= 2 * sizeof (char);
197 new_header
= sip_new_header(header_size
);
198 if (new_header
== NULL
) {
199 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
205 (void) snprintf(new_header
->sip_hdr_start
,
206 header_size
+ 1, "%s %c \"%s\"%c%s%s",
207 hdr_name
, SIP_HCOLON
, str1
, sep
, str2
, SIP_CRLF
);
209 (void) snprintf(new_header
->sip_hdr_start
,
210 header_size
+ 1, "%s %c %s%c%s%s",
211 hdr_name
, SIP_HCOLON
, str1
, sep
, str2
, SIP_CRLF
);
215 (void) snprintf(new_header
->sip_hdr_start
,
217 "%s %c \"%s\"%c%s%c%s%s", hdr_name
, SIP_HCOLON
,
218 str1
, sep
, str2
, SIP_SEMI
, plist
, SIP_CRLF
);
220 (void) snprintf(new_header
->sip_hdr_start
,
221 header_size
+ 1, "%s %c %s%c%s%c%s%s",
222 hdr_name
, SIP_HCOLON
, str1
, sep
, str2
, SIP_SEMI
,
226 _sip_add_header(_sip_msg
, new_header
, B_TRUE
, B_FALSE
, NULL
);
227 if (_sip_msg
->sip_msg_buf
!= NULL
)
228 _sip_msg
->sip_msg_modified
= B_TRUE
;
229 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
235 * Generic function to add a header with a string to message
238 sip_add_str_to_msg(sip_msg_t sip_msg
, char *hdr_name
, char *str
, char *plist
,
241 _sip_header_t
*new_header
;
243 _sip_msg_t
*_sip_msg
;
244 int csize
= sizeof (char);
246 if (sip_msg
== NULL
|| str
== NULL
|| (str
!= NULL
&& str
[0] == '\0'))
248 _sip_msg
= (_sip_msg_t
*)sip_msg
;
249 (void) pthread_mutex_lock(&_sip_msg
->sip_msg_mutex
);
250 if (_sip_msg
->sip_msg_cannot_be_modified
) {
251 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
256 header_size
= strlen(hdr_name
) + SIP_SPACE_LEN
+ csize
+
257 SIP_SPACE_LEN
+ + strlen(str
) + strlen(SIP_CRLF
);
259 header_size
= strlen(hdr_name
) + SIP_SPACE_LEN
+ csize
+
260 SIP_SPACE_LEN
+ + strlen(str
) + csize
+ strlen(plist
) +
264 new_header
= sip_new_header(header_size
);
265 if (new_header
== NULL
) {
266 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
270 (void) snprintf(new_header
->sip_hdr_start
, header_size
+ 1,
271 "%s %c %s%s", hdr_name
, SIP_HCOLON
, str
, SIP_CRLF
);
273 (void) snprintf(new_header
->sip_hdr_start
, header_size
+ 1,
274 "%s %c %s%c%s%s", hdr_name
, SIP_HCOLON
, str
, param_sep
,
277 _sip_add_header(_sip_msg
, new_header
, B_TRUE
, B_FALSE
, NULL
);
278 if (_sip_msg
->sip_msg_buf
!= NULL
)
279 _sip_msg
->sip_msg_modified
= B_TRUE
;
280 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
286 * Add an header with an int to sip_msg
289 sip_add_int_to_msg(sip_msg_t sip_msg
, char *hdr_name
, int i
, char *plist
)
291 _sip_header_t
*new_header
;
293 _sip_msg_t
*_sip_msg
;
295 int csize
= sizeof (char);
297 if (sip_msg
== NULL
|| (hdr_name
== NULL
))
299 _sip_msg
= (_sip_msg_t
*)sip_msg
;
300 (void) pthread_mutex_lock(&_sip_msg
->sip_msg_mutex
);
301 if (_sip_msg
->sip_msg_cannot_be_modified
) {
302 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
307 * the following two loops convert int i to str
309 digit_str
= sip_int_to_str(i
);
310 if (digit_str
== NULL
)
314 header_size
= strlen(hdr_name
) + SIP_SPACE_LEN
+ csize
+
315 SIP_SPACE_LEN
+ strlen(digit_str
) + strlen(SIP_CRLF
);
317 header_size
= strlen(hdr_name
) + SIP_SPACE_LEN
+ csize
+
318 SIP_SPACE_LEN
+ strlen(digit_str
) + csize
+
319 strlen(plist
) + strlen(SIP_CRLF
);
322 new_header
= sip_new_header(header_size
);
323 if (new_header
== NULL
) {
324 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
330 (void) snprintf(new_header
->sip_hdr_start
, header_size
+ 1,
331 "%s %c %s%s", hdr_name
, SIP_HCOLON
, digit_str
, SIP_CRLF
);
333 (void) snprintf(new_header
->sip_hdr_start
, header_size
+ 1,
334 "%s %c %s%c%s%s", hdr_name
, SIP_HCOLON
, digit_str
,
335 SIP_SEMI
, plist
, SIP_CRLF
);
338 _sip_add_header(_sip_msg
, new_header
, B_TRUE
, B_FALSE
, NULL
);
339 if (_sip_msg
->sip_msg_buf
!= NULL
)
340 _sip_msg
->sip_msg_modified
= B_TRUE
;
341 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
347 * Add a header with an int and string to sip_msg
350 sip_add_intstr_to_msg(sip_msg_t sip_msg
, char *hdr_name
, int i
, char *s
,
353 _sip_header_t
*new_header
;
355 _sip_msg_t
*_sip_msg
;
357 int csize
= sizeof (char);
359 if (sip_msg
== NULL
|| (hdr_name
== NULL
))
361 _sip_msg
= (_sip_msg_t
*)sip_msg
;
362 (void) pthread_mutex_lock(&_sip_msg
->sip_msg_mutex
);
363 if (_sip_msg
->sip_msg_cannot_be_modified
) {
364 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
369 * the following two loops convert int i to str
371 digit_str
= sip_int_to_str(i
);
372 if (digit_str
== NULL
) {
373 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
377 header_size
= strlen(hdr_name
) + SIP_SPACE_LEN
+ csize
+
378 SIP_SPACE_LEN
+ strlen(digit_str
) + csize
+ strlen(s
) +
381 header_size
= strlen(hdr_name
) + SIP_SPACE_LEN
+ csize
+
382 SIP_SPACE_LEN
+ strlen(digit_str
) + csize
+ strlen(s
) +
383 csize
+ strlen(plist
) + strlen(SIP_CRLF
);
386 new_header
= sip_new_header(header_size
);
387 if (new_header
== NULL
) {
388 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
394 (void) snprintf(new_header
->sip_hdr_start
, header_size
+ 1,
395 "%s %c %s %s%s", hdr_name
, SIP_HCOLON
, digit_str
, s
,
398 (void) snprintf(new_header
->sip_hdr_start
, header_size
+ 1,
399 "%s %c %s %s%c%s%s", hdr_name
, SIP_HCOLON
, digit_str
,
400 s
, SIP_SEMI
, plist
, SIP_CRLF
);
403 _sip_add_header(_sip_msg
, new_header
, B_TRUE
, B_FALSE
, NULL
);
404 if (_sip_msg
->sip_msg_buf
!= NULL
)
405 _sip_msg
->sip_msg_modified
= B_TRUE
;
406 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
412 * Generic function to add Contact, From, To, Route or Record-Route header
415 sip_add_name_aspec(sip_msg_t sip_msg
, char *display_name
, char *uri
,
416 char *tags
, boolean_t add_aquot
, char *header_name
, char *params
)
419 boolean_t qalloc
= B_FALSE
;
420 boolean_t palloc
= B_FALSE
;
423 if (sip_msg
== NULL
|| uri
== NULL
|| header_name
== NULL
)
425 if (display_name
!= NULL
&& !add_aquot
)
428 t
= sip_add_aquot_to_str(uri
, &qalloc
);
438 plen
= strlen(SIP_TAG
) + strlen(tags
) + 1;
439 params
= malloc(plen
);
442 (void) snprintf(params
, plen
, "%s%s", SIP_TAG
, tags
);
443 params
[plen
- 1] = '\0';
446 if (display_name
== NULL
) {
447 r
= sip_add_2strs_to_msg(sip_msg
, header_name
, " ", B_FALSE
,
450 r
= sip_add_2strs_to_msg(sip_msg
, header_name
, display_name
,
451 B_TRUE
, t
, params
, SIP_SP
);
461 * Accept = "Accept" ":" (media-range [ accept-params ])
462 * media-range = ( "X/X" | (type "/" "*") | (type "/" subtype))*(";" parameter)
463 * accept-params = ";" "q" "=" qvalue *(accept-extension)
464 * accept-extension = ";" token [ "=" (token | quoted-str)
466 * function take two char ptrs - type and subtype - if any of them is NULL
467 * the corresponding value will be set to "*" in header
470 sip_add_accept(sip_msg_t sip_msg
, char *type
, char *subtype
, char *m_par
,
476 boolean_t alloc
= B_FALSE
;
478 if (type
== NULL
&& subtype
== NULL
) {
479 ret
= sip_add_empty_hdr(sip_msg
, SIP_ACCEPT
);
483 if ((m_par
!= NULL
) && (a_par
!= NULL
)) {
484 size
= strlen(m_par
) + strlen(a_par
) + 2 * sizeof (char);
485 plist
= calloc(1, size
* sizeof (char));
486 (void) strncpy(plist
, m_par
, strlen(m_par
));
487 (void) strncat(plist
, ";", 1);
488 (void) strncat(plist
, a_par
, strlen(a_par
));
490 } else if (m_par
!= NULL
) {
495 if ((type
!= NULL
) && (subtype
!= NULL
)) {
496 ret
= sip_add_2strs_to_msg(sip_msg
, SIP_ACCEPT
, type
, B_FALSE
,
497 subtype
, plist
, SIP_SLASH
);
498 } else if (type
!= NULL
) {
499 ret
= sip_add_2strs_to_msg(sip_msg
, SIP_ACCEPT
, type
, B_FALSE
,
500 "*", plist
, SIP_SLASH
);
513 * Accept-Encoding = "Accept-Encoding" ":" 1#(codings [ ";" "q" "=" qval])
514 * codings = ( content-coding | "*" )
515 * content-coding = token
517 * function take one char ptr, if NULL value will be set to "*"
520 sip_add_accept_enc(sip_msg_t sip_msg
, char *code
, char *plist
)
525 ret
= sip_add_str_to_msg(sip_msg
, SIP_ACCEPT_ENCODE
, "*", plist
,
528 ret
= sip_add_str_to_msg(sip_msg
, SIP_ACCEPT_ENCODE
, code
,
535 * Accept-Language = "Accept-Language" ":" 1#( language-range [ ";" "q""=" val])
536 * language-range = ( ( 1*8ALPHA *("-" 1*8ALPHA))|"*")
539 sip_add_accept_lang(sip_msg_t sip_msg
, char *lang
, char *plist
)
544 ret
= sip_add_empty_hdr(sip_msg
, SIP_ACCEPT_LANG
);
547 ret
= sip_add_str_to_msg(sip_msg
, SIP_ACCEPT_LANG
, lang
, plist
,
553 * Alert-Info = "Alert-Info" ":" "<" URI ">"
556 sip_add_alert_info(sip_msg_t sip_msg
, char *alert
, char *plist
)
564 tmp
= sip_add_aquot_to_str(alert
, &alloc
);
567 ret
= sip_add_str_to_msg(sip_msg
, SIP_ALERT_INFO
, tmp
, plist
, SIP_SEMI
);
574 * Allow = "Allow" ":" method-name1[, method-name2..]
575 * method-name = "INVITE" | "ACK" | "OPTIONS" | "CANCEL" | "BYE"
578 sip_add_allow(sip_msg_t sip_msg
, sip_method_t method
)
582 if (method
== 0 || method
>= MAX_SIP_METHODS
)
584 ret
= sip_add_str_to_msg(sip_msg
, SIP_ALLOW
, sip_methods
[method
].name
,
590 * Call-Info = "Call-Info" HCOLON info *(COMMA info)
591 * info = LAQUOT absoluteURI RAQUOT *( SEMI info-param)
592 * info-param = ( "purpose" EQUAL ( "icon" / "info"
593 * / "card" / token ) ) / generic-param
596 sip_add_call_info(sip_msg_t sip_msg
, char *uri
, char *plist
)
604 tmp
= sip_add_aquot_to_str(uri
, &alloc
);
607 r
= sip_add_str_to_msg(sip_msg
, SIP_CALL_INFO
, tmp
, plist
, SIP_SEMI
);
614 * Content-Disposition = "Content-Disposition" HCOLON
615 * disp-type *( SEMI disp-param )
616 * disp-type = "render" / "session" / "icon" / "alert"
617 * / disp-extension-token
618 * disp-param = handling-param / generic-param
619 * handling-param = "handling" EQUAL
620 * ( "optional" / "required"
622 * other-handling = token
623 * disp-extension-token = token
626 sip_add_content_disp(sip_msg_t sip_msg
, char *dis_type
, char *plist
)
630 if (dis_type
== NULL
)
633 ret
= sip_add_str_to_msg(sip_msg
, SIP_CONTENT_DIS
, dis_type
, plist
,
639 * Content-Encoding = ( "Content-Encoding" / "e" ) HCOLON
640 * content-coding *(COMMA content-coding)
641 * content-coding = token
644 sip_add_content_enc(sip_msg_t sip_msg
, char *code
)
651 ret
= sip_add_str_to_msg(sip_msg
, SIP_CONTENT_ENCODE
, code
, NULL
,
657 * Content-Language = "Content-Language" HCOLON
658 * language-tag *(COMMA language-tag)
659 * language-tag = primary-tag *( "-" subtag )
660 * primary-tag = 1*8ALPHA
664 sip_add_content_lang(sip_msg_t sip_msg
, char *lang
)
670 ret
= sip_add_str_to_msg(sip_msg
, SIP_CONTENT_LANG
, lang
, NULL
,
676 * Date = "Date" HCOLON SIP-date
677 * SIP-date = rfc1123-date
678 * rfc1123-date = wkday "," SP date1 SP time SP "GMT"
679 * date1 = 2DIGIT SP month SP 4DIGIT
680 * ; day month year (e.g., 02 Jun 1982)
681 * time = 2DIGIT ":" 2DIGIT ":" 2DIGIT
682 * ; 00:00:00 - 23:59:59
683 * wkday = "Mon" / "Tue" / "Wed"
684 * / "Thu" / "Fri" / "Sat" / "Sun"
685 * month = "Jan" / "Feb" / "Mar" / "Apr"
686 * / "May" / "Jun" / "Jul" / "Aug"
687 * / "Sep" / "Oct" / "Nov" / "Dec"
690 sip_add_date(sip_msg_t sip_msg
, char *date
)
696 ret
= sip_add_str_to_msg(sip_msg
, SIP_DATE
, date
, NULL
, (char)NULL
);
701 * Error-Info = "Error-Info" HCOLON error-uri *(COMMA error-uri)
702 * error-uri = LAQUOT absoluteURI RAQUOT *( SEMI generic-param )
705 sip_add_error_info(sip_msg_t sip_msg
, char *uri
, char *plist
)
713 tmp
= sip_add_aquot_to_str(uri
, &alloc
);
717 r
= sip_add_str_to_msg(sip_msg
, SIP_ERROR_INFO
, tmp
, plist
, SIP_SEMI
);
724 * Expires = "Expires" HCOLON delta-seconds
725 * delta-seconds = 1*DIGIT
728 sip_add_expires(sip_msg_t sip_msg
, int secs
)
732 if (sip_msg
== NULL
|| (int)secs
< 0)
735 ret
= sip_add_int_to_msg(sip_msg
, SIP_EXPIRE
, secs
, NULL
);
740 * In-Reply-To = "In-Reply-To" HCOLON callid *(COMMA callid)
741 * callid = word [ "@" word ]
744 sip_add_in_reply_to(sip_msg_t sip_msg
, char *reply_id
)
748 if (reply_id
== NULL
)
750 r
= sip_add_str_to_msg(sip_msg
, SIP_IN_REPLY_TO
, reply_id
, NULL
,
756 * RSeq = "RSeq" HCOLON response-num
759 sip_add_rseq(sip_msg_t sip_msg
, int resp_num
)
763 if (sip_msg
== NULL
|| resp_num
<= 0)
765 ret
= sip_add_int_to_msg(sip_msg
, SIP_RSEQ
, resp_num
, NULL
);
770 * Min-Expires = "Min-Expires" HCOLON delta-seconds
773 sip_add_min_expires(sip_msg_t sip_msg
, int secs
)
777 if (sip_msg
== NULL
|| (int)secs
< 0)
779 ret
= sip_add_int_to_msg(sip_msg
, SIP_MIN_EXPIRE
, secs
, NULL
);
784 * MIME-Version = "MIME-Version" HCOLON 1*DIGIT "." 1*DIGIT
787 sip_add_mime_version(sip_msg_t sip_msg
, char *version
)
793 ret
= sip_add_str_to_msg(sip_msg
, SIP_MIME_VERSION
, version
, NULL
,
799 * Organization = "Organization" HCOLON [TEXT-UTF8-TRIM]
802 sip_add_org(sip_msg_t sip_msg
, char *org
)
807 ret
= sip_add_empty_hdr(sip_msg
, SIP_ORGANIZATION
);
809 ret
= sip_add_str_to_msg(sip_msg
, SIP_ORGANIZATION
, org
, NULL
,
816 * Priority = "Priority" HCOLON priority-value
817 * priority-value = "emergency" / "urgent" / "normal"
818 * / "non-urgent" / other-priority
819 * other-priority = token
822 sip_add_priority(sip_msg_t sip_msg
, char *prio
)
828 ret
= sip_add_str_to_msg(sip_msg
, SIP_PRIORITY
, prio
, NULL
, (char)NULL
);
834 * Reply-To = "Reply-To" HCOLON rplyto-spec
835 * rplyto-spec = ( name-addr / addr-spec )
836 * *( SEMI rplyto-param )
837 * rplyto-param = generic-param
840 sip_add_reply_to(sip_msg_t sip_msg
, char *uname
, char *addr
, char *plist
,
843 return (sip_add_name_aspec(sip_msg
, uname
, addr
, NULL
, add_aquot
,
844 SIP_REPLYTO
, plist
));
849 * Privacy-hdr = "Privacy" HCOLON priv-value *(";" priv-value)
850 * priv-value = "header" / "session" / "user" / "none" / "critical"
854 sip_add_privacy(sip_msg_t sip_msg
, char *priv_val
)
858 if (priv_val
== NULL
)
860 ret
= sip_add_str_to_msg(sip_msg
, SIP_PRIVACY
, priv_val
, NULL
,
866 * Require = "Require" HCOLON option-tag *(COMMA option-tag)
870 sip_add_require(sip_msg_t sip_msg
, char *req
)
876 ret
= sip_add_str_to_msg(sip_msg
, SIP_REQUIRE
, req
, NULL
, (char)NULL
);
881 * Retry-After = "Retry-After" HCOLON delta-seconds
882 * [ comment ] *( SEMI retry-param )
883 * retry-param = ("duration" EQUAL delta-seconds)
887 sip_add_retry_after(sip_msg_t sip_msg
, int secs
, char *cmt
, char *plist
)
895 r
= sip_add_int_to_msg(sip_msg
, SIP_RETRY_AFTER
, secs
, plist
);
899 r
= sip_add_intstr_to_msg(sip_msg
, SIP_RETRY_AFTER
, secs
, cmt
, plist
);
904 * Server = "Server" HCOLON server-val *(LWS server-val)
905 * server-val = product / comment
906 * product = token [SLASH product-version]
907 * product-version = token
910 sip_add_server(sip_msg_t sip_msg
, char *svr
)
916 ret
= sip_add_str_to_msg(sip_msg
, SIP_SERVER
, svr
, NULL
, (char)NULL
);
921 * Subject = ( "Subject" / "s" ) HCOLON [TEXT-UTF8-TRIM]
924 sip_add_subject(sip_msg_t sip_msg
, char *subject
)
928 if (subject
== NULL
) {
929 ret
= sip_add_empty_hdr(sip_msg
, SIP_SUBJECT
);
931 ret
= sip_add_str_to_msg(sip_msg
, SIP_SUBJECT
, subject
, NULL
,
938 * Supported = ( "Supported" / "k" ) HCOLON
939 * [option-tag *(COMMA option-tag)]
942 sip_add_supported(sip_msg_t sip_msg
, char *support
)
946 if (support
== NULL
) {
947 ret
= sip_add_empty_hdr(sip_msg
, SIP_SUPPORT
);
949 ret
= sip_add_str_to_msg(sip_msg
, SIP_SUPPORT
, support
, NULL
,
956 * Timestamp = "Timestamp" HCOLON 1*(DIGIT)
957 * [ "." *(DIGIT) ] [ LWS delay ]
958 * delay = *(DIGIT) [ "." *(DIGIT) ]
961 sip_add_tstamp(sip_msg_t sip_msg
, char *time
, char *delay
)
966 ret
= sip_add_str_to_msg(sip_msg
, SIP_TIMESTAMP
, time
, NULL
,
969 ret
= sip_add_2strs_to_msg(sip_msg
, SIP_TIMESTAMP
, time
,
970 B_FALSE
, delay
, NULL
, ' ');
976 * Unsupported = "Unsupported" HCOLON option-tag *(COMMA option-tag)
979 sip_add_unsupported(sip_msg_t sip_msg
, char *unsupport
)
983 if (unsupport
== NULL
)
985 ret
= sip_add_str_to_msg(sip_msg
, SIP_UNSUPPORT
, unsupport
, NULL
,
991 * User-Agent = "User-Agent" HCOLON server-val *(LWS server-val)
994 sip_add_user_agent(sip_msg_t sip_msg
, char *usr
)
1000 r
= sip_add_str_to_msg(sip_msg
, SIP_USER_AGENT
, usr
, NULL
, (char)NULL
);
1005 * Warning = "Warning" HCOLON warning-value *(COMMA warning-value)
1006 * warning-value = warn-code SP warn-agent SP warn-text
1007 * warn-code = 3DIGIT
1008 * warn-agent = hostport / pseudonym
1009 * ; the name or pseudonym of the server adding
1010 * ; the Warning header, for use in debugging
1011 * warn-text = quoted-string
1015 sip_add_warning(sip_msg_t sip_msg
, int code
, char *addr
, char *msg
)
1017 _sip_header_t
*new_header
;
1019 _sip_msg_t
*_sip_msg
;
1020 char *hdr_name
= SIP_WARNING
;
1022 if (sip_msg
== NULL
|| addr
== NULL
|| msg
== NULL
||
1023 addr
[0] == '\0' || msg
== '\0' || code
< 100 || code
> 999) {
1027 _sip_msg
= (_sip_msg_t
*)sip_msg
;
1028 (void) pthread_mutex_lock(&_sip_msg
->sip_msg_mutex
);
1029 if (_sip_msg
->sip_msg_cannot_be_modified
) {
1030 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1034 header_size
= strlen(hdr_name
) + SIP_SPACE_LEN
+ sizeof (char) +
1035 SIP_SPACE_LEN
+ sip_num_of_digits(code
) + SIP_SPACE_LEN
+
1036 strlen(addr
) + SIP_SPACE_LEN
+ sizeof (char) + strlen(msg
) +
1037 sizeof (char) + strlen(SIP_CRLF
);
1039 new_header
= sip_new_header(header_size
);
1040 if (new_header
== NULL
) {
1041 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1045 (void) snprintf(new_header
->sip_hdr_start
, header_size
+ 1,
1046 "%s %c %d %s \"%s\"%s", hdr_name
, SIP_HCOLON
, code
, addr
,
1048 _sip_add_header(_sip_msg
, new_header
, B_TRUE
, B_FALSE
, NULL
);
1049 if (_sip_msg
->sip_msg_buf
!= NULL
)
1050 _sip_msg
->sip_msg_modified
= B_TRUE
;
1051 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1057 * RAck = "RAck" HCOLON response-num LWS CSeq-num LWS Method
1058 * response-num = 1*DIGIT
1059 * CSeq-num = 1*DIGIT
1062 sip_add_rack(sip_msg_t sip_msg
, int resp_num
, int cseq
, sip_method_t method
)
1064 _sip_header_t
*new_header
;
1066 _sip_msg_t
*_sip_msg
;
1067 char *hdr_name
= SIP_RACK
;
1069 if (sip_msg
== NULL
|| resp_num
<= 0 || cseq
< 0 || method
<= 0 ||
1070 method
>= MAX_SIP_METHODS
) {
1074 _sip_msg
= (_sip_msg_t
*)sip_msg
;
1075 (void) pthread_mutex_lock(&_sip_msg
->sip_msg_mutex
);
1076 if (_sip_msg
->sip_msg_cannot_be_modified
) {
1077 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1081 header_size
= strlen(hdr_name
) + SIP_SPACE_LEN
+ sizeof (char) +
1082 SIP_SPACE_LEN
+ sip_num_of_digits(resp_num
) + SIP_SPACE_LEN
+
1083 sip_num_of_digits(cseq
) + SIP_SPACE_LEN
+
1084 strlen(sip_methods
[method
].name
) + strlen(SIP_CRLF
);
1086 new_header
= sip_new_header(header_size
);
1087 if (new_header
== NULL
) {
1088 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1092 (void) snprintf(new_header
->sip_hdr_start
, header_size
+ 1,
1093 "%s %c %d %d %s%s", hdr_name
, SIP_HCOLON
, resp_num
, cseq
,
1094 sip_methods
[method
].name
, SIP_CRLF
);
1096 _sip_add_header(_sip_msg
, new_header
, B_TRUE
, B_FALSE
, NULL
);
1097 if (_sip_msg
->sip_msg_buf
!= NULL
)
1098 _sip_msg
->sip_msg_modified
= B_TRUE
;
1099 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1106 * Allow-Events = ( "Allow-Events" / "u" ) HCOLON event-type
1107 * *(COMMA event-type)
1110 sip_add_allow_events(sip_msg_t sip_msg
, char *t_event
)
1112 return (sip_add_str_to_msg(sip_msg
, SIP_ALLOW_EVENTS
, t_event
, NULL
,
1117 * Event = ( "Event" / "o" ) HCOLON event-type
1118 * *( SEMI event-param )
1119 * event-type = event-package *( "." event-template )
1120 * event-package = token-nodot
1121 * event-template = token-nodot
1122 * token-nodot = 1*( alphanum / "-" / "!" / "%" / "*"
1123 * / "_" / "+" / "`" / "'" / "~" )
1124 * event-param = generic-param / ( "id" EQUAL token )
1127 sip_add_event(sip_msg_t sip_msg
, char *t_event
, char *plist
)
1129 return (sip_add_str_to_msg(sip_msg
, SIP_EVENT
, t_event
, plist
,
1134 * Subscription-State = "Subscription-State" HCOLON substate-value
1135 * *( SEMI subexp-params )
1136 * substate-value = "active" / "pending" / "terminated"
1137 * / extension-substate
1138 * extension-substate = token
1139 * subexp-params = ("reason" EQUAL event-reason-value)
1140 * / ("expires" EQUAL delta-seconds)*
1141 * / ("retry-after" EQUAL delta-seconds)
1143 * event-reason-value = "deactivated"
1149 * / event-reason-extension
1150 * event-reason-extension = token
1153 sip_add_substate(sip_msg_t sip_msg
, char *sub
, char *plist
)
1155 return (sip_add_str_to_msg(sip_msg
, SIP_SUBSCRIPTION_STATE
, sub
, plist
,
1160 * Authorization = "Authorization" HCOLON credentials
1161 * credentials = ("Digest" LWS digest-response)
1163 * digest-response = dig-resp *(COMMA dig-resp)
1164 * dig-resp = username / realm / nonce / digest-uri
1165 * / dresponse / algorithm / cnonce
1166 * / opaque / message-qop
1167 * / nonce-count / auth-param
1168 * username = "username" EQUAL username-value
1169 * username-value = quoted-string
1170 * digest-uri = "uri" EQUAL LDQUOT digest-uri-value RDQUOT
1171 * digest-uri-value = rquest-uri ; Equal to request-uri as specified
1173 * message-qop = "qop" EQUAL qop-value
1174 * cnonce = "cnonce" EQUAL cnonce-value
1175 * cnonce-value = nonce-value
1176 * nonce-count = "nc" EQUAL nc-value
1178 * dresponse = "response" EQUAL request-digest
1179 * request-digest = LDQUOT 32LHEX RDQUOT
1180 * auth-param = auth-param-name EQUAL
1181 * ( token / quoted-string )
1182 * auth-param-name = token
1183 * other-response = auth-scheme LWS auth-param
1184 * *(COMMA auth-param)
1185 * auth-scheme = token
1188 sip_add_author(sip_msg_t sip_msg
, char *scheme
, char *param
)
1190 return (sip_add_str_to_msg(sip_msg
, SIP_AUTHOR
, scheme
, param
, SIP_SP
));
1194 * Authentication-Info = "Authentication-Info" HCOLON ainfo
1196 * ainfo = nextnonce / message-qop
1197 * / response-auth / cnonce
1199 * nextnonce = "nextnonce" EQUAL nonce-value
1200 * response-auth = "rspauth" EQUAL response-digest
1201 * response-digest = LDQUOT *LHEX RDQUOT
1204 sip_add_authen_info(sip_msg_t sip_msg
, char *ainfo
)
1206 return (sip_add_str_to_msg(sip_msg
, SIP_AUTHEN_INFO
, ainfo
, NULL
,
1211 * Proxy-Authenticate = "Proxy-Authenticate" HCOLON challenge
1212 * challenge = ("Digest" LWS digest-cln *(COMMA digest-cln))
1214 * other-challenge = auth-scheme LWS auth-param
1215 * *(COMMA auth-param)
1216 * digest-cln = realm / domain / nonce
1217 * / opaque / stale / algorithm
1218 * / qop-options / auth-param
1219 * realm = "realm" EQUAL realm-value
1220 * realm-value = quoted-string
1221 * domain = "domain" EQUAL LDQUOT URI
1222 * *( 1*SP URI ) RDQUOT
1223 * URI = absoluteURI / abs-path
1224 * nonce = "nonce" EQUAL nonce-value
1225 * nonce-value = quoted-string
1226 * opaque = "opaque" EQUAL quoted-string
1227 * stale = "stale" EQUAL ( "true" / "false" )
1228 * algorithm = "algorithm" EQUAL ( "MD5" / "MD5-sess"
1230 * qop-options = "qop" EQUAL LDQUOT qop-value
1231 * *("," qop-value) RDQUOT
1232 * qop-value = "auth" / "auth-int" / token
1235 sip_add_proxy_authen(sip_msg_t sip_msg
, char *pascheme
, char *paparam
)
1237 return (sip_add_str_to_msg(sip_msg
, SIP_PROXY_AUTHEN
, pascheme
, paparam
,
1242 * Proxy-Authorization = "Proxy-Authorization" HCOLON credentials
1245 sip_add_proxy_author(sip_msg_t sip_msg
, char *paschem
, char *paparam
)
1247 return (sip_add_str_to_msg(sip_msg
, SIP_PROXY_AUTHOR
, paschem
, paparam
,
1252 * Proxy-Require = "Proxy-Require" HCOLON option-tag
1253 * *(COMMA option-tag)
1254 * option-tag = token
1257 sip_add_proxy_require(sip_msg_t sip_msg
, char *opt
)
1259 return (sip_add_str_to_msg(sip_msg
, SIP_PROXY_REQ
, opt
, NULL
,
1264 * WWW-Authenticate = "WWW-Authenticate" HCOLON challenge
1265 * extension-header = header-name HCOLON header-value
1266 * header-name = token
1267 * header-value = *(TEXT-UTF8char / UTF8-CONT / LWS)
1268 * message-body = *OCTET
1271 sip_add_www_authen(sip_msg_t sip_msg
, char *wascheme
, char *waparam
)
1273 return (sip_add_str_to_msg(sip_msg
, SIP_WWW_AUTHEN
, wascheme
, waparam
,
1278 * Call-ID = ( "Call-ID" / "i" ) HCOLON callid
1281 sip_add_callid(sip_msg_t sip_msg
, char *callid
)
1284 boolean_t allocd
= B_FALSE
;
1286 if (sip_msg
== NULL
|| (callid
!= NULL
&& callid
[0] == '\0'))
1288 if (callid
== NULL
) {
1289 callid
= (char *)sip_guid();
1294 ret
= sip_add_str_to_msg(sip_msg
, SIP_CALL_ID
, callid
, NULL
,
1302 * CSeq = "CSeq" HCOLON 1*DIGIT LWS Method
1305 sip_add_cseq(sip_msg_t sip_msg
, sip_method_t method
, uint32_t cseq
)
1309 if (sip_msg
== NULL
|| (int)cseq
< 0 || method
== 0 ||
1310 method
>= MAX_SIP_METHODS
) {
1313 r
= sip_add_intstr_to_msg(sip_msg
, SIP_CSEQ
, cseq
,
1314 sip_methods
[method
].name
, NULL
);
1319 * Via = ( "Via" / "v" ) HCOLON via-parm *(COMMA via-parm)
1320 * via-parm = sent-protocol LWS sent-by *( SEMI via-params )
1321 * via-params = via-ttl / via-maddr
1322 * / via-received / via-branch
1324 * via-ttl = "ttl" EQUAL ttl
1325 * via-maddr = "maddr" EQUAL host
1326 * via-received = "received" EQUAL (IPv4address / IPv6address)
1327 * via-branch = "branch" EQUAL token
1328 * via-extension = generic-param
1329 * sent-protocol = protocol-name SLASH protocol-version
1331 * protocol-name = "SIP" / token
1332 * protocol-version = token
1333 * transport = "UDP" / "TCP" / "TLS" / "SCTP"
1335 * sent-by = host [ COLON port ]
1336 * ttl = 1*3DIGIT ; 0 to 255
1339 sip_create_via_hdr(char *sent_protocol_transport
, char *sent_by_host
,
1340 int sent_by_port
, char *via_params
)
1342 _sip_header_t
*new_header
;
1346 header_size
= strlen(SIP_VIA
) + SIP_SPACE_LEN
+ sizeof (char) +
1347 SIP_SPACE_LEN
+ strlen(SIP_VERSION
) + sizeof (char) +
1348 strlen(sent_protocol_transport
) + SIP_SPACE_LEN
+
1349 strlen(sent_by_host
) + strlen(SIP_CRLF
);
1351 if (sent_by_port
> 0) {
1352 header_size
+= SIP_SPACE_LEN
+ sizeof (char) + SIP_SPACE_LEN
+
1353 sip_num_of_digits(sent_by_port
);
1356 if (via_params
!= NULL
) {
1357 header_size
+= SIP_SPACE_LEN
+ sizeof (char) +
1360 new_header
= sip_new_header(header_size
);
1361 if (new_header
->sip_hdr_start
== NULL
)
1363 count
= snprintf(new_header
->sip_hdr_current
, header_size
+ 1,
1365 SIP_VIA
, SIP_HCOLON
, SIP_VERSION
, sent_protocol_transport
,
1367 new_header
->sip_hdr_current
+= count
;
1368 header_size
-= count
;
1370 if (sent_by_port
> 0) {
1371 count
= snprintf(new_header
->sip_hdr_current
, header_size
+ 1,
1372 " %c %d", SIP_HCOLON
, sent_by_port
);
1373 new_header
->sip_hdr_current
+= count
;
1374 header_size
-= count
;
1377 if (via_params
!= NULL
) {
1378 count
= snprintf(new_header
->sip_hdr_current
, header_size
+ 1,
1379 " %c%s", SIP_SEMI
, via_params
);
1380 new_header
->sip_hdr_current
+= count
;
1381 header_size
-= count
;
1384 (void) snprintf(new_header
->sip_hdr_current
, header_size
+ 1,
1386 return (new_header
);
1390 * There can be multiple via headers we always append the header.
1391 * We expect the via params to be a semi-colon separated list of parameters.
1392 * We will add a semi-clone, before adding the list to the header.
1395 sip_add_via(sip_msg_t sip_msg
, char *sent_protocol_transport
,
1396 char *sent_by_host
, int sent_by_port
, char *via_params
)
1398 _sip_header_t
*new_header
;
1399 _sip_msg_t
*_sip_msg
;
1401 if (sip_msg
== NULL
|| sent_protocol_transport
== NULL
||
1402 sent_by_host
== NULL
|| sent_by_port
< 0) {
1406 _sip_msg
= (_sip_msg_t
*)sip_msg
;
1407 (void) pthread_mutex_lock(&_sip_msg
->sip_msg_mutex
);
1408 if (_sip_msg
->sip_msg_cannot_be_modified
) {
1409 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1413 new_header
= sip_create_via_hdr(sent_protocol_transport
, sent_by_host
,
1414 sent_by_port
, via_params
);
1415 if (new_header
== NULL
) {
1416 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1419 _sip_add_header(_sip_msg
, new_header
, B_TRUE
, B_FALSE
, NULL
);
1420 if (_sip_msg
->sip_msg_buf
!= NULL
)
1421 _sip_msg
->sip_msg_modified
= B_TRUE
;
1422 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1427 * Max-Forwards = "Max-Forwards" HCOLON 1*DIGIT
1430 sip_add_maxforward(sip_msg_t sip_msg
, uint_t maxforward
)
1432 if (sip_msg
== NULL
|| (int)maxforward
< 0)
1434 return (sip_add_int_to_msg(sip_msg
, SIP_MAX_FORWARDS
, maxforward
,
1439 * Content-Type = ( "Content-Type" / "c" ) HCOLON media-type
1440 * media-type = m-type SLASH m-subtype *(SEMI m-parameter)
1441 * m-type = discrete-type / composite-type
1442 * discrete-type = "text" / "image" / "audio" / "video"
1443 * / "application" / extension-token
1444 * composite-type = "message" / "multipart" / extension-token
1445 * extension-token = ietf-token / x-token
1446 * ietf-token = token
1447 * x-token = "x-" token
1448 * m-subtype = extension-token / iana-token
1449 * iana-token = token
1450 * m-parameter = m-attribute EQUAL m-value
1451 * m-attribute = token
1452 * m-value = token / quoted-string
1455 sip_add_content_type(sip_msg_t sip_msg
, char *type
, char *subtype
)
1457 if (sip_msg
== NULL
|| type
== NULL
|| subtype
== NULL
)
1459 return (sip_add_2strs_to_msg(sip_msg
, SIP_CONTENT_TYPE
, type
, B_FALSE
,
1460 subtype
, NULL
, SIP_SLASH
));
1464 * Content-Length = ( "Content-Length" / "l" ) HCOLON 1*DIGIT
1467 sip_add_content_length(_sip_msg_t
*_sip_msg
, int length
)
1469 _sip_header_t
*new_header
;
1472 if (_sip_msg
== NULL
|| length
< 0)
1474 (void) pthread_mutex_lock(&_sip_msg
->sip_msg_mutex
);
1475 if (_sip_msg
->sip_msg_cannot_be_modified
) {
1476 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1480 header_size
= strlen(SIP_CONTENT_LENGTH
) + SIP_SPACE_LEN
+
1481 sizeof (char) + SIP_SPACE_LEN
+ sip_num_of_digits(length
) +
1482 strlen(SIP_CRLF
) + strlen(SIP_CRLF
);
1484 new_header
= sip_new_header(header_size
);
1485 if (new_header
== NULL
) {
1486 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1489 (void) snprintf(new_header
->sip_hdr_start
, header_size
+ 1,
1490 "%s %c %u%s%s", SIP_CONTENT_LENGTH
, SIP_HCOLON
, length
,
1491 SIP_CRLF
, SIP_CRLF
);
1493 _sip_add_header(_sip_msg
, new_header
, B_TRUE
, B_FALSE
, NULL
);
1494 if (_sip_msg
->sip_msg_buf
!= NULL
)
1495 _sip_msg
->sip_msg_modified
= B_TRUE
;
1496 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1502 * Contact = ("Contact" / "m" ) HCOLON
1503 * ( STAR / (contact-param *(COMMA contact-param)))
1504 * contact-param = (name-addr / addr-spec) *(SEMI contact-params)
1505 * name-addr = [ display-name ] LAQUOT addr-spec RAQUOT
1506 * addr-spec = SIP-URI / SIPS-URI / absoluteURI
1507 * display-name = *(token LWS)/ quoted-string
1508 * contact-params = c-p-q / c-p-expires
1509 * / contact-extension
1512 sip_add_contact(sip_msg_t sip_msg
, char *display_name
, char *contact_uri
,
1513 boolean_t add_aquot
, char *contact_params
)
1515 return (sip_add_name_aspec(sip_msg
, display_name
, contact_uri
, NULL
,
1516 add_aquot
, SIP_CONTACT
, contact_params
));
1520 * From = ( "From" / "f" ) HCOLON from-spec
1521 * from-spec = ( name-addr / addr-spec )
1522 * *( SEMI from-param )
1523 * from-param = tag-param / generic-param
1524 * tag-param = "tag" EQUAL token
1526 * Since there can be more than one tags, fromtags is a semi colon separated
1530 sip_add_from(sip_msg_t sip_msg
, char *display_name
, char *from_uri
,
1531 char *fromtags
, boolean_t add_aquot
, char *from_params
)
1533 return (sip_add_name_aspec(sip_msg
, display_name
, from_uri
, fromtags
,
1534 add_aquot
, SIP_FROM
, from_params
));
1538 * To = ( "To" / "t" ) HCOLON ( name-addr
1539 * / addr-spec ) *( SEMI to-param )
1540 * to-param = tag-param / generic-param
1543 sip_add_to(sip_msg_t sip_msg
, char *display_name
, char *to_uri
,
1544 char *totags
, boolean_t add_aquot
, char *to_params
)
1546 return (sip_add_name_aspec(sip_msg
, display_name
, to_uri
, totags
,
1547 add_aquot
, SIP_TO
, to_params
));
1551 * Route = "Route" HCOLON route-param *(COMMA route-param)
1552 * route-param = name-addr *( SEMI rr-param )
1555 sip_add_route(sip_msg_t sip_msg
, char *display_name
, char *uri
,
1558 return (sip_add_name_aspec(sip_msg
, display_name
, uri
, NULL
, B_TRUE
,
1559 SIP_ROUTE
, route_params
));
1563 * Record-Route = "Record-Route" HCOLON rec-route *(COMMA rec-route)
1564 * rec-route = name-addr *( SEMI rr-param )
1565 * rr-param = generic-param
1568 sip_add_record_route(sip_msg_t sip_msg
, char *display_name
, char *uri
,
1571 return (sip_add_name_aspec(sip_msg
, display_name
, uri
, NULL
, B_TRUE
,
1572 SIP_RECORD_ROUTE
, route_params
));
1577 * PAssertedID = "P-Asserted-Identity" HCOLON PAssertedID-value
1578 * *(COMMA PAssertedID-value)
1579 * PAssertedID-value = name-addr / addr-spec
1582 sip_add_passertedid(sip_msg_t sip_msg
, char *display_name
, char *addr
,
1583 boolean_t add_aquot
)
1585 return (sip_add_name_aspec(sip_msg
, display_name
, addr
, NULL
, add_aquot
,
1586 SIP_PASSERTEDID
, NULL
));
1590 * PPreferredID = "P-Preferred-Identity" HCOLON PPreferredID-value
1591 * *(COMMA PPreferredID-value)
1592 * PPreferredID-value = name-addr / addr-spec
1595 sip_add_ppreferredid(sip_msg_t sip_msg
, char *display_name
, char *addr
,
1596 boolean_t add_aquot
)
1598 return (sip_add_name_aspec(sip_msg
, display_name
, addr
, NULL
, add_aquot
,
1599 SIP_PPREFERREDID
, NULL
));