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.
36 #include "sip_miscdefs.h"
39 * Returns number of digits in the given int
42 sip_num_of_digits(int num
)
50 return (num_of_bytes
);
54 * Return the int as a string
67 * the following two loops convert int i to str
71 while ((t
= t
/ 10) != 0) {
75 str
= calloc(1, sizeof (char) * count
+ 1);
79 for (x
= 0; x
< count
; x
++) {
82 str
[count
- 1 - x
] = a
+ '0';
90 * Add quotes to the give str and return the quoted string
93 sip_add_aquot_to_str(char *str
, boolean_t
*alloc
)
103 if (*tmp
!= SIP_LAQUOT
) {
104 size
= strlen(str
) + 2 * sizeof (char);
105 new_str
= calloc(1, size
+ 1);
108 new_str
[0] = SIP_LAQUOT
;
110 (void) strncat(new_str
, str
, strlen(str
));
111 (void) strncat(new_str
, ">", 1);
112 new_str
[size
] = '\0';
121 * Add an empty header
124 sip_add_empty_hdr(sip_msg_t sip_msg
, char *hdr_name
)
126 _sip_header_t
*new_header
;
128 _sip_msg_t
*_sip_msg
;
129 int csize
= sizeof (char);
131 if (sip_msg
== NULL
|| hdr_name
== NULL
)
133 _sip_msg
= (_sip_msg_t
*)sip_msg
;
134 (void) pthread_mutex_lock(&_sip_msg
->sip_msg_mutex
);
135 if (_sip_msg
->sip_msg_cannot_be_modified
) {
136 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
140 header_size
= strlen(hdr_name
) + SIP_SPACE_LEN
+ csize
;
142 new_header
= sip_new_header(header_size
);
143 if (new_header
== NULL
) {
144 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
148 (void) snprintf(new_header
->sip_hdr_start
, header_size
+ 1,
149 "%s %c", hdr_name
, SIP_HCOLON
);
151 _sip_add_header(_sip_msg
, new_header
, B_TRUE
, B_FALSE
, hdr_name
);
152 if (_sip_msg
->sip_msg_buf
!= NULL
)
153 _sip_msg
->sip_msg_modified
= B_TRUE
;
154 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
160 * Generic function to add a header with two strings to message
163 sip_add_2strs_to_msg(sip_msg_t sip_msg
, char *hdr_name
, char *str1
,
164 boolean_t qstr1
, char *str2
, char *plist
, char sep
)
166 _sip_header_t
*new_header
;
168 _sip_msg_t
*_sip_msg
;
169 int csize
= sizeof (char);
171 if (sip_msg
== NULL
|| str1
== NULL
|| str2
== NULL
||
172 (str1
!= NULL
&& str1
[0] == '\0') ||
173 (str2
!= NULL
&& str2
[0] == '\0')) {
176 _sip_msg
= (_sip_msg_t
*)sip_msg
;
177 (void) pthread_mutex_lock(&_sip_msg
->sip_msg_mutex
);
178 if (_sip_msg
->sip_msg_cannot_be_modified
) {
179 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
184 header_size
= strlen(hdr_name
) + SIP_SPACE_LEN
+ csize
+
185 SIP_SPACE_LEN
+ strlen(str1
) + csize
+ strlen(str2
) +
188 header_size
= strlen(hdr_name
) + SIP_SPACE_LEN
+ csize
+
189 SIP_SPACE_LEN
+ strlen(str1
) + csize
+ strlen(str2
) +
190 csize
+ strlen(plist
) + strlen(SIP_CRLF
);
193 header_size
+= 2 * sizeof (char);
195 new_header
= sip_new_header(header_size
);
196 if (new_header
== NULL
) {
197 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
203 (void) snprintf(new_header
->sip_hdr_start
,
204 header_size
+ 1, "%s %c \"%s\"%c%s%s",
205 hdr_name
, SIP_HCOLON
, str1
, sep
, str2
, SIP_CRLF
);
207 (void) snprintf(new_header
->sip_hdr_start
,
208 header_size
+ 1, "%s %c %s%c%s%s",
209 hdr_name
, SIP_HCOLON
, str1
, sep
, str2
, SIP_CRLF
);
213 (void) snprintf(new_header
->sip_hdr_start
,
215 "%s %c \"%s\"%c%s%c%s%s", hdr_name
, SIP_HCOLON
,
216 str1
, sep
, str2
, SIP_SEMI
, plist
, SIP_CRLF
);
218 (void) snprintf(new_header
->sip_hdr_start
,
219 header_size
+ 1, "%s %c %s%c%s%c%s%s",
220 hdr_name
, SIP_HCOLON
, str1
, sep
, str2
, SIP_SEMI
,
224 _sip_add_header(_sip_msg
, new_header
, B_TRUE
, B_FALSE
, NULL
);
225 if (_sip_msg
->sip_msg_buf
!= NULL
)
226 _sip_msg
->sip_msg_modified
= B_TRUE
;
227 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
233 * Generic function to add a header with a string to message
236 sip_add_str_to_msg(sip_msg_t sip_msg
, char *hdr_name
, char *str
, char *plist
,
239 _sip_header_t
*new_header
;
241 _sip_msg_t
*_sip_msg
;
242 int csize
= sizeof (char);
244 if (sip_msg
== NULL
|| str
== NULL
|| (str
!= NULL
&& str
[0] == '\0'))
246 _sip_msg
= (_sip_msg_t
*)sip_msg
;
247 (void) pthread_mutex_lock(&_sip_msg
->sip_msg_mutex
);
248 if (_sip_msg
->sip_msg_cannot_be_modified
) {
249 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
254 header_size
= strlen(hdr_name
) + SIP_SPACE_LEN
+ csize
+
255 SIP_SPACE_LEN
+ + strlen(str
) + strlen(SIP_CRLF
);
257 header_size
= strlen(hdr_name
) + SIP_SPACE_LEN
+ csize
+
258 SIP_SPACE_LEN
+ + strlen(str
) + csize
+ strlen(plist
) +
262 new_header
= sip_new_header(header_size
);
263 if (new_header
== NULL
) {
264 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
268 (void) snprintf(new_header
->sip_hdr_start
, header_size
+ 1,
269 "%s %c %s%s", hdr_name
, SIP_HCOLON
, str
, SIP_CRLF
);
271 (void) snprintf(new_header
->sip_hdr_start
, header_size
+ 1,
272 "%s %c %s%c%s%s", hdr_name
, SIP_HCOLON
, str
, param_sep
,
275 _sip_add_header(_sip_msg
, new_header
, B_TRUE
, B_FALSE
, NULL
);
276 if (_sip_msg
->sip_msg_buf
!= NULL
)
277 _sip_msg
->sip_msg_modified
= B_TRUE
;
278 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
284 * Add an header with an int to sip_msg
287 sip_add_int_to_msg(sip_msg_t sip_msg
, char *hdr_name
, int i
, char *plist
)
289 _sip_header_t
*new_header
;
291 _sip_msg_t
*_sip_msg
;
293 int csize
= sizeof (char);
295 if (sip_msg
== NULL
|| (hdr_name
== NULL
))
297 _sip_msg
= (_sip_msg_t
*)sip_msg
;
298 (void) pthread_mutex_lock(&_sip_msg
->sip_msg_mutex
);
299 if (_sip_msg
->sip_msg_cannot_be_modified
) {
300 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
305 * the following two loops convert int i to str
307 digit_str
= sip_int_to_str(i
);
308 if (digit_str
== NULL
)
312 header_size
= strlen(hdr_name
) + SIP_SPACE_LEN
+ csize
+
313 SIP_SPACE_LEN
+ strlen(digit_str
) + strlen(SIP_CRLF
);
315 header_size
= strlen(hdr_name
) + SIP_SPACE_LEN
+ csize
+
316 SIP_SPACE_LEN
+ strlen(digit_str
) + csize
+
317 strlen(plist
) + strlen(SIP_CRLF
);
320 new_header
= sip_new_header(header_size
);
321 if (new_header
== NULL
) {
322 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
328 (void) snprintf(new_header
->sip_hdr_start
, header_size
+ 1,
329 "%s %c %s%s", hdr_name
, SIP_HCOLON
, digit_str
, SIP_CRLF
);
331 (void) snprintf(new_header
->sip_hdr_start
, header_size
+ 1,
332 "%s %c %s%c%s%s", hdr_name
, SIP_HCOLON
, digit_str
,
333 SIP_SEMI
, plist
, SIP_CRLF
);
336 _sip_add_header(_sip_msg
, new_header
, B_TRUE
, B_FALSE
, NULL
);
337 if (_sip_msg
->sip_msg_buf
!= NULL
)
338 _sip_msg
->sip_msg_modified
= B_TRUE
;
339 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
345 * Add a header with an int and string to sip_msg
348 sip_add_intstr_to_msg(sip_msg_t sip_msg
, char *hdr_name
, int i
, char *s
,
351 _sip_header_t
*new_header
;
353 _sip_msg_t
*_sip_msg
;
355 int csize
= sizeof (char);
357 if (sip_msg
== NULL
|| (hdr_name
== NULL
))
359 _sip_msg
= (_sip_msg_t
*)sip_msg
;
360 (void) pthread_mutex_lock(&_sip_msg
->sip_msg_mutex
);
361 if (_sip_msg
->sip_msg_cannot_be_modified
) {
362 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
367 * the following two loops convert int i to str
369 digit_str
= sip_int_to_str(i
);
370 if (digit_str
== NULL
) {
371 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
375 header_size
= strlen(hdr_name
) + SIP_SPACE_LEN
+ csize
+
376 SIP_SPACE_LEN
+ strlen(digit_str
) + csize
+ strlen(s
) +
379 header_size
= strlen(hdr_name
) + SIP_SPACE_LEN
+ csize
+
380 SIP_SPACE_LEN
+ strlen(digit_str
) + csize
+ strlen(s
) +
381 csize
+ strlen(plist
) + strlen(SIP_CRLF
);
384 new_header
= sip_new_header(header_size
);
385 if (new_header
== NULL
) {
386 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
392 (void) snprintf(new_header
->sip_hdr_start
, header_size
+ 1,
393 "%s %c %s %s%s", hdr_name
, SIP_HCOLON
, digit_str
, s
,
396 (void) snprintf(new_header
->sip_hdr_start
, header_size
+ 1,
397 "%s %c %s %s%c%s%s", hdr_name
, SIP_HCOLON
, digit_str
,
398 s
, SIP_SEMI
, plist
, SIP_CRLF
);
401 _sip_add_header(_sip_msg
, new_header
, B_TRUE
, B_FALSE
, NULL
);
402 if (_sip_msg
->sip_msg_buf
!= NULL
)
403 _sip_msg
->sip_msg_modified
= B_TRUE
;
404 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
410 * Generic function to add Contact, From, To, Route or Record-Route header
413 sip_add_name_aspec(sip_msg_t sip_msg
, char *display_name
, char *uri
,
414 char *tags
, boolean_t add_aquot
, char *header_name
, char *params
)
417 boolean_t qalloc
= B_FALSE
;
418 boolean_t palloc
= B_FALSE
;
421 if (sip_msg
== NULL
|| uri
== NULL
|| header_name
== NULL
)
423 if (display_name
!= NULL
&& !add_aquot
)
426 t
= sip_add_aquot_to_str(uri
, &qalloc
);
436 plen
= strlen(SIP_TAG
) + strlen(tags
) + 1;
437 params
= malloc(plen
);
440 (void) snprintf(params
, plen
, "%s%s", SIP_TAG
, tags
);
441 params
[plen
- 1] = '\0';
444 if (display_name
== NULL
) {
445 r
= sip_add_2strs_to_msg(sip_msg
, header_name
, " ", B_FALSE
,
448 r
= sip_add_2strs_to_msg(sip_msg
, header_name
, display_name
,
449 B_TRUE
, t
, params
, SIP_SP
);
459 * Accept = "Accept" ":" (media-range [ accept-params ])
460 * media-range = ( "X/X" | (type "/" "*") | (type "/" subtype))*(";" parameter)
461 * accept-params = ";" "q" "=" qvalue *(accept-extension)
462 * accept-extension = ";" token [ "=" (token | quoted-str)
464 * function take two char ptrs - type and subtype - if any of them is NULL
465 * the corresponding value will be set to "*" in header
468 sip_add_accept(sip_msg_t sip_msg
, char *type
, char *subtype
, char *m_par
,
474 boolean_t alloc
= B_FALSE
;
476 if (type
== NULL
&& subtype
== NULL
) {
477 ret
= sip_add_empty_hdr(sip_msg
, SIP_ACCEPT
);
481 if ((m_par
!= NULL
) && (a_par
!= NULL
)) {
482 size
= strlen(m_par
) + strlen(a_par
) + 2 * sizeof (char);
483 plist
= calloc(1, size
* sizeof (char));
484 (void) strncpy(plist
, m_par
, strlen(m_par
));
485 (void) strncat(plist
, ";", 1);
486 (void) strncat(plist
, a_par
, strlen(a_par
));
488 } else if (m_par
!= NULL
) {
493 if ((type
!= NULL
) && (subtype
!= NULL
)) {
494 ret
= sip_add_2strs_to_msg(sip_msg
, SIP_ACCEPT
, type
, B_FALSE
,
495 subtype
, plist
, SIP_SLASH
);
496 } else if (type
!= NULL
) {
497 ret
= sip_add_2strs_to_msg(sip_msg
, SIP_ACCEPT
, type
, B_FALSE
,
498 "*", plist
, SIP_SLASH
);
511 * Accept-Encoding = "Accept-Encoding" ":" 1#(codings [ ";" "q" "=" qval])
512 * codings = ( content-coding | "*" )
513 * content-coding = token
515 * function take one char ptr, if NULL value will be set to "*"
518 sip_add_accept_enc(sip_msg_t sip_msg
, char *code
, char *plist
)
523 ret
= sip_add_str_to_msg(sip_msg
, SIP_ACCEPT_ENCODE
, "*", plist
,
526 ret
= sip_add_str_to_msg(sip_msg
, SIP_ACCEPT_ENCODE
, code
,
533 * Accept-Language = "Accept-Language" ":" 1#( language-range [ ";" "q""=" val])
534 * language-range = ( ( 1*8ALPHA *("-" 1*8ALPHA))|"*")
537 sip_add_accept_lang(sip_msg_t sip_msg
, char *lang
, char *plist
)
542 ret
= sip_add_empty_hdr(sip_msg
, SIP_ACCEPT_LANG
);
545 ret
= sip_add_str_to_msg(sip_msg
, SIP_ACCEPT_LANG
, lang
, plist
,
551 * Alert-Info = "Alert-Info" ":" "<" URI ">"
554 sip_add_alert_info(sip_msg_t sip_msg
, char *alert
, char *plist
)
562 tmp
= sip_add_aquot_to_str(alert
, &alloc
);
565 ret
= sip_add_str_to_msg(sip_msg
, SIP_ALERT_INFO
, tmp
, plist
, SIP_SEMI
);
572 * Allow = "Allow" ":" method-name1[, method-name2..]
573 * method-name = "INVITE" | "ACK" | "OPTIONS" | "CANCEL" | "BYE"
576 sip_add_allow(sip_msg_t sip_msg
, sip_method_t method
)
580 if (method
== 0 || method
>= MAX_SIP_METHODS
)
582 ret
= sip_add_str_to_msg(sip_msg
, SIP_ALLOW
, sip_methods
[method
].name
,
588 * Call-Info = "Call-Info" HCOLON info *(COMMA info)
589 * info = LAQUOT absoluteURI RAQUOT *( SEMI info-param)
590 * info-param = ( "purpose" EQUAL ( "icon" / "info"
591 * / "card" / token ) ) / generic-param
594 sip_add_call_info(sip_msg_t sip_msg
, char *uri
, char *plist
)
602 tmp
= sip_add_aquot_to_str(uri
, &alloc
);
605 r
= sip_add_str_to_msg(sip_msg
, SIP_CALL_INFO
, tmp
, plist
, SIP_SEMI
);
612 * Content-Disposition = "Content-Disposition" HCOLON
613 * disp-type *( SEMI disp-param )
614 * disp-type = "render" / "session" / "icon" / "alert"
615 * / disp-extension-token
616 * disp-param = handling-param / generic-param
617 * handling-param = "handling" EQUAL
618 * ( "optional" / "required"
620 * other-handling = token
621 * disp-extension-token = token
624 sip_add_content_disp(sip_msg_t sip_msg
, char *dis_type
, char *plist
)
628 if (dis_type
== NULL
)
631 ret
= sip_add_str_to_msg(sip_msg
, SIP_CONTENT_DIS
, dis_type
, plist
,
637 * Content-Encoding = ( "Content-Encoding" / "e" ) HCOLON
638 * content-coding *(COMMA content-coding)
639 * content-coding = token
642 sip_add_content_enc(sip_msg_t sip_msg
, char *code
)
649 ret
= sip_add_str_to_msg(sip_msg
, SIP_CONTENT_ENCODE
, code
, NULL
,
655 * Content-Language = "Content-Language" HCOLON
656 * language-tag *(COMMA language-tag)
657 * language-tag = primary-tag *( "-" subtag )
658 * primary-tag = 1*8ALPHA
662 sip_add_content_lang(sip_msg_t sip_msg
, char *lang
)
668 ret
= sip_add_str_to_msg(sip_msg
, SIP_CONTENT_LANG
, lang
, NULL
,
674 * Date = "Date" HCOLON SIP-date
675 * SIP-date = rfc1123-date
676 * rfc1123-date = wkday "," SP date1 SP time SP "GMT"
677 * date1 = 2DIGIT SP month SP 4DIGIT
678 * ; day month year (e.g., 02 Jun 1982)
679 * time = 2DIGIT ":" 2DIGIT ":" 2DIGIT
680 * ; 00:00:00 - 23:59:59
681 * wkday = "Mon" / "Tue" / "Wed"
682 * / "Thu" / "Fri" / "Sat" / "Sun"
683 * month = "Jan" / "Feb" / "Mar" / "Apr"
684 * / "May" / "Jun" / "Jul" / "Aug"
685 * / "Sep" / "Oct" / "Nov" / "Dec"
688 sip_add_date(sip_msg_t sip_msg
, char *date
)
694 ret
= sip_add_str_to_msg(sip_msg
, SIP_DATE
, date
, NULL
, SIP_NUL
);
699 * Error-Info = "Error-Info" HCOLON error-uri *(COMMA error-uri)
700 * error-uri = LAQUOT absoluteURI RAQUOT *( SEMI generic-param )
703 sip_add_error_info(sip_msg_t sip_msg
, char *uri
, char *plist
)
711 tmp
= sip_add_aquot_to_str(uri
, &alloc
);
715 r
= sip_add_str_to_msg(sip_msg
, SIP_ERROR_INFO
, tmp
, plist
, SIP_SEMI
);
722 * Expires = "Expires" HCOLON delta-seconds
723 * delta-seconds = 1*DIGIT
726 sip_add_expires(sip_msg_t sip_msg
, int secs
)
730 if (sip_msg
== NULL
|| (int)secs
< 0)
733 ret
= sip_add_int_to_msg(sip_msg
, SIP_EXPIRE
, secs
, NULL
);
738 * In-Reply-To = "In-Reply-To" HCOLON callid *(COMMA callid)
739 * callid = word [ "@" word ]
742 sip_add_in_reply_to(sip_msg_t sip_msg
, char *reply_id
)
746 if (reply_id
== NULL
)
748 r
= sip_add_str_to_msg(sip_msg
, SIP_IN_REPLY_TO
, reply_id
, NULL
,
754 * RSeq = "RSeq" HCOLON response-num
757 sip_add_rseq(sip_msg_t sip_msg
, int resp_num
)
761 if (sip_msg
== NULL
|| resp_num
<= 0)
763 ret
= sip_add_int_to_msg(sip_msg
, SIP_RSEQ
, resp_num
, NULL
);
768 * Min-Expires = "Min-Expires" HCOLON delta-seconds
771 sip_add_min_expires(sip_msg_t sip_msg
, int secs
)
775 if (sip_msg
== NULL
|| (int)secs
< 0)
777 ret
= sip_add_int_to_msg(sip_msg
, SIP_MIN_EXPIRE
, secs
, NULL
);
782 * MIME-Version = "MIME-Version" HCOLON 1*DIGIT "." 1*DIGIT
785 sip_add_mime_version(sip_msg_t sip_msg
, char *version
)
791 ret
= sip_add_str_to_msg(sip_msg
, SIP_MIME_VERSION
, version
, NULL
,
797 * Organization = "Organization" HCOLON [TEXT-UTF8-TRIM]
800 sip_add_org(sip_msg_t sip_msg
, char *org
)
805 ret
= sip_add_empty_hdr(sip_msg
, SIP_ORGANIZATION
);
807 ret
= sip_add_str_to_msg(sip_msg
, SIP_ORGANIZATION
, org
, NULL
,
814 * Priority = "Priority" HCOLON priority-value
815 * priority-value = "emergency" / "urgent" / "normal"
816 * / "non-urgent" / other-priority
817 * other-priority = token
820 sip_add_priority(sip_msg_t sip_msg
, char *prio
)
826 ret
= sip_add_str_to_msg(sip_msg
, SIP_PRIORITY
, prio
, NULL
, SIP_NUL
);
832 * Reply-To = "Reply-To" HCOLON rplyto-spec
833 * rplyto-spec = ( name-addr / addr-spec )
834 * *( SEMI rplyto-param )
835 * rplyto-param = generic-param
838 sip_add_reply_to(sip_msg_t sip_msg
, char *uname
, char *addr
, char *plist
,
841 return (sip_add_name_aspec(sip_msg
, uname
, addr
, NULL
, add_aquot
,
842 SIP_REPLYTO
, plist
));
847 * Privacy-hdr = "Privacy" HCOLON priv-value *(";" priv-value)
848 * priv-value = "header" / "session" / "user" / "none" / "critical"
852 sip_add_privacy(sip_msg_t sip_msg
, char *priv_val
)
856 if (priv_val
== NULL
)
858 ret
= sip_add_str_to_msg(sip_msg
, SIP_PRIVACY
, priv_val
, NULL
,
864 * Require = "Require" HCOLON option-tag *(COMMA option-tag)
868 sip_add_require(sip_msg_t sip_msg
, char *req
)
874 ret
= sip_add_str_to_msg(sip_msg
, SIP_REQUIRE
, req
, NULL
, SIP_NUL
);
879 * Retry-After = "Retry-After" HCOLON delta-seconds
880 * [ comment ] *( SEMI retry-param )
881 * retry-param = ("duration" EQUAL delta-seconds)
885 sip_add_retry_after(sip_msg_t sip_msg
, int secs
, char *cmt
, char *plist
)
893 r
= sip_add_int_to_msg(sip_msg
, SIP_RETRY_AFTER
, secs
, plist
);
897 r
= sip_add_intstr_to_msg(sip_msg
, SIP_RETRY_AFTER
, secs
, cmt
, plist
);
902 * Server = "Server" HCOLON server-val *(LWS server-val)
903 * server-val = product / comment
904 * product = token [SLASH product-version]
905 * product-version = token
908 sip_add_server(sip_msg_t sip_msg
, char *svr
)
914 ret
= sip_add_str_to_msg(sip_msg
, SIP_SERVER
, svr
, NULL
, SIP_NUL
);
919 * Subject = ( "Subject" / "s" ) HCOLON [TEXT-UTF8-TRIM]
922 sip_add_subject(sip_msg_t sip_msg
, char *subject
)
926 if (subject
== NULL
) {
927 ret
= sip_add_empty_hdr(sip_msg
, SIP_SUBJECT
);
929 ret
= sip_add_str_to_msg(sip_msg
, SIP_SUBJECT
, subject
, NULL
,
936 * Supported = ( "Supported" / "k" ) HCOLON
937 * [option-tag *(COMMA option-tag)]
940 sip_add_supported(sip_msg_t sip_msg
, char *support
)
944 if (support
== NULL
) {
945 ret
= sip_add_empty_hdr(sip_msg
, SIP_SUPPORT
);
947 ret
= sip_add_str_to_msg(sip_msg
, SIP_SUPPORT
, support
, NULL
,
954 * Timestamp = "Timestamp" HCOLON 1*(DIGIT)
955 * [ "." *(DIGIT) ] [ LWS delay ]
956 * delay = *(DIGIT) [ "." *(DIGIT) ]
959 sip_add_tstamp(sip_msg_t sip_msg
, char *time
, char *delay
)
964 ret
= sip_add_str_to_msg(sip_msg
, SIP_TIMESTAMP
, time
, NULL
,
967 ret
= sip_add_2strs_to_msg(sip_msg
, SIP_TIMESTAMP
, time
,
968 B_FALSE
, delay
, NULL
, ' ');
974 * Unsupported = "Unsupported" HCOLON option-tag *(COMMA option-tag)
977 sip_add_unsupported(sip_msg_t sip_msg
, char *unsupport
)
981 if (unsupport
== NULL
)
983 ret
= sip_add_str_to_msg(sip_msg
, SIP_UNSUPPORT
, unsupport
, NULL
,
989 * User-Agent = "User-Agent" HCOLON server-val *(LWS server-val)
992 sip_add_user_agent(sip_msg_t sip_msg
, char *usr
)
998 r
= sip_add_str_to_msg(sip_msg
, SIP_USER_AGENT
, usr
, NULL
, SIP_NUL
);
1003 * Warning = "Warning" HCOLON warning-value *(COMMA warning-value)
1004 * warning-value = warn-code SP warn-agent SP warn-text
1005 * warn-code = 3DIGIT
1006 * warn-agent = hostport / pseudonym
1007 * ; the name or pseudonym of the server adding
1008 * ; the Warning header, for use in debugging
1009 * warn-text = quoted-string
1013 sip_add_warning(sip_msg_t sip_msg
, int code
, char *addr
, char *msg
)
1015 _sip_header_t
*new_header
;
1017 _sip_msg_t
*_sip_msg
;
1018 char *hdr_name
= SIP_WARNING
;
1020 if (sip_msg
== NULL
|| addr
== NULL
|| msg
== NULL
||
1021 addr
[0] == '\0' || msg
== '\0' || code
< 100 || code
> 999) {
1025 _sip_msg
= (_sip_msg_t
*)sip_msg
;
1026 (void) pthread_mutex_lock(&_sip_msg
->sip_msg_mutex
);
1027 if (_sip_msg
->sip_msg_cannot_be_modified
) {
1028 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1032 header_size
= strlen(hdr_name
) + SIP_SPACE_LEN
+ sizeof (char) +
1033 SIP_SPACE_LEN
+ sip_num_of_digits(code
) + SIP_SPACE_LEN
+
1034 strlen(addr
) + SIP_SPACE_LEN
+ sizeof (char) + strlen(msg
) +
1035 sizeof (char) + strlen(SIP_CRLF
);
1037 new_header
= sip_new_header(header_size
);
1038 if (new_header
== NULL
) {
1039 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1043 (void) snprintf(new_header
->sip_hdr_start
, header_size
+ 1,
1044 "%s %c %d %s \"%s\"%s", hdr_name
, SIP_HCOLON
, code
, addr
,
1046 _sip_add_header(_sip_msg
, new_header
, B_TRUE
, B_FALSE
, NULL
);
1047 if (_sip_msg
->sip_msg_buf
!= NULL
)
1048 _sip_msg
->sip_msg_modified
= B_TRUE
;
1049 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1055 * RAck = "RAck" HCOLON response-num LWS CSeq-num LWS Method
1056 * response-num = 1*DIGIT
1057 * CSeq-num = 1*DIGIT
1060 sip_add_rack(sip_msg_t sip_msg
, int resp_num
, int cseq
, sip_method_t method
)
1062 _sip_header_t
*new_header
;
1064 _sip_msg_t
*_sip_msg
;
1065 char *hdr_name
= SIP_RACK
;
1067 if (sip_msg
== NULL
|| resp_num
<= 0 || cseq
< 0 || method
<= 0 ||
1068 method
>= MAX_SIP_METHODS
) {
1072 _sip_msg
= (_sip_msg_t
*)sip_msg
;
1073 (void) pthread_mutex_lock(&_sip_msg
->sip_msg_mutex
);
1074 if (_sip_msg
->sip_msg_cannot_be_modified
) {
1075 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1079 header_size
= strlen(hdr_name
) + SIP_SPACE_LEN
+ sizeof (char) +
1080 SIP_SPACE_LEN
+ sip_num_of_digits(resp_num
) + SIP_SPACE_LEN
+
1081 sip_num_of_digits(cseq
) + SIP_SPACE_LEN
+
1082 strlen(sip_methods
[method
].name
) + strlen(SIP_CRLF
);
1084 new_header
= sip_new_header(header_size
);
1085 if (new_header
== NULL
) {
1086 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1090 (void) snprintf(new_header
->sip_hdr_start
, header_size
+ 1,
1091 "%s %c %d %d %s%s", hdr_name
, SIP_HCOLON
, resp_num
, cseq
,
1092 sip_methods
[method
].name
, SIP_CRLF
);
1094 _sip_add_header(_sip_msg
, new_header
, B_TRUE
, B_FALSE
, NULL
);
1095 if (_sip_msg
->sip_msg_buf
!= NULL
)
1096 _sip_msg
->sip_msg_modified
= B_TRUE
;
1097 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1104 * Allow-Events = ( "Allow-Events" / "u" ) HCOLON event-type
1105 * *(COMMA event-type)
1108 sip_add_allow_events(sip_msg_t sip_msg
, char *t_event
)
1110 return (sip_add_str_to_msg(sip_msg
, SIP_ALLOW_EVENTS
, t_event
, NULL
,
1115 * Event = ( "Event" / "o" ) HCOLON event-type
1116 * *( SEMI event-param )
1117 * event-type = event-package *( "." event-template )
1118 * event-package = token-nodot
1119 * event-template = token-nodot
1120 * token-nodot = 1*( alphanum / "-" / "!" / "%" / "*"
1121 * / "_" / "+" / "`" / "'" / "~" )
1122 * event-param = generic-param / ( "id" EQUAL token )
1125 sip_add_event(sip_msg_t sip_msg
, char *t_event
, char *plist
)
1127 return (sip_add_str_to_msg(sip_msg
, SIP_EVENT
, t_event
, plist
,
1132 * Subscription-State = "Subscription-State" HCOLON substate-value
1133 * *( SEMI subexp-params )
1134 * substate-value = "active" / "pending" / "terminated"
1135 * / extension-substate
1136 * extension-substate = token
1137 * subexp-params = ("reason" EQUAL event-reason-value)
1138 * / ("expires" EQUAL delta-seconds)*
1139 * / ("retry-after" EQUAL delta-seconds)
1141 * event-reason-value = "deactivated"
1147 * / event-reason-extension
1148 * event-reason-extension = token
1151 sip_add_substate(sip_msg_t sip_msg
, char *sub
, char *plist
)
1153 return (sip_add_str_to_msg(sip_msg
, SIP_SUBSCRIPTION_STATE
, sub
, plist
,
1158 * Authorization = "Authorization" HCOLON credentials
1159 * credentials = ("Digest" LWS digest-response)
1161 * digest-response = dig-resp *(COMMA dig-resp)
1162 * dig-resp = username / realm / nonce / digest-uri
1163 * / dresponse / algorithm / cnonce
1164 * / opaque / message-qop
1165 * / nonce-count / auth-param
1166 * username = "username" EQUAL username-value
1167 * username-value = quoted-string
1168 * digest-uri = "uri" EQUAL LDQUOT digest-uri-value RDQUOT
1169 * digest-uri-value = rquest-uri ; Equal to request-uri as specified
1171 * message-qop = "qop" EQUAL qop-value
1172 * cnonce = "cnonce" EQUAL cnonce-value
1173 * cnonce-value = nonce-value
1174 * nonce-count = "nc" EQUAL nc-value
1176 * dresponse = "response" EQUAL request-digest
1177 * request-digest = LDQUOT 32LHEX RDQUOT
1178 * auth-param = auth-param-name EQUAL
1179 * ( token / quoted-string )
1180 * auth-param-name = token
1181 * other-response = auth-scheme LWS auth-param
1182 * *(COMMA auth-param)
1183 * auth-scheme = token
1186 sip_add_author(sip_msg_t sip_msg
, char *scheme
, char *param
)
1188 return (sip_add_str_to_msg(sip_msg
, SIP_AUTHOR
, scheme
, param
, SIP_SP
));
1192 * Authentication-Info = "Authentication-Info" HCOLON ainfo
1194 * ainfo = nextnonce / message-qop
1195 * / response-auth / cnonce
1197 * nextnonce = "nextnonce" EQUAL nonce-value
1198 * response-auth = "rspauth" EQUAL response-digest
1199 * response-digest = LDQUOT *LHEX RDQUOT
1202 sip_add_authen_info(sip_msg_t sip_msg
, char *ainfo
)
1204 return (sip_add_str_to_msg(sip_msg
, SIP_AUTHEN_INFO
, ainfo
, NULL
,
1209 * Proxy-Authenticate = "Proxy-Authenticate" HCOLON challenge
1210 * challenge = ("Digest" LWS digest-cln *(COMMA digest-cln))
1212 * other-challenge = auth-scheme LWS auth-param
1213 * *(COMMA auth-param)
1214 * digest-cln = realm / domain / nonce
1215 * / opaque / stale / algorithm
1216 * / qop-options / auth-param
1217 * realm = "realm" EQUAL realm-value
1218 * realm-value = quoted-string
1219 * domain = "domain" EQUAL LDQUOT URI
1220 * *( 1*SP URI ) RDQUOT
1221 * URI = absoluteURI / abs-path
1222 * nonce = "nonce" EQUAL nonce-value
1223 * nonce-value = quoted-string
1224 * opaque = "opaque" EQUAL quoted-string
1225 * stale = "stale" EQUAL ( "true" / "false" )
1226 * algorithm = "algorithm" EQUAL ( "MD5" / "MD5-sess"
1228 * qop-options = "qop" EQUAL LDQUOT qop-value
1229 * *("," qop-value) RDQUOT
1230 * qop-value = "auth" / "auth-int" / token
1233 sip_add_proxy_authen(sip_msg_t sip_msg
, char *pascheme
, char *paparam
)
1235 return (sip_add_str_to_msg(sip_msg
, SIP_PROXY_AUTHEN
, pascheme
, paparam
,
1240 * Proxy-Authorization = "Proxy-Authorization" HCOLON credentials
1243 sip_add_proxy_author(sip_msg_t sip_msg
, char *paschem
, char *paparam
)
1245 return (sip_add_str_to_msg(sip_msg
, SIP_PROXY_AUTHOR
, paschem
, paparam
,
1250 * Proxy-Require = "Proxy-Require" HCOLON option-tag
1251 * *(COMMA option-tag)
1252 * option-tag = token
1255 sip_add_proxy_require(sip_msg_t sip_msg
, char *opt
)
1257 return (sip_add_str_to_msg(sip_msg
, SIP_PROXY_REQ
, opt
, NULL
,
1262 * WWW-Authenticate = "WWW-Authenticate" HCOLON challenge
1263 * extension-header = header-name HCOLON header-value
1264 * header-name = token
1265 * header-value = *(TEXT-UTF8char / UTF8-CONT / LWS)
1266 * message-body = *OCTET
1269 sip_add_www_authen(sip_msg_t sip_msg
, char *wascheme
, char *waparam
)
1271 return (sip_add_str_to_msg(sip_msg
, SIP_WWW_AUTHEN
, wascheme
, waparam
,
1276 * Call-ID = ( "Call-ID" / "i" ) HCOLON callid
1279 sip_add_callid(sip_msg_t sip_msg
, char *callid
)
1282 boolean_t allocd
= B_FALSE
;
1284 if (sip_msg
== NULL
|| (callid
!= NULL
&& callid
[0] == '\0'))
1286 if (callid
== NULL
) {
1287 callid
= (char *)sip_guid();
1292 ret
= sip_add_str_to_msg(sip_msg
, SIP_CALL_ID
, callid
, NULL
,
1300 * CSeq = "CSeq" HCOLON 1*DIGIT LWS Method
1303 sip_add_cseq(sip_msg_t sip_msg
, sip_method_t method
, uint32_t cseq
)
1307 if (sip_msg
== NULL
|| (int)cseq
< 0 || method
== 0 ||
1308 method
>= MAX_SIP_METHODS
) {
1311 r
= sip_add_intstr_to_msg(sip_msg
, SIP_CSEQ
, cseq
,
1312 sip_methods
[method
].name
, NULL
);
1317 * Via = ( "Via" / "v" ) HCOLON via-parm *(COMMA via-parm)
1318 * via-parm = sent-protocol LWS sent-by *( SEMI via-params )
1319 * via-params = via-ttl / via-maddr
1320 * / via-received / via-branch
1322 * via-ttl = "ttl" EQUAL ttl
1323 * via-maddr = "maddr" EQUAL host
1324 * via-received = "received" EQUAL (IPv4address / IPv6address)
1325 * via-branch = "branch" EQUAL token
1326 * via-extension = generic-param
1327 * sent-protocol = protocol-name SLASH protocol-version
1329 * protocol-name = "SIP" / token
1330 * protocol-version = token
1331 * transport = "UDP" / "TCP" / "TLS" / "SCTP"
1333 * sent-by = host [ COLON port ]
1334 * ttl = 1*3DIGIT ; 0 to 255
1337 sip_create_via_hdr(char *sent_protocol_transport
, char *sent_by_host
,
1338 int sent_by_port
, char *via_params
)
1340 _sip_header_t
*new_header
;
1344 header_size
= strlen(SIP_VIA
) + SIP_SPACE_LEN
+ sizeof (char) +
1345 SIP_SPACE_LEN
+ strlen(SIP_VERSION
) + sizeof (char) +
1346 strlen(sent_protocol_transport
) + SIP_SPACE_LEN
+
1347 strlen(sent_by_host
) + strlen(SIP_CRLF
);
1349 if (sent_by_port
> 0) {
1350 header_size
+= SIP_SPACE_LEN
+ sizeof (char) + SIP_SPACE_LEN
+
1351 sip_num_of_digits(sent_by_port
);
1354 if (via_params
!= NULL
) {
1355 header_size
+= SIP_SPACE_LEN
+ sizeof (char) +
1358 new_header
= sip_new_header(header_size
);
1359 if (new_header
->sip_hdr_start
== NULL
)
1361 count
= snprintf(new_header
->sip_hdr_current
, header_size
+ 1,
1363 SIP_VIA
, SIP_HCOLON
, SIP_VERSION
, sent_protocol_transport
,
1365 new_header
->sip_hdr_current
+= count
;
1366 header_size
-= count
;
1368 if (sent_by_port
> 0) {
1369 count
= snprintf(new_header
->sip_hdr_current
, header_size
+ 1,
1370 " %c %d", SIP_HCOLON
, sent_by_port
);
1371 new_header
->sip_hdr_current
+= count
;
1372 header_size
-= count
;
1375 if (via_params
!= NULL
) {
1376 count
= snprintf(new_header
->sip_hdr_current
, header_size
+ 1,
1377 " %c%s", SIP_SEMI
, via_params
);
1378 new_header
->sip_hdr_current
+= count
;
1379 header_size
-= count
;
1382 (void) snprintf(new_header
->sip_hdr_current
, header_size
+ 1,
1384 return (new_header
);
1388 * There can be multiple via headers we always append the header.
1389 * We expect the via params to be a semi-colon separated list of parameters.
1390 * We will add a semi-clone, before adding the list to the header.
1393 sip_add_via(sip_msg_t sip_msg
, char *sent_protocol_transport
,
1394 char *sent_by_host
, int sent_by_port
, char *via_params
)
1396 _sip_header_t
*new_header
;
1397 _sip_msg_t
*_sip_msg
;
1399 if (sip_msg
== NULL
|| sent_protocol_transport
== NULL
||
1400 sent_by_host
== NULL
|| sent_by_port
< 0) {
1404 _sip_msg
= (_sip_msg_t
*)sip_msg
;
1405 (void) pthread_mutex_lock(&_sip_msg
->sip_msg_mutex
);
1406 if (_sip_msg
->sip_msg_cannot_be_modified
) {
1407 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1411 new_header
= sip_create_via_hdr(sent_protocol_transport
, sent_by_host
,
1412 sent_by_port
, via_params
);
1413 if (new_header
== NULL
) {
1414 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1417 _sip_add_header(_sip_msg
, new_header
, B_TRUE
, B_FALSE
, NULL
);
1418 if (_sip_msg
->sip_msg_buf
!= NULL
)
1419 _sip_msg
->sip_msg_modified
= B_TRUE
;
1420 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1425 * Max-Forwards = "Max-Forwards" HCOLON 1*DIGIT
1428 sip_add_maxforward(sip_msg_t sip_msg
, uint_t maxforward
)
1430 if (sip_msg
== NULL
|| (int)maxforward
< 0)
1432 return (sip_add_int_to_msg(sip_msg
, SIP_MAX_FORWARDS
, maxforward
,
1437 * Content-Type = ( "Content-Type" / "c" ) HCOLON media-type
1438 * media-type = m-type SLASH m-subtype *(SEMI m-parameter)
1439 * m-type = discrete-type / composite-type
1440 * discrete-type = "text" / "image" / "audio" / "video"
1441 * / "application" / extension-token
1442 * composite-type = "message" / "multipart" / extension-token
1443 * extension-token = ietf-token / x-token
1444 * ietf-token = token
1445 * x-token = "x-" token
1446 * m-subtype = extension-token / iana-token
1447 * iana-token = token
1448 * m-parameter = m-attribute EQUAL m-value
1449 * m-attribute = token
1450 * m-value = token / quoted-string
1453 sip_add_content_type(sip_msg_t sip_msg
, char *type
, char *subtype
)
1455 if (sip_msg
== NULL
|| type
== NULL
|| subtype
== NULL
)
1457 return (sip_add_2strs_to_msg(sip_msg
, SIP_CONTENT_TYPE
, type
, B_FALSE
,
1458 subtype
, NULL
, SIP_SLASH
));
1462 * Content-Length = ( "Content-Length" / "l" ) HCOLON 1*DIGIT
1465 sip_add_content_length(_sip_msg_t
*_sip_msg
, int length
)
1467 _sip_header_t
*new_header
;
1470 if (_sip_msg
== NULL
|| length
< 0)
1472 (void) pthread_mutex_lock(&_sip_msg
->sip_msg_mutex
);
1473 if (_sip_msg
->sip_msg_cannot_be_modified
) {
1474 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1478 header_size
= strlen(SIP_CONTENT_LENGTH
) + SIP_SPACE_LEN
+
1479 sizeof (char) + SIP_SPACE_LEN
+ sip_num_of_digits(length
) +
1480 strlen(SIP_CRLF
) + strlen(SIP_CRLF
);
1482 new_header
= sip_new_header(header_size
);
1483 if (new_header
== NULL
) {
1484 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1487 (void) snprintf(new_header
->sip_hdr_start
, header_size
+ 1,
1488 "%s %c %u%s%s", SIP_CONTENT_LENGTH
, SIP_HCOLON
, length
,
1489 SIP_CRLF
, SIP_CRLF
);
1491 _sip_add_header(_sip_msg
, new_header
, B_TRUE
, B_FALSE
, NULL
);
1492 if (_sip_msg
->sip_msg_buf
!= NULL
)
1493 _sip_msg
->sip_msg_modified
= B_TRUE
;
1494 (void) pthread_mutex_unlock(&_sip_msg
->sip_msg_mutex
);
1500 * Contact = ("Contact" / "m" ) HCOLON
1501 * ( STAR / (contact-param *(COMMA contact-param)))
1502 * contact-param = (name-addr / addr-spec) *(SEMI contact-params)
1503 * name-addr = [ display-name ] LAQUOT addr-spec RAQUOT
1504 * addr-spec = SIP-URI / SIPS-URI / absoluteURI
1505 * display-name = *(token LWS)/ quoted-string
1506 * contact-params = c-p-q / c-p-expires
1507 * / contact-extension
1510 sip_add_contact(sip_msg_t sip_msg
, char *display_name
, char *contact_uri
,
1511 boolean_t add_aquot
, char *contact_params
)
1513 return (sip_add_name_aspec(sip_msg
, display_name
, contact_uri
, NULL
,
1514 add_aquot
, SIP_CONTACT
, contact_params
));
1518 * From = ( "From" / "f" ) HCOLON from-spec
1519 * from-spec = ( name-addr / addr-spec )
1520 * *( SEMI from-param )
1521 * from-param = tag-param / generic-param
1522 * tag-param = "tag" EQUAL token
1524 * Since there can be more than one tags, fromtags is a semi colon separated
1528 sip_add_from(sip_msg_t sip_msg
, char *display_name
, char *from_uri
,
1529 char *fromtags
, boolean_t add_aquot
, char *from_params
)
1531 return (sip_add_name_aspec(sip_msg
, display_name
, from_uri
, fromtags
,
1532 add_aquot
, SIP_FROM
, from_params
));
1536 * To = ( "To" / "t" ) HCOLON ( name-addr
1537 * / addr-spec ) *( SEMI to-param )
1538 * to-param = tag-param / generic-param
1541 sip_add_to(sip_msg_t sip_msg
, char *display_name
, char *to_uri
,
1542 char *totags
, boolean_t add_aquot
, char *to_params
)
1544 return (sip_add_name_aspec(sip_msg
, display_name
, to_uri
, totags
,
1545 add_aquot
, SIP_TO
, to_params
));
1549 * Route = "Route" HCOLON route-param *(COMMA route-param)
1550 * route-param = name-addr *( SEMI rr-param )
1553 sip_add_route(sip_msg_t sip_msg
, char *display_name
, char *uri
,
1556 return (sip_add_name_aspec(sip_msg
, display_name
, uri
, NULL
, B_TRUE
,
1557 SIP_ROUTE
, route_params
));
1561 * Record-Route = "Record-Route" HCOLON rec-route *(COMMA rec-route)
1562 * rec-route = name-addr *( SEMI rr-param )
1563 * rr-param = generic-param
1566 sip_add_record_route(sip_msg_t sip_msg
, char *display_name
, char *uri
,
1569 return (sip_add_name_aspec(sip_msg
, display_name
, uri
, NULL
, B_TRUE
,
1570 SIP_RECORD_ROUTE
, route_params
));
1575 * PAssertedID = "P-Asserted-Identity" HCOLON PAssertedID-value
1576 * *(COMMA PAssertedID-value)
1577 * PAssertedID-value = name-addr / addr-spec
1580 sip_add_passertedid(sip_msg_t sip_msg
, char *display_name
, char *addr
,
1581 boolean_t add_aquot
)
1583 return (sip_add_name_aspec(sip_msg
, display_name
, addr
, NULL
, add_aquot
,
1584 SIP_PASSERTEDID
, NULL
));
1588 * PPreferredID = "P-Preferred-Identity" HCOLON PPreferredID-value
1589 * *(COMMA PPreferredID-value)
1590 * PPreferredID-value = name-addr / addr-spec
1593 sip_add_ppreferredid(sip_msg_t sip_msg
, char *display_name
, char *addr
,
1594 boolean_t add_aquot
)
1596 return (sip_add_name_aspec(sip_msg
, display_name
, addr
, NULL
, add_aquot
,
1597 SIP_PPREFERREDID
, NULL
));