/*
* CDDL HEADER START
*
* 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
* 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]
*
* CDDL HEADER END
*/
/*
*/
/*
* Contains implementation of various interfaces exported by library
*/
#include <stdio.h>
#include <assert.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sdp.h>
#include "sdp_parse.h"
#include "commp_util.h"
a_value, COMMP_CRLF); \
} else { \
a_name, COMMP_CRLF); \
} \
} \
}
k_enckey, COMMP_CRLF); \
} else { \
k_method, COMMP_CRLF); \
} \
} \
}
} \
}
} \
}
COMMP_ADDRTYPE_IP4) == 0) { \
COMMP_CRLF); \
} else { \
} \
COMMP_ADDRTYPE_IP6) == 0) { \
} else { \
COMMP_CRLF); \
} \
} else { \
c_address, COMMP_CRLF); \
} \
} \
}
return (NULL); \
} \
} \
}
return (NULL); \
} \
} \
}
return (NULL); \
} \
} \
}
return (NULL); \
} \
} \
}
len += FIELD_EQUALS_CRLF_LEN; \
} \
}
len += FIELD_EQUALS_CRLF_LEN; \
} \
}
len += FIELD_EQUALS_CRLF_LEN; \
} \
}
len += FIELD_EQUALS_CRLF_LEN; \
} \
}
/*
* Given a media list and media name ("audio", "video", et al), it searches
* the list for that media. Returns NULL if media not present.
*/
{
return (NULL);
}
return (media);
}
}
return (media);
}
/*
* Given a attribute list and name of the attribute ("rtpmap", "fmtp", et al),
* this API searches the list for that attribute. Returns NULL if not found.
*/
{
return (NULL);
}
return (attr);
}
}
return (attr);
}
/*
* Given a media list and a format number, this API will return the rtpmap
* attribute matching the format number.
*/
{
return (NULL);
}
SDP_RTPMAP) == 0)) {
++tmp;
return (attr);
}
}
}
}
return (attr);
}
/*
* Adds origin field to the session.
* o=<username> <sess-id> <sess-version> <nettype> <addrtype> <unicast-address>
*/
int
const char *address)
{
int ret = 0;
return (EINVAL);
}
return (EPROTO);
return (ENOMEM);
goto err_ret;
goto err_ret;
}
goto err_ret;
}
goto err_ret;
}
return (ret);
return (ret);
}
/*
* Adds session name field to the session.
* s=<session name>
*/
int
{
return (EINVAL);
return (EPROTO);
}
/*
* Adds session information field to the session or media section of SDP.
* i=<session description>
*/
int
{
return (EINVAL);
if (*information != NULL)
return (EPROTO);
}
/*
* Adds uri field to the session.
* u=<uri>
*/
int
{
return (EINVAL);
return (EPROTO);
}
/*
* Adds email address field to the session.
* e=<email-address>
*/
int
{
return (EINVAL);
B_TRUE));
}
/*
* Adds phone number field to the session.
* p=<phone-number>
*/
int
{
return (EINVAL);
B_TRUE));
}
/*
* Adds connection field to the session or media section of SDP
* c=<nettype> <addrtype> <connection-address>[/ttl]/<number of addresses>
*/
int
{
int ret = 0;
return (EINVAL);
}
return (ENOMEM);
goto err_ret;
}
goto err_ret;
}
goto err_ret;
}
} else {
}
return (ret);
return (ret);
}
/*
* Adds bandwidth field to the session or media section of SDP.
* b=<bwtype>:<bandwidth>
*/
int
{
int ret = 0;
return (EINVAL);
return (ENOMEM);
return (ret);
}
} else {
}
return (ret);
}
/*
* Adds time field to the session
* t=<start-time> <stop-time>
*/
int
sdp_time_t **time)
{
return (EINVAL);
}
return (ENOMEM);
}
else {
}
return (0);
}
/*
* Adds repeat field to the time structure of session
* r=<repeat interval> <active duration> <offsets from start-time>
*/
int
const char *offset)
{
int ret = 0;
return (EINVAL);
if (new_repeat == NULL)
return (ENOMEM);
goto err_ret;
}
} else {
}
return (ret);
return (ret);
}
/*
* Adds time zone field to the session
* z=<adjustment time> <offset> <adjustment time> <offset> ....
*/
int
{
int ret = 0;
return (EINVAL);
return (ENOMEM);
return (ret);
}
} else {
}
}
return (ret);
}
/*
* Adds key field to session or media section of SDP.
* k=<method>
* k=<method>:<encryption key>
*/
int
{
int ret = 0;
return (EINVAL);
return (EPROTO);
return (ENOMEM);
goto err_ret;
}
goto err_ret;
}
}
return (ret);
sdp_free_key(*key);
return (ret);
}
/*
* Adds attribute field to session or media section of SDP.
* a=<attribute>
* a=<attribute>:<value>
*/
int
{
int ret = 0;
return (EINVAL);
return (ENOMEM);
goto err_ret;
goto err_ret;
}
}
} else {
}
return (ret);
return (ret);
}
/*
* Adds media field to the session.
* m=<media> <port>[/portcount] <proto> <fmt> ...
*/
int
{
int ret = 0;
return (EINVAL);
}
return (ENOMEM);
}
goto err_ret;
goto err_ret;
}
goto err_ret;
}
} else {
}
return (0);
return (ret);
}
/*
* This internal API is required by sdp_session_to_str(). It determines the
* length of buffer that is required to hold the session. Since the RFC does
* not limit the size of various sub-fields in the field. We need to scan
* through the structure to determine the length.
*/
int
{
int len = 0;
+ 1;
}
}
}
}
}
}
}
}
}
return (len);
}
/*
* Given a session structure it clones (deep copy) and returns the cloned copy
*/
{
return (NULL);
return (NULL);
goto err_ret;
}
s_name) != 0) {
goto err_ret;
}
goto err_ret;
}
s_uri) != 0) {
goto err_ret;
}
goto err_ret;
}
goto err_ret;
}
&new_time) != 0) {
goto err_ret;
}
B_FALSE) != 0) {
goto err_ret;
}
goto err_ret;
}
}
}
goto err_ret;
}
goto err_ret;
goto err_ret;
}
goto err_ret;
}
}
}
return (new_sess);
return (NULL);
}
/*
* should i check if individual members are NULL, if not snprintf
* will core dump.
*/
/*
* Given a session structure, this API converts it into character
* buffer, which will be used as a payload later on.
*/
char *
{
int len = 0;
int s_len = 0;
int wrote = 0;
*error = 0;
return (NULL);
}
return (NULL);
}
}
}
}
}
}
}
}
}
}
}
} else {
m_proto);
}
}
}
*buf = '\0';
return (ret);
}
/*
* Given a session structure and the field ('v', 'o', 's', et al), this API
* deletes the corresponding structure element. It frees the memory and sets the
* pointer to NULL
*/
int
{
return (EINVAL);
switch (field) {
case SDP_ORIGIN_FIELD:
break;
case SDP_NAME_FIELD:
break;
case SDP_INFO_FIELD:
break;
case SDP_URI_FIELD:
break;
case SDP_EMAIL_FIELD:
break;
case SDP_PHONE_FIELD:
break;
case SDP_CONNECTION_FIELD:
break;
case SDP_BANDWIDTH_FIELD:
break;
case SDP_TIME_FIELD:
break;
case SDP_ZONE_FIELD:
break;
case SDP_KEY_FIELD:
break;
case SDP_ATTRIBUTE_FIELD:
break;
case SDP_MEDIA_FIELD:
break;
default:
return (EINVAL);
}
return (0);
}
/*
* Given a media structure and the field ('i', 'b', 'c', et al), this API
* deletes the corresponding structure element. It frees the memory and sets
* the pointer to NULL.
*/
int
{
return (EINVAL);
switch (field) {
case SDP_INFO_FIELD:
break;
case SDP_CONNECTION_FIELD:
break;
case SDP_BANDWIDTH_FIELD:
break;
case SDP_KEY_FIELD:
break;
case SDP_ATTRIBUTE_FIELD:
break;
default:
return (EINVAL);
}
return (0);
}
/*
* Given a media list and the media, this API deletes that media from the
* list. It frees the memory corresponding to that media.
*/
int
{
return (EINVAL);
}
return (EINVAL);
else
return (0);
}
/*
* Given an attribute list and an attribute, this API deletes that attribue
* from the list. It frees the memory corresponding to that attribute.
*/
int
{
return (EINVAL);
}
return (EINVAL);
else
return (0);
}
/*
* Allocates a new sdp session structure and assigns a version number to it.
* Currently one version is defined and it is 1. This will be useful in future
* in the unlikely need to change the structure.
*/
sdp_new_session(void)
{
return (session);
}