Description

The caller has to first call sdp_new_session(3COMMPUTIL) and get pointer to a session structure. Then that pointer is used as argument in the following functions
and the session structure is constructed. Once the structure is built the caller converts it to a string representation using sdp_session_to_str(3COMMPUTIL).

The sdp_add_name() function adds NAME (s=) SDP field to the session structure (sdp_session_t) using name.

The sdp_add_information() function adds INFO (i=) SDP field to the session structure (sdp_session_t) or media structure (sdp_media_t) using value. Since this field can be either in the media section or the session section of an SDP description
the caller has to pass &session->s_info or &media->m_info as the first argument.

The sdp_add_uri() function adds URI (u=) SDP field to the session structure (sdp_session_t) using uri.

The sdp_add_email() function adds EMAIL (e=) SDP field to the session structure (sdp_session_t) using email.

The sdp_add_phone() function adds PHONE (p=) SDP field to the session structure (sdp_session_t) using phone.

The sdp_add_connection() function adds CONNECTION (c=) SDP field to the session structure (sdp_session_t) or the media structure (sdp_media_t) using nettype, addrtype, address, ttl, and addrcount. While adding an IP4 or IP6 unicast address the ttl and addrcount should be set to 0. For multicast address the ttl should be set a reasonable value
(0 - 255) and addrcount cannot be 0. Also since this field can be either in the media section or the session section of an SDP description, the caller has to pass &session->s_conn or &media->m_conn as the first argument.

The sdp_add_bandwidth() function adds BANDWIDTH (b=) SDP field to the session structure (sdp_session_t) or the media structure (sdp_media_t) using type and value. Since this
field can be either in the media section or the session section of an SDP description, the caller has to pass &session->s_bw or &media->m_bw as the first argument.

The sdp_add_time() function adds the TIME (t=) SDP field to the session structure using startime and stoptime. The pointer to the newly created time structure is returned in time. This pointer is then
used in sdp_add_repeat() function.

The sdp_add_repeat() function adds the REPEAT (r=) SDP field to the session structure using interval, duration and offset. Here, offset is a string holding one or more offset values, for example “60” or “60 1d 3h”.

The sdp_add_zone() function adds the ZONE (z=) SDP field to the session structure using time and offset. To add multiple time and offset values in a single zone field, call this function once for each pair. See the example
below.

The sdp_add_key() function adds the KEY (k=) SDP field to the session structure (sdp_session_t) or media structure (sdp_media_t) using method and enckey. Since this field can
be either in the media section or the session section of an SDP description, the caller has to pass &session->s_key or &media->m_key as the first argument.

The sdp_add_attribute() function adds the ATTRIBUTE (a=) SDP field to the session structure (sdp_session_t) or media structure (sdp_media_t) using name and value. Since this
field can be either in the media section or the session section of an SDP description, the caller has to pass &session->s_attr or &media->m_attr as the first argument.

The sdp_add_media() function adds the MEDIA (m=) SDP field to the session structure (sdp_session_t) using name, port, portcount, protocol, and format. Here, format is a string holding possibly more than one value, for example, “0 31 32 97”. The pointer to the newly created media structure is returned in media. This pointer is then used to add SDP fields specific to that
media section.

Return Values

These functions return 0 on success and the appropriate error value on failure. The value of errno is not changed by these calls in the event of an error.

Errors

These functions will fail if:

EINVAL

Mandatory parameters are not provided (they are null).

ENOMEM

The allocation of memory failed.

Examples

Example 1 Build an SDP session structure

In the following example we see how to build an SDP session structure using the functions described on this manual page. We first get a pointer to sdp_session_t structure by calling sdp_new_session(). Then to this newly created structure we add
various SDP fields. Once the structure is built we obtain a string representation of the structure using sdp_session_to_str() function. Since its caller responsibility to free the session we call sdp_free_session() towards the end.