xref: /titanic_50/usr/src/man/man3sip/sip_add_from.3sip (revision 3d729aecc03ea6ebb9bd5d56b8dccd24f57daa41)
te
Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
SIP_ADD_FROM 3SIP "Feb 09, 2007"
NAME
sip_add_from, sip_add_to, sip_add_contact, sip_add_via, sip_add_maxforward, sip_add_callid, sip_add_cseq, sip_add_content_type, sip_add_content, sip_add_accept, sip_add_accept_enc, sip_add_accept_lang, sip_add_alert_info, sip_add_allow, sip_add_call_info, sip_add_content_disp, sip_add_content_enc, sip_add_content_lang, sip_add_date, sip_add_error_info, sip_add_expires, sip_add_in_reply_to, sip_add_mime_version, sip_add_min_expires, sip_add_org, sip_add_priority, sip_add_reply_to, sip_add_passertedid, sip_add_ppreferredid, sip_add_require, sip_add_retry_after, sip_add_route, sip_add_record_route, sip_add_server, sip_add_subject, sip_add_supported, sip_add_tstamp, sip_add_unsupported, sip_add_user_agent, sip_add_warning, sip_add_rseq, sip_add_privacy, sip_add_rack, sip_add_author, sip_add_authen_info, sip_add_proxy_authen, sip_add_proxy_author, sip_add_proxy_require, sip_add_www_authen, sip_add_allow_events, sip_add_event, sip_add_substate - add specific SIP headers to the SIP message
SYNOPSIS

cc [ flag ... ] file ... -lsip [ library ... ]
#include <sip.h>

int sip_add_from(sip_msg_t sip_msg, char *display_name, char *from_uri,
 char *from_tag, boolean_t add_aquot, char *from_params);

int sip_add_to(sip_msg_t sip_msg, char *display_name, char *to_uri,
 char *to_tag, boolean_t add_aquot, char *to_params);

int sip_add_contact(sip_msg_t sip_msg, char *display_name,
 char *contact_uri, boolean_t add_aquot, char *contact_params);

int sip_add_via(sip_msg_t sip_msg, char *sent_protocol_transport,
 char *sent_by_host, int sent_by_port, char *via_params);

int sip_add_maxforward(sip_msg_t sip_msg, uint_t maxforward);

int sip_add_callid(sip_msg_t sip_msg, char *callid);

int sip_add_cseq(sip_msg_t sip_msg, sip_method_t method, uint32_t cseq);

int sip_add_content_type(sip_msg_t sip_msg, char * type, char *subtype);

int sip_add_content(sip_msg_t sip_msg, char * content);

int sip_add_accept(sip_msg_t sip_msg, char *type, char *subtype,
 char *media_param, char *accept_param);

int sip_add_accept_enc(sip_msg_t sip_msg, char *code,
 char *param);

int sip_add_accept_lang(sip_msg_t sip_msg, char *lang,
 char *param);

int sip_add_alert_info(sip_msg_t sip_msg, char *alert,
 char *param);

int sip_add_allow(sip_msg_t sip_msg, sip_method_t method_name);

int sip_add_call_info(sip_msg_t sip_msg, char *uri,
 char *param);

int sip_add_content_disp(sip_msg_t sip_msg, char *dis_type, char *param);

int sip_add_content_enc(sip_msg_t sip_msg, char *code);

int sip_add_content_lang(sip_msg_t sip_msg, char *lang);

int sip_add_date(sip_msg_t sip_msg, char *date);

int sip_add_error_info(sip_msg_t sip_msg, char *uri, char *param);

int sip_add_expires(sip_msg_t sip_msg, int secs);

int sip_add_in_reply_to(sip_msg_t sip_msg, char *reply_id);

int sip_add_mime_version(sip_msg_t sip_msg, char *version);

int sip_add_min_expires(sip_msg_t sip_msg, int secs);

int sip_add_org(sip_msg_t sip_msg, char *org);

int sip_add_priority(sip_msg_t sip_msg, char *prio);

int sip_add_reply_to(sip_msg_t sip_msg, char *display_name,
 char *addr, char *param, boolean_t add_aquot);

int sip_add_passertedid(sip_msg_t sip_msg, char *display_name,
 char *addr, boolean_t add_aqout);

int sip_add_ppreferredid(sip_msg_t sip_msg, char *display_name,
 char *addr, boolean_t add_aquot);

int sip_add_require(sip_msg_t sip_msg, char *req);

int sip_add_retry_after(sip_msg_t sip_msg, int secs, char *cmt,
 char *param);

int sip_add_route(sip_msg_t sip_msg, char *display_name, char *uri,
 char *route_params);

int sip_add_record_route(sip_msg_t sip_msg, char *display_name,
 char *uri, char *route_params);

int sip_add_server(sip_msg_t sip_msg, char *svr);

int sip_add_subject(sip_msg_t sip_msg, char *subject);

int sip_add_supported(sip_msg_t sip_msg, char *support);

int sip_add_tstamp(sip_msg_t sip_msg, char *time, char *delay);

int sip_add_unsupported(sip_msg_t sip_msg, char *unsupport);

int sip_add_user_agent(sip_msg_t sip_msg, char *usr);

int sip_add_warning(sip_msg_t sip_msg, int code, char *addr, char *msg);

int sip_add_privacy(sip_msg_t sip_msg, char *priv_val);

int sip_add_rseq(sip_msg_t sip_msg, int resp_num);

int sip_add_rack(sip_msg_t sip_msg, int resp_num, int cseq,
 sip_method_t method);

int sip_add_author(sip_msg_t sip_msg, char *scheme, char *param);

int sip_add_authen_info(sip_msg_t sip_msg, char *ainfo);

int sip_add_proxy_authen(sip_msg_t sip_msg, char *pascheme,
 char *param);

int sip_add_proxy_author(sip_msg_t sip_msg, char *pascheme,
 char *param);

int sip_add_proxy_require(sip_msg_t sip_msg, char *opt);

int sip_add_www_authen(sip_msg_t sip_msg, char *wascheme,
 char *param);

int sip_add_allow_events(sip_msg_t sip_msg, char *events);

int sip_add_event(sip_msg_t sip_msg, char *event, char *param);

int sip_add_substate(sip_msg_t sip_msg, char *sub, char *param);
DESCRIPTION

For each of the following functions that add a header to a SIP message, the function adds a CRLF before appending the header to the SIP message.

The sip_add_from() and sip_add_to() functions appends a FROM and TO header respectively to the SIP message sip_msg. The header is created using the display_name, if non-null, and the uri values. The add_aquot parameter is used to specify whether the uri should be enclosed within '<>'. If a display_name is provided then add_aquot cannot be B_FALSE. The display_name parameter, if provided, is enclosed within quotes before creating to the SIP header. Tag value for the FROM/TO header can be specified which will be added to the SIP header by prefixing it with "TAG=". Any generic parameters can be specified as the last argument, which will be added, as is, to the SIP header.

Either the tag or the generic parameter can be specified not both, if both are specified, the resulting header contains only the tag parameter.

The sip_add_contact() function appends a CONTACT header to the SIP message sip_msg using the display_name and contact_uri. The add_aquot parameter has the same semantics as in sip_add_from()/sip_add_to(). Any contact parameters specified in contact_param is added to the CONTACT header before appending the header to the message.

The sip_add_via() function appends a VIA header to the SIP message sip_msg. The VIA header is constructed using sent_protocol_transport, sent_by_host and sent_by_port. A value of 0 for sent_by_port means that the port information is not present in the resulting VIA header. The VIA header that is created has the protocol set to "SIP" and version set to "2.0". Any parameters specific in via_params is added to the VIA header before appending the header to the SIP message.

The sip_add_maxforward() function appends a MAX-FORWARDS header to the SIP message sip_msg using the value in maxforward. The maxforward value is a positive integer.

The sip_add_callid() function appends a CALL-ID header to the SIP message sip_msg using the value in callid, if non-null. If callid is null, this function creates a CALL-ID header using a randomly generated value.

The sip_add_cseq() function appends a CSEQ header to the SIP message using the values in method and cseq. Permissible values for method include:

INVITE

ACK

OPTIONS

BYE

CANCEL

REGISTER

REFER

SUBSCRIBE

NOTIFY

PRACK

INFO

The cseq value is a positive integer.

The sip_add_content_type() function appends a CONTENT-TYPE to the SIP message sip_msg. The CONTENT-TYPE is created using the type and subtype, both should be non-null.

The sip_add_content() function adds a message body to the SIP message sip_msg. The message body is given by the null terminated string contents. Once the function returns, the caller may reuse or delete contents as sip_add_content() creates a new buffer and copies over contents for its use.

The sip_add_accept() function appends an ACCEPT header to the SIP message sip_msg. The ACCEPT header is created using type and subtype. If both type and subtype are null, then an empty ACCEPT header is added to the SIP message. If type is non-null, but subtype is null, then the ACCEPT header has the specified type and sets the subtype in the header to '*'. Any accept_param or media_param, if provided, are added to the ACCEPT header before appending the header to the SIP message.

The sip_add_accept_enc() function appends an ACCEPT-ENCODING header to the SIP message sip_msg. The ACCEPT-ENCODING is created using code. Any parameter specified in param is added to the ACCEPT-ENCODING header before appending the header to the SIP message.

The sip_add_accept_lang() function appends an ACCEPT-LANGUAGE header to the SIP message sip_msg. The ACCEPT-LANGUAGE header is created using lang. Any parameter specified in param is added to the ACCEPT-LANGUAGE header before appending the header to the SIP message.

The sip_add_alert_info() function appends an ALERT-INFO header to the SIP message sip_msg. The ALERT-INFO header is created using alert. Any parameter specified in param is added to the ALERT-INFO header before appending the header to the SIP message.

The sip_add_allow() function appends an ALLOW header to the SIP message sip_msg. The ALLOW header is created using alert and method. Permissible values for method include:

INVITE

ACK

OPTIONS

BYE

CANCEL

REGISTER

REFER

INFO

SUBSCRIBE

NOTIFY

PRACK

The sip_add_call_info() function appends a CALL-INFO header to the SIP message sip_msg. The CALL-INFO header is created using uri. Any parameter specified in param is added to the CALL-INFO before appending the header to the SIP message.

The sip_add_content_disp() function appends a CONTENT-DISPOSITION header to the SIP message sip_msg. The CONTENT-DISPOSITION header is created using disp_type. Any parameter specified in param is added to the CONTENT-DISPOSITION header before appending the header to the SIP message.

The sip_add_content_enc() function appends a CONTENT-ENCODING header to the SIP message sip_msg. The CONTENT-ENCODING header is created using code.

The sip_add_content_lang() function appends a CONTENT-LANGUAGE header to the SIP message sip_msg. The CONTENT-LANGUAGE header is created using lang.

The sip_add_date() appends a DATE header to the SIP message sip_msg. The DATE header is created using the date information specified in date. The semantics for the date string is given is RFC 3261, section 25.1.

The sip_add_error_info() function appends an ERROR-INFO header to the SIP message sip_msg. The ERROR-INFO header is created using uri. An parameters specified in param is added to the ERROR-INFO header before adding the header to the SIP message.

The sip_add_expires() function appends an EXPIRES header to the SIP message sip_msg. The EXPIRES header is created using the seconds specified in secs.

The sip_add_in_reply_to() function appends a IN-REPLY-TO header to the SIP message sip_msg. The IN-REPLY-TO header is created using the call-id value specified in reply_id.

The sip_add_mime_version() function appends a MIME-VERSION header to the SIP message sip_msg. The MIME-VERSION header is created using version.

The sip_add_min_expires() function appends a MIN-EXPIRES header to the SIP message sip_msg. The MIN-EXPIRES is created using the time in seconds specified in secs.

The sip_add_org() function appends a ORGANIZATION header to the SIP message sip_msg. The ORGANIZATION header is created using the information specified in org.

The sip_add_priority() function appends a PRIORITY header to the SIP message sip_msg. The PRIORITY header is created using the value specified in prio.

The sip_add_reply_to() function appends a REPLY-TO header to the SIP message sip_msg. The REPLY-TO header is created using the display_name, if provided, and addr. The add_aquot parameter has the same semantics as in sip_add_from()/sip_add_to(). Any parameters specified in param is added to the REPLY-TO header before appending the header to the SIP message.

The sip_add_passertedid() function appends a P-ASSERTED-IDENTITY header to the SIP message sip_msg. The P-ASSERTED-IDENTITY header is created using the display_name, if provided, and the addr. The add_aquot parameter has the same semantics as in sip_add_from()/sip_add_to().

The sip_add_ppreferredid() function appends a P-PREFERRED-IDENTITY header to the SIP message sip_msg. The P-PREFERRED-IDENTITY header is created using the display_name, if provided, and the addr. The add_aquot parameter has the same semantics as in sip_add_from()/sip_add_to().

The sip_add_require() function appends a REQUIRE header to the SIP message sip_msg. The REQUIRE header is created using the information in req.

The sip_add_retry_after() function appends a RETRY-AFTER header to the SIP message sip_msg. The RETRY-AFTER is created using the time in seconds specified in secs comments, if any, in cmt. Any parameters specified in param, if provided, is added to the RETRY-AFTER header before appending the header to the SIP message.

The sip_add_route() function appends a ROUTE header to the SIP message sip_msg. The ROUTE header is created using the display_name, if any, and the uri. The uri is enclosed in '<>' before adding to the header. Parameters specified in route_params are added to the ROUTE header before appending the header to the SIP message.

The sip_add_record_route() function appends a RECORD-ROUTE header to the SIP message sip_msg. The RECORD-ROUTE header is created using the display_name, if any, and the uri. The uri parameter is enclosed in '<>' before adding to the header. Any parameters specified in route_params is added to the ROUTE header before appending the header to the SIP message.

The sip_add_server() function appends a SERVER header to the SIP message sip_msg. The SERVER header is created using the information in srv.

The sip_add_subject() function appends a SUBJECT header to the SIP message sip_msg. The SUBJECT header is created using the information in subject.

The sip_add_supported() function appends a SUPPORTED header to the SIP message sip_msg. The SUPPORTED header is created using the information in support.

The sip_add_tstamp() function appends a TIMESTAMP header to the SIP message sip_msg. The TIMESTAMP header is created using the time value in time and the delay value, if provided, in delay.

The sip_add_unsupported() function appends an UNSUPPORTED header to the SIP message sip_msg. The UNSUPPORTED header is created using the option-tag value in unsupport.

The sip_add_user_agent() function appends an USER-AGENT header to the SIP message sip_msg. The USER-AGENT header is created using the server-val specified in usr.

The sip_add_warning() function appends a WARNING header to the SIP message sip_msg. The WARNING header is created using the warn-code in code, warn-agent in addr and warn-test in msg.

The sip_add_privacy() function appends a PRIVACY header to the SIP message sip_msg. The PRIVACY header is created using the privacy value specified in priv_val.

The sip_add_rseq() function appends a RSEQ header to the SIP message sip_msg. The RSEQ header is created using the sequence number specified in resp_num.

The sip_add_rack() function appends a RACK header to the SIP message sip_msg. The RACK header is created using the sequence number in resp_num, the SIP method in method and the CSEQ number in cseq. Permissible values for method include: INVITE, ACK, OPTIONS, BYE, CANCEL, REGISTER, REFER, INFO, SUBSCRIBE, NOTIFY, PRACK.

The sip_add_author() function appends an AUTHORIZATION header to the SIP message sip_msg. The AUTHORIZATION header is created using scheme. Any parameter specified in param is added to the AUTHORIZATION header before the header is appended to the SIP message.

The sip_add_authen_info() function appends an AUTHENTICATION-INFO() header to the SIP message sip_msg. The AUTHENTICATION-INFO header is created using the authentication information in ainfo.

The sip_add_proxy_authen() function appends a PROXY-AUTHENTICATE header to the SIP message sip_msg. The PROXY-AUTHENTICATE is created using the value specified in psacheme. Any parameter in param is added to the PROXY-AUTHENTICATE header before adding the header to the SIP message.

The sip_add_proxy_author() function appends a PROXY-AUTHORIZATION header to the SIP message sip_msg. The PROXY-AUTHORIZATION header is created using the value specified in pascheme. Any parameter in param is added to the PROXY-AUTHORIZATION header before adding the header to the SIP message.

The sip_add_proxy_require() function appends a PROXY-REQUIRE header to the SIP message sip_msg. The PROXY-REQUIRE header is created using the option-tag in opt.

The sip_add_www_authen() function appends a WWW-AUTHENTICATE header to the SIP message sip_msg. The WWW-AUTHENTICATE header is created using the challenge in wascheme. Any parameter in param is added to the WWW-AUTHENTICATE header before adding the header to the SIP message.

The sip_add_allow_events() function appends an ALLOW-EVENTS header to the SIP message The ALLOW-EVENTS header is created using the event specified in events.

The sip_add_event() function appends an EVENT header to the SIP message. The EVENT header is created using the value specified in event. Any parameter in param is added to the EVENT header before appending the header to the SIP message.

The sip_add_substate() function appends a SUBSCRIPTION-STATE header to the SIP message. The SUBSCRIPTION-STATE header is created using the state specified in sub. Any parameter in param is added to the SUBSCRIPTION-STATE header before appending the header to the SIP message.

RETURN VALUES

These functions return 0 on success and the appropriate error value on failure.

ERRORS

On failure, functions that return an error value can return one of the following: EINVAL

Mandatory parameters are not provided, i.e. null. For sip_add_from(), sip_add_to(), sip_add_contact(), sip_add_reply_to(), sip_add_passertedid(), sip_add_ppreferredid() if display_name is non-null and add_aquot is B_FALSE. For sip_add_branchid_to_via() the topmost VIA header already has a branch param or the SIP message does not have a VIA header.

EPERM

The message cannot be modified.

ENOMEM

There is an error allocating memory for creating headers/parameters.

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
Interface Stability Committed
MT-Level MT-Safe
SEE ALSO

libsip(3LIB)