"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/osipparser2/sdp_message.c" between
libosip2-5.0.0.tar.gz and libosip2-5.1.0.tar.gz

About: The GNU oSIP library is an implementation of SIP (RFC3261).

sdp_message.c  (libosip2-5.0.0):sdp_message.c  (libosip2-5.1.0)
skipping to change at line 29 skipping to change at line 29
#include <osipparser2/internal.h> #include <osipparser2/internal.h>
#include <osipparser2/osip_const.h> #include <osipparser2/osip_const.h>
#include <osipparser2/sdp_message.h> #include <osipparser2/sdp_message.h>
#include <osipparser2/osip_message.h> #include <osipparser2/osip_message.h>
#include <osipparser2/osip_port.h> #include <osipparser2/osip_port.h>
#define ERR_ERROR -1 /* bad header */ #define ERR_ERROR -1 /* bad header */
#define ERR_DISCARD 0 /* wrong header */ #define ERR_DISCARD 0 /* wrong header */
#define WF 1 /* well formed header */ #define OSIP_WF 1 /* well formed header */
static int sdp_message_parse_v (sdp_message_t * sdp, char *buf, char **next); static int sdp_message_parse_v (sdp_message_t * sdp, char *buf, char **next);
static int sdp_message_parse_o (sdp_message_t * sdp, char *buf, char **next); static int sdp_message_parse_o (sdp_message_t * sdp, char *buf, char **next);
static int sdp_message_parse_s (sdp_message_t * sdp, char *buf, char **next); static int sdp_message_parse_s (sdp_message_t * sdp, char *buf, char **next);
static int sdp_message_parse_i (sdp_message_t * sdp, char *buf, char **next); static int sdp_message_parse_i (sdp_message_t * sdp, char *buf, char **next);
static int sdp_message_parse_u (sdp_message_t * sdp, char *buf, char **next); static int sdp_message_parse_u (sdp_message_t * sdp, char *buf, char **next);
static int sdp_message_parse_e (sdp_message_t * sdp, char *buf, char **next); static int sdp_message_parse_e (sdp_message_t * sdp, char *buf, char **next);
static int sdp_message_parse_p (sdp_message_t * sdp, char *buf, char **next); static int sdp_message_parse_p (sdp_message_t * sdp, char *buf, char **next);
static int sdp_message_parse_c (sdp_message_t * sdp, char *buf, char **next); static int sdp_message_parse_c (sdp_message_t * sdp, char *buf, char **next);
static int sdp_message_parse_b (sdp_message_t * sdp, char *buf, char **next); static int sdp_message_parse_b (sdp_message_t * sdp, char *buf, char **next);
skipping to change at line 328 skipping to change at line 328
} }
/* append string_osip_to_append to string at position cur /* append string_osip_to_append to string at position cur
size is the current allocated size of the element size is the current allocated size of the element
*/ */
static char * static char *
__osip_sdp_append_string (char **string, int *size, char *cur, char *string_osip _to_append) __osip_sdp_append_string (char **string, int *size, char *cur, char *string_osip _to_append)
{ {
int length = (int) strlen (string_osip_to_append); int length = (int) strlen (string_osip_to_append);
if (cur - (*string) + length +1 > *size) { if (cur - (*string) + length + 1 > *size) {
int length2; int length2;
length2 = (int) (cur - *string); length2 = (int) (cur - *string);
(*string) = osip_realloc ((*string), *size + length + 500); (*string) = osip_realloc ((*string), *size + length + 500);
*size = *size + length + 500; /* optimize: avoid too much realloc */ *size = *size + length + 500; /* optimize: avoid too much realloc */
cur = (*string) + length2; /* the initial allocation may have changed! */ cur = (*string) + length2; /* the initial allocation may have changed! */
} }
osip_strncpy (cur, string_osip_to_append, length); osip_strncpy (cur, string_osip_to_append, length);
return cur + strlen (cur); return cur + strlen (cur);
} }
static int static int
sdp_message_parse_v (sdp_message_t * sdp, char *buf, char **next) sdp_message_parse_v (sdp_message_t * sdp, char *buf, char **next)
{ {
char *equal; char *equal;
skipping to change at line 377 skipping to change at line 378
return ERR_ERROR; /*v=\r ?? bad header */ return ERR_ERROR; /*v=\r ?? bad header */
sdp->v_version = osip_malloc (crlf - (equal + 1) + 1); sdp->v_version = osip_malloc (crlf - (equal + 1) + 1);
if (sdp->v_version == NULL) if (sdp->v_version == NULL)
return OSIP_NOMEM; return OSIP_NOMEM;
osip_strncpy (sdp->v_version, equal + 1, crlf - (equal + 1)); osip_strncpy (sdp->v_version, equal + 1, crlf - (equal + 1));
if (crlf[1] == '\n') if (crlf[1] == '\n')
*next = crlf + 2; *next = crlf + 2;
else else
*next = crlf + 1; *next = crlf + 1;
return WF; return OSIP_WF;
} }
static int static int
sdp_message_parse_o (sdp_message_t * sdp, char *buf, char **next) sdp_message_parse_o (sdp_message_t * sdp, char *buf, char **next)
{ {
char *equal; char *equal;
char *crlf; char *crlf;
char *tmp; char *tmp;
char *tmp_next; char *tmp_next;
int i; int i;
skipping to change at line 468 skipping to change at line 469
if (i != 0) { /* could it be "\n" only??? rfc says to accept C R or LF instead of CRLF */ if (i != 0) { /* could it be "\n" only??? rfc says to accept C R or LF instead of CRLF */
i = __osip_set_next_token (&(sdp->o_addr), tmp, '\n', &tmp_next); i = __osip_set_next_token (&(sdp->o_addr), tmp, '\n', &tmp_next);
if (i != 0) if (i != 0)
return -1; return -1;
} }
if (crlf[1] == '\n') if (crlf[1] == '\n')
*next = crlf + 2; *next = crlf + 2;
else else
*next = crlf + 1; *next = crlf + 1;
return WF; return OSIP_WF;
} }
static int static int
sdp_message_parse_s (sdp_message_t * sdp, char *buf, char **next) sdp_message_parse_s (sdp_message_t * sdp, char *buf, char **next)
{ {
char *equal; char *equal;
char *crlf; char *crlf;
*next = buf; *next = buf;
skipping to change at line 502 skipping to change at line 503
crlf++; crlf++;
if (*crlf == '\0') if (*crlf == '\0')
return ERR_ERROR; return ERR_ERROR;
#ifdef FIREFLY_BUG_SUPPORT #ifdef FIREFLY_BUG_SUPPORT
if (crlf == equal + 1) { if (crlf == equal + 1) {
sdp->s_name = osip_strdup (" "); sdp->s_name = osip_strdup (" ");
if (crlf[1] == '\n') if (crlf[1] == '\n')
*next = crlf + 2; *next = crlf + 2;
else else
*next = crlf + 1; *next = crlf + 1;
return WF; /* o=\r ?? bad header */ return OSIP_WF; /* o=\r ?? bad header */
} }
#else #else
if (crlf == equal + 1) if (crlf == equal + 1)
return ERR_ERROR; /* o=\r ?? bad header */ return ERR_ERROR; /* o=\r ?? bad header */
#endif #endif
/* s=text */ /* s=text */
/* text is interpreted as ISO-10646 UTF8! */ /* text is interpreted as ISO-10646 UTF8! */
/* using ISO 8859-1 requires "a=charset:ISO-8859-1 */ /* using ISO 8859-1 requires "a=charset:ISO-8859-1 */
sdp->s_name = osip_malloc (crlf - (equal + 1) + 1); sdp->s_name = osip_malloc (crlf - (equal + 1) + 1);
if (sdp->s_name == NULL) if (sdp->s_name == NULL)
return OSIP_NOMEM; return OSIP_NOMEM;
osip_strncpy (sdp->s_name, equal + 1, crlf - (equal + 1)); osip_strncpy (sdp->s_name, equal + 1, crlf - (equal + 1));
if (crlf[1] == '\n') if (crlf[1] == '\n')
*next = crlf + 2; *next = crlf + 2;
else else
*next = crlf + 1; *next = crlf + 1;
return WF; return OSIP_WF;
} }
static int static int
sdp_message_parse_i (sdp_message_t * sdp, char *buf, char **next) sdp_message_parse_i (sdp_message_t * sdp, char *buf, char **next)
{ {
char *equal; char *equal;
char *crlf; char *crlf;
int i; int i;
char *i_info; char *i_info;
skipping to change at line 580 skipping to change at line 581
else { else {
sdp_media_t *last_sdp_media = (sdp_media_t *) osip_list_get (&sdp->m_medias, i - 1); sdp_media_t *last_sdp_media = (sdp_media_t *) osip_list_get (&sdp->m_medias, i - 1);
last_sdp_media->i_info = i_info; last_sdp_media->i_info = i_info;
} }
if (crlf[1] == '\n') if (crlf[1] == '\n')
*next = crlf + 2; *next = crlf + 2;
else else
*next = crlf + 1; *next = crlf + 1;
return WF; return OSIP_WF;
} }
static int static int
sdp_message_parse_u (sdp_message_t * sdp, char *buf, char **next) sdp_message_parse_u (sdp_message_t * sdp, char *buf, char **next)
{ {
char *equal; char *equal;
char *crlf; char *crlf;
*next = buf; *next = buf;
skipping to change at line 621 skipping to change at line 622
/* we assume this is a URI */ /* we assume this is a URI */
sdp->u_uri = osip_malloc (crlf - (equal + 1) + 1); sdp->u_uri = osip_malloc (crlf - (equal + 1) + 1);
if (sdp->u_uri == NULL) if (sdp->u_uri == NULL)
return OSIP_NOMEM; return OSIP_NOMEM;
osip_strncpy (sdp->u_uri, equal + 1, crlf - (equal + 1)); osip_strncpy (sdp->u_uri, equal + 1, crlf - (equal + 1));
if (crlf[1] == '\n') if (crlf[1] == '\n')
*next = crlf + 2; *next = crlf + 2;
else else
*next = crlf + 1; *next = crlf + 1;
return WF; return OSIP_WF;
} }
static int static int
sdp_message_parse_e (sdp_message_t * sdp, char *buf, char **next) sdp_message_parse_e (sdp_message_t * sdp, char *buf, char **next)
{ {
char *equal; char *equal;
char *crlf; char *crlf;
char *e_email; char *e_email;
*next = buf; *next = buf;
skipping to change at line 665 skipping to change at line 666
if (e_email == NULL) if (e_email == NULL)
return OSIP_NOMEM; return OSIP_NOMEM;
osip_strncpy (e_email, equal + 1, crlf - (equal + 1)); osip_strncpy (e_email, equal + 1, crlf - (equal + 1));
osip_list_add (&sdp->e_emails, e_email, -1); osip_list_add (&sdp->e_emails, e_email, -1);
if (crlf[1] == '\n') if (crlf[1] == '\n')
*next = crlf + 2; *next = crlf + 2;
else else
*next = crlf + 1; *next = crlf + 1;
return WF; return OSIP_WF;
} }
static int static int
sdp_message_parse_p (sdp_message_t * sdp, char *buf, char **next) sdp_message_parse_p (sdp_message_t * sdp, char *buf, char **next)
{ {
char *equal; char *equal;
char *crlf; char *crlf;
char *p_phone; char *p_phone;
*next = buf; *next = buf;
skipping to change at line 709 skipping to change at line 710
if (p_phone == NULL) if (p_phone == NULL)
return OSIP_NOMEM; return OSIP_NOMEM;
osip_strncpy (p_phone, equal + 1, crlf - (equal + 1)); osip_strncpy (p_phone, equal + 1, crlf - (equal + 1));
osip_list_add (&sdp->p_phones, p_phone, -1); osip_list_add (&sdp->p_phones, p_phone, -1);
if (crlf[1] == '\n') if (crlf[1] == '\n')
*next = crlf + 2; *next = crlf + 2;
else else
*next = crlf + 1; *next = crlf + 1;
return WF; return OSIP_WF;
} }
static int static int
sdp_message_parse_c (sdp_message_t * sdp, char *buf, char **next) sdp_message_parse_c (sdp_message_t * sdp, char *buf, char **next)
{ {
char *equal; char *equal;
char *crlf; char *crlf;
char *tmp; char *tmp;
char *tmp_next; char *tmp_next;
sdp_connection_t *c_header; sdp_connection_t *c_header;
skipping to change at line 837 skipping to change at line 838
sdp->c_connection = c_header; sdp->c_connection = c_header;
else { else {
sdp_media_t *last_sdp_media = (sdp_media_t *) osip_list_get (&sdp->m_medias, i - 1); sdp_media_t *last_sdp_media = (sdp_media_t *) osip_list_get (&sdp->m_medias, i - 1);
osip_list_add (&last_sdp_media->c_connections, c_header, -1); osip_list_add (&last_sdp_media->c_connections, c_header, -1);
} }
if (crlf[1] == '\n') if (crlf[1] == '\n')
*next = crlf + 2; *next = crlf + 2;
else else
*next = crlf + 1; *next = crlf + 1;
return WF; return OSIP_WF;
} }
static int static int
sdp_message_parse_b (sdp_message_t * sdp, char *buf, char **next) sdp_message_parse_b (sdp_message_t * sdp, char *buf, char **next)
{ {
char *equal; char *equal;
char *crlf; char *crlf;
char *tmp; char *tmp;
char *tmp_next; char *tmp_next;
int i; int i;
skipping to change at line 911 skipping to change at line 912
else { else {
sdp_media_t *last_sdp_media = (sdp_media_t *) osip_list_get (&sdp->m_medias, i - 1); sdp_media_t *last_sdp_media = (sdp_media_t *) osip_list_get (&sdp->m_medias, i - 1);
osip_list_add (&last_sdp_media->b_bandwidths, b_header, -1); osip_list_add (&last_sdp_media->b_bandwidths, b_header, -1);
} }
if (crlf[1] == '\n') if (crlf[1] == '\n')
*next = crlf + 2; *next = crlf + 2;
else else
*next = crlf + 1; *next = crlf + 1;
return WF; return OSIP_WF;
} }
static int static int
sdp_message_parse_t (sdp_message_t * sdp, char *buf, char **next) sdp_message_parse_t (sdp_message_t * sdp, char *buf, char **next)
{ {
char *equal; char *equal;
char *crlf; char *crlf;
char *tmp; char *tmp;
char *tmp_next; char *tmp_next;
int i; int i;
skipping to change at line 974 skipping to change at line 975
} }
} }
/* add the new time_description header */ /* add the new time_description header */
osip_list_add (&sdp->t_descrs, t_header, -1); osip_list_add (&sdp->t_descrs, t_header, -1);
if (crlf[1] == '\n') if (crlf[1] == '\n')
*next = crlf + 2; *next = crlf + 2;
else else
*next = crlf + 1; *next = crlf + 1;
return WF; return OSIP_WF;
} }
static int static int
sdp_message_parse_r (sdp_message_t * sdp, char *buf, char **next) sdp_message_parse_r (sdp_message_t * sdp, char *buf, char **next)
{ {
char *equal; char *equal;
char *crlf; char *crlf;
int index; int index;
char *r_header; char *r_header;
sdp_time_descr_t *t_descr; sdp_time_descr_t *t_descr;
skipping to change at line 1025 skipping to change at line 1026
osip_strncpy (r_header, equal + 1, crlf - (equal + 1)); osip_strncpy (r_header, equal + 1, crlf - (equal + 1));
/* r field carry information for the last "t" field */ /* r field carry information for the last "t" field */
t_descr = (sdp_time_descr_t *) osip_list_get (&sdp->t_descrs, index - 1); t_descr = (sdp_time_descr_t *) osip_list_get (&sdp->t_descrs, index - 1);
osip_list_add (&t_descr->r_repeats, r_header, -1); osip_list_add (&t_descr->r_repeats, r_header, -1);
if (crlf[1] == '\n') if (crlf[1] == '\n')
*next = crlf + 2; *next = crlf + 2;
else else
*next = crlf + 1; *next = crlf + 1;
return WF; return OSIP_WF;
} }
static int static int
sdp_message_parse_z (sdp_message_t * sdp, char *buf, char **next) sdp_message_parse_z (sdp_message_t * sdp, char *buf, char **next)
{ {
char *equal; char *equal;
char *crlf; char *crlf;
char *z_header; char *z_header;
*next = buf; *next = buf;
skipping to change at line 1068 skipping to change at line 1069
if (z_header == NULL) if (z_header == NULL)
return OSIP_NOMEM; return OSIP_NOMEM;
osip_strncpy (z_header, equal + 1, crlf - (equal + 1)); osip_strncpy (z_header, equal + 1, crlf - (equal + 1));
sdp->z_adjustments = z_header; sdp->z_adjustments = z_header;
if (crlf[1] == '\n') if (crlf[1] == '\n')
*next = crlf + 2; *next = crlf + 2;
else else
*next = crlf + 1; *next = crlf + 1;
return WF; return OSIP_WF;
} }
static int static int
sdp_message_parse_k (sdp_message_t * sdp, char *buf, char **next) sdp_message_parse_k (sdp_message_t * sdp, char *buf, char **next)
{ {
char *equal; char *equal;
char *crlf; char *crlf;
int i; int i;
char *colon; char *colon;
sdp_key_t *k_header; sdp_key_t *k_header;
skipping to change at line 1158 skipping to change at line 1159
else { else {
sdp_media_t *last_sdp_media = (sdp_media_t *) osip_list_get (&sdp->m_medias, i - 1); sdp_media_t *last_sdp_media = (sdp_media_t *) osip_list_get (&sdp->m_medias, i - 1);
last_sdp_media->k_key = k_header; last_sdp_media->k_key = k_header;
} }
if (crlf[1] == '\n') if (crlf[1] == '\n')
*next = crlf + 2; *next = crlf + 2;
else else
*next = crlf + 1; *next = crlf + 1;
return WF; return OSIP_WF;
} }
static int static int
sdp_message_parse_a (sdp_message_t * sdp, char *buf, char **next) sdp_message_parse_a (sdp_message_t * sdp, char *buf, char **next)
{ {
char *equal; char *equal;
char *crlf; char *crlf;
char *tmp; char *tmp;
char *tmp_next; char *tmp_next;
int i; int i;
skipping to change at line 1249 skipping to change at line 1250
else { else {
sdp_media_t *last_sdp_media = (sdp_media_t *) osip_list_get (&sdp->m_medias, i - 1); sdp_media_t *last_sdp_media = (sdp_media_t *) osip_list_get (&sdp->m_medias, i - 1);
osip_list_add (&last_sdp_media->a_attributes, a_attribute, -1); osip_list_add (&last_sdp_media->a_attributes, a_attribute, -1);
} }
if (crlf[1] == '\n') if (crlf[1] == '\n')
*next = crlf + 2; *next = crlf + 2;
else else
*next = crlf + 1; *next = crlf + 1;
return WF; return OSIP_WF;
} }
static int static int
sdp_message_parse_m (sdp_message_t * sdp, char *buf, char **next) sdp_message_parse_m (sdp_message_t * sdp, char *buf, char **next)
{ {
char *equal; char *equal;
char *crlf; char *crlf;
char *tmp; char *tmp;
char *tmp_next; char *tmp_next;
int i; int i;
skipping to change at line 1392 skipping to change at line 1393
osip_list_add (&m_header->m_payloads, str, -1); osip_list_add (&m_header->m_payloads, str, -1);
} }
} }
osip_list_add (&sdp->m_medias, m_header, -1); osip_list_add (&sdp->m_medias, m_header, -1);
if (crlf[1] == '\n') if (crlf[1] == '\n')
*next = crlf + 2; *next = crlf + 2;
else else
*next = crlf + 1; *next = crlf + 1;
return WF; return OSIP_WF;
} }
int int
sdp_message_parse (sdp_message_t * sdp, const char *buf) sdp_message_parse (sdp_message_t * sdp, const char *buf)
{ {
/* In SDP, headers must be in the right order */ /* In SDP, headers must be in the right order */
/* This is a simple example /* This is a simple example
v=0 v=0
o=user1 53655765 2353687637 IN IP4 128.3.4.5 o=user1 53655765 2353687637 IN IP4 128.3.4.5
skipping to change at line 1658 skipping to change at line 1659
tmp = __osip_sdp_append_string (string, size, tmp, " "); tmp = __osip_sdp_append_string (string, size, tmp, " ");
tmp = __osip_sdp_append_string (string, size, tmp, conn->c_addr); tmp = __osip_sdp_append_string (string, size, tmp, conn->c_addr);
if (conn->c_addr_multicast_ttl != NULL) { if (conn->c_addr_multicast_ttl != NULL) {
tmp = __osip_sdp_append_string (string, size, tmp, "/"); tmp = __osip_sdp_append_string (string, size, tmp, "/");
tmp = __osip_sdp_append_string (string, size, tmp, conn->c_addr_multicast_tt l); tmp = __osip_sdp_append_string (string, size, tmp, conn->c_addr_multicast_tt l);
} }
if (conn->c_addr_multicast_int != NULL) { if (conn->c_addr_multicast_int != NULL) {
tmp = __osip_sdp_append_string (string, size, tmp, "/"); tmp = __osip_sdp_append_string (string, size, tmp, "/");
tmp = __osip_sdp_append_string (string, size, tmp, conn->c_addr_multicast_in t); tmp = __osip_sdp_append_string (string, size, tmp, conn->c_addr_multicast_in t);
} }
tmp = __osip_sdp_append_string (string, size, tmp, CRLF); tmp = __osip_sdp_append_string (string, size, tmp, OSIP_CRLF);
*next_tmp = tmp; *next_tmp = tmp;
return OSIP_SUCCESS; return OSIP_SUCCESS;
} }
static int static int
sdp_append_bandwidth (char **string, int *size, char *tmp, sdp_bandwidth_t * ban dwidth, char **next_tmp) sdp_append_bandwidth (char **string, int *size, char *tmp, sdp_bandwidth_t * ban dwidth, char **next_tmp)
{ {
if (bandwidth->b_bwtype == NULL) if (bandwidth->b_bwtype == NULL)
return -1; return -1;
if (bandwidth->b_bandwidth == NULL) if (bandwidth->b_bandwidth == NULL)
return -1; return -1;
tmp = __osip_sdp_append_string (string, size, tmp, "b="); tmp = __osip_sdp_append_string (string, size, tmp, "b=");
tmp = __osip_sdp_append_string (string, size, tmp, bandwidth->b_bwtype); tmp = __osip_sdp_append_string (string, size, tmp, bandwidth->b_bwtype);
tmp = __osip_sdp_append_string (string, size, tmp, ":"); tmp = __osip_sdp_append_string (string, size, tmp, ":");
tmp = __osip_sdp_append_string (string, size, tmp, bandwidth->b_bandwidth); tmp = __osip_sdp_append_string (string, size, tmp, bandwidth->b_bandwidth);
tmp = __osip_sdp_append_string (string, size, tmp, CRLF); tmp = __osip_sdp_append_string (string, size, tmp, OSIP_CRLF);
*next_tmp = tmp; *next_tmp = tmp;
return OSIP_SUCCESS; return OSIP_SUCCESS;
} }
static int static int
sdp_append_time_descr (char **string, int *size, char *tmp, sdp_time_descr_t * t ime_descr, char **next_tmp) sdp_append_time_descr (char **string, int *size, char *tmp, sdp_time_descr_t * t ime_descr, char **next_tmp)
{ {
int pos; int pos;
if (time_descr->t_start_time == NULL) if (time_descr->t_start_time == NULL)
return -1; return -1;
if (time_descr->t_stop_time == NULL) if (time_descr->t_stop_time == NULL)
return -1; return -1;
tmp = __osip_sdp_append_string (string, size, tmp, "t="); tmp = __osip_sdp_append_string (string, size, tmp, "t=");
tmp = __osip_sdp_append_string (string, size, tmp, time_descr->t_start_time); tmp = __osip_sdp_append_string (string, size, tmp, time_descr->t_start_time);
tmp = __osip_sdp_append_string (string, size, tmp, " "); tmp = __osip_sdp_append_string (string, size, tmp, " ");
tmp = __osip_sdp_append_string (string, size, tmp, time_descr->t_stop_time); tmp = __osip_sdp_append_string (string, size, tmp, time_descr->t_stop_time);
tmp = __osip_sdp_append_string (string, size, tmp, CRLF); tmp = __osip_sdp_append_string (string, size, tmp, OSIP_CRLF);
pos = 0; pos = 0;
while (!osip_list_eol (&time_descr->r_repeats, pos)) { while (!osip_list_eol (&time_descr->r_repeats, pos)) {
char *str = (char *) osip_list_get (&time_descr->r_repeats, pos); char *str = (char *) osip_list_get (&time_descr->r_repeats, pos);
tmp = __osip_sdp_append_string (string, size, tmp, "r="); tmp = __osip_sdp_append_string (string, size, tmp, "r=");
tmp = __osip_sdp_append_string (string, size, tmp, str); tmp = __osip_sdp_append_string (string, size, tmp, str);
tmp = __osip_sdp_append_string (string, size, tmp, CRLF); tmp = __osip_sdp_append_string (string, size, tmp, OSIP_CRLF);
pos++; pos++;
} }
*next_tmp = tmp; *next_tmp = tmp;
return OSIP_SUCCESS; return OSIP_SUCCESS;
} }
static int static int
sdp_append_key (char **string, int *size, char *tmp, sdp_key_t * key, char **nex t_tmp) sdp_append_key (char **string, int *size, char *tmp, sdp_key_t * key, char **nex t_tmp)
{ {
if (key->k_keytype == NULL) if (key->k_keytype == NULL)
return -1; return -1;
tmp = __osip_sdp_append_string (string, size, tmp, "k="); tmp = __osip_sdp_append_string (string, size, tmp, "k=");
tmp = __osip_sdp_append_string (string, size, tmp, key->k_keytype); tmp = __osip_sdp_append_string (string, size, tmp, key->k_keytype);
if (key->k_keydata != NULL) { if (key->k_keydata != NULL) {
tmp = __osip_sdp_append_string (string, size, tmp, ":"); tmp = __osip_sdp_append_string (string, size, tmp, ":");
tmp = __osip_sdp_append_string (string, size, tmp, key->k_keydata); tmp = __osip_sdp_append_string (string, size, tmp, key->k_keydata);
} }
tmp = __osip_sdp_append_string (string, size, tmp, CRLF); tmp = __osip_sdp_append_string (string, size, tmp, OSIP_CRLF);
*next_tmp = tmp; *next_tmp = tmp;
return OSIP_SUCCESS; return OSIP_SUCCESS;
} }
static int static int
sdp_append_attribute (char **string, int *size, char *tmp, sdp_attribute_t * att ribute, char **next_tmp) sdp_append_attribute (char **string, int *size, char *tmp, sdp_attribute_t * att ribute, char **next_tmp)
{ {
if (attribute->a_att_field == NULL) if (attribute->a_att_field == NULL)
return -1; return -1;
tmp = __osip_sdp_append_string (string, size, tmp, "a="); tmp = __osip_sdp_append_string (string, size, tmp, "a=");
tmp = __osip_sdp_append_string (string, size, tmp, attribute->a_att_field); tmp = __osip_sdp_append_string (string, size, tmp, attribute->a_att_field);
if (attribute->a_att_value != NULL) { if (attribute->a_att_value != NULL) {
tmp = __osip_sdp_append_string (string, size, tmp, ":"); tmp = __osip_sdp_append_string (string, size, tmp, ":");
tmp = __osip_sdp_append_string (string, size, tmp, attribute->a_att_value); tmp = __osip_sdp_append_string (string, size, tmp, attribute->a_att_value);
} }
tmp = __osip_sdp_append_string (string, size, tmp, CRLF); tmp = __osip_sdp_append_string (string, size, tmp, OSIP_CRLF);
*next_tmp = tmp; *next_tmp = tmp;
return OSIP_SUCCESS; return OSIP_SUCCESS;
} }
/* internal facility */ /* internal facility */
static int static int
sdp_append_media (char **string, int *size, char *tmp, sdp_media_t * media, char **next_tmp) sdp_append_media (char **string, int *size, char *tmp, sdp_media_t * media, char **next_tmp)
{ {
int pos; int pos;
skipping to change at line 1778 skipping to change at line 1779
tmp = __osip_sdp_append_string (string, size, tmp, " "); tmp = __osip_sdp_append_string (string, size, tmp, " ");
tmp = __osip_sdp_append_string (string, size, tmp, media->m_proto); tmp = __osip_sdp_append_string (string, size, tmp, media->m_proto);
pos = 0; pos = 0;
while (!osip_list_eol (&media->m_payloads, pos)) { while (!osip_list_eol (&media->m_payloads, pos)) {
char *str = (char *) osip_list_get (&media->m_payloads, pos); char *str = (char *) osip_list_get (&media->m_payloads, pos);
tmp = __osip_sdp_append_string (string, size, tmp, " "); tmp = __osip_sdp_append_string (string, size, tmp, " ");
tmp = __osip_sdp_append_string (string, size, tmp, str); tmp = __osip_sdp_append_string (string, size, tmp, str);
pos++; pos++;
} }
tmp = __osip_sdp_append_string (string, size, tmp, CRLF); tmp = __osip_sdp_append_string (string, size, tmp, OSIP_CRLF);
if (media->i_info != NULL) { if (media->i_info != NULL) {
tmp = __osip_sdp_append_string (string, size, tmp, "i="); tmp = __osip_sdp_append_string (string, size, tmp, "i=");
tmp = __osip_sdp_append_string (string, size, tmp, media->i_info); tmp = __osip_sdp_append_string (string, size, tmp, media->i_info);
tmp = __osip_sdp_append_string (string, size, tmp, CRLF); tmp = __osip_sdp_append_string (string, size, tmp, OSIP_CRLF);
} }
pos = 0; pos = 0;
while (!osip_list_eol (&media->c_connections, pos)) { while (!osip_list_eol (&media->c_connections, pos)) {
sdp_connection_t *conn = (sdp_connection_t *) osip_list_get (&media->c_conne ctions, pos); sdp_connection_t *conn = (sdp_connection_t *) osip_list_get (&media->c_conne ctions, pos);
char *next_tmp2; char *next_tmp2;
int i; int i;
i = sdp_append_connection (string, size, tmp, conn, &next_tmp2); i = sdp_append_connection (string, size, tmp, conn, &next_tmp2);
if (i != 0) if (i != 0)
skipping to change at line 1868 skipping to change at line 1869
return -1; */ return -1; */
size = BODY_MESSAGE_MAX_SIZE; size = BODY_MESSAGE_MAX_SIZE;
tmp = (char *) osip_malloc (size); tmp = (char *) osip_malloc (size);
if (tmp == NULL) if (tmp == NULL)
return OSIP_NOMEM; return OSIP_NOMEM;
string = tmp; string = tmp;
tmp = __osip_sdp_append_string (&string, &size, tmp, "v="); tmp = __osip_sdp_append_string (&string, &size, tmp, "v=");
tmp = __osip_sdp_append_string (&string, &size, tmp, sdp->v_version); tmp = __osip_sdp_append_string (&string, &size, tmp, sdp->v_version);
tmp = __osip_sdp_append_string (&string, &size, tmp, CRLF); tmp = __osip_sdp_append_string (&string, &size, tmp, OSIP_CRLF);
tmp = __osip_sdp_append_string (&string, &size, tmp, "o="); tmp = __osip_sdp_append_string (&string, &size, tmp, "o=");
tmp = __osip_sdp_append_string (&string, &size, tmp, sdp->o_username); tmp = __osip_sdp_append_string (&string, &size, tmp, sdp->o_username);
tmp = __osip_sdp_append_string (&string, &size, tmp, " "); tmp = __osip_sdp_append_string (&string, &size, tmp, " ");
tmp = __osip_sdp_append_string (&string, &size, tmp, sdp->o_sess_id); tmp = __osip_sdp_append_string (&string, &size, tmp, sdp->o_sess_id);
tmp = __osip_sdp_append_string (&string, &size, tmp, " "); tmp = __osip_sdp_append_string (&string, &size, tmp, " ");
tmp = __osip_sdp_append_string (&string, &size, tmp, sdp->o_sess_version); tmp = __osip_sdp_append_string (&string, &size, tmp, sdp->o_sess_version);
tmp = __osip_sdp_append_string (&string, &size, tmp, " "); tmp = __osip_sdp_append_string (&string, &size, tmp, " ");
tmp = __osip_sdp_append_string (&string, &size, tmp, sdp->o_nettype); tmp = __osip_sdp_append_string (&string, &size, tmp, sdp->o_nettype);
tmp = __osip_sdp_append_string (&string, &size, tmp, " "); tmp = __osip_sdp_append_string (&string, &size, tmp, " ");
tmp = __osip_sdp_append_string (&string, &size, tmp, sdp->o_addrtype); tmp = __osip_sdp_append_string (&string, &size, tmp, sdp->o_addrtype);
tmp = __osip_sdp_append_string (&string, &size, tmp, " "); tmp = __osip_sdp_append_string (&string, &size, tmp, " ");
tmp = __osip_sdp_append_string (&string, &size, tmp, sdp->o_addr); tmp = __osip_sdp_append_string (&string, &size, tmp, sdp->o_addr);
tmp = __osip_sdp_append_string (&string, &size, tmp, CRLF); tmp = __osip_sdp_append_string (&string, &size, tmp, OSIP_CRLF);
if (sdp->s_name != NULL) { if (sdp->s_name != NULL) {
tmp = __osip_sdp_append_string (&string, &size, tmp, "s="); tmp = __osip_sdp_append_string (&string, &size, tmp, "s=");
tmp = __osip_sdp_append_string (&string, &size, tmp, sdp->s_name); tmp = __osip_sdp_append_string (&string, &size, tmp, sdp->s_name);
tmp = __osip_sdp_append_string (&string, &size, tmp, CRLF); tmp = __osip_sdp_append_string (&string, &size, tmp, OSIP_CRLF);
} }
if (sdp->i_info != NULL) { if (sdp->i_info != NULL) {
tmp = __osip_sdp_append_string (&string, &size, tmp, "i="); tmp = __osip_sdp_append_string (&string, &size, tmp, "i=");
tmp = __osip_sdp_append_string (&string, &size, tmp, sdp->i_info); tmp = __osip_sdp_append_string (&string, &size, tmp, sdp->i_info);
tmp = __osip_sdp_append_string (&string, &size, tmp, CRLF); tmp = __osip_sdp_append_string (&string, &size, tmp, OSIP_CRLF);
} }
if (sdp->u_uri != NULL) { if (sdp->u_uri != NULL) {
tmp = __osip_sdp_append_string (&string, &size, tmp, "u="); tmp = __osip_sdp_append_string (&string, &size, tmp, "u=");
tmp = __osip_sdp_append_string (&string, &size, tmp, sdp->u_uri); tmp = __osip_sdp_append_string (&string, &size, tmp, sdp->u_uri);
tmp = __osip_sdp_append_string (&string, &size, tmp, CRLF); tmp = __osip_sdp_append_string (&string, &size, tmp, OSIP_CRLF);
} }
pos = 0; pos = 0;
while (!osip_list_eol (&sdp->e_emails, pos)) { while (!osip_list_eol (&sdp->e_emails, pos)) {
char *email = (char *) osip_list_get (&sdp->e_emails, pos); char *email = (char *) osip_list_get (&sdp->e_emails, pos);
tmp = __osip_sdp_append_string (&string, &size, tmp, "e="); tmp = __osip_sdp_append_string (&string, &size, tmp, "e=");
tmp = __osip_sdp_append_string (&string, &size, tmp, email); tmp = __osip_sdp_append_string (&string, &size, tmp, email);
tmp = __osip_sdp_append_string (&string, &size, tmp, CRLF); tmp = __osip_sdp_append_string (&string, &size, tmp, OSIP_CRLF);
pos++; pos++;
} }
pos = 0; pos = 0;
while (!osip_list_eol (&sdp->p_phones, pos)) { while (!osip_list_eol (&sdp->p_phones, pos)) {
char *phone = (char *) osip_list_get (&sdp->p_phones, pos); char *phone = (char *) osip_list_get (&sdp->p_phones, pos);
tmp = __osip_sdp_append_string (&string, &size, tmp, "p="); tmp = __osip_sdp_append_string (&string, &size, tmp, "p=");
tmp = __osip_sdp_append_string (&string, &size, tmp, phone); tmp = __osip_sdp_append_string (&string, &size, tmp, phone);
tmp = __osip_sdp_append_string (&string, &size, tmp, CRLF); tmp = __osip_sdp_append_string (&string, &size, tmp, OSIP_CRLF);
pos++; pos++;
} }
if (sdp->c_connection != NULL) { if (sdp->c_connection != NULL) {
char *next_tmp; char *next_tmp;
int i; int i;
i = sdp_append_connection (&string, &size, tmp, sdp->c_connection, &next_tmp ); i = sdp_append_connection (&string, &size, tmp, sdp->c_connection, &next_tmp );
if (i != 0) { if (i != 0) {
osip_free (string); osip_free (string);
return -1; return -1;
skipping to change at line 1959 skipping to change at line 1960
osip_free (string); osip_free (string);
return -1; return -1;
} }
tmp = next_tmp; tmp = next_tmp;
pos++; pos++;
} }
if (sdp->z_adjustments != NULL) { if (sdp->z_adjustments != NULL) {
tmp = __osip_sdp_append_string (&string, &size, tmp, "z="); tmp = __osip_sdp_append_string (&string, &size, tmp, "z=");
tmp = __osip_sdp_append_string (&string, &size, tmp, sdp->z_adjustments); tmp = __osip_sdp_append_string (&string, &size, tmp, sdp->z_adjustments);
tmp = __osip_sdp_append_string (&string, &size, tmp, CRLF); tmp = __osip_sdp_append_string (&string, &size, tmp, OSIP_CRLF);
} }
if (sdp->k_key != NULL) { if (sdp->k_key != NULL) {
char *next_tmp; char *next_tmp;
int i; int i;
i = sdp_append_key (&string, &size, tmp, sdp->k_key, &next_tmp); i = sdp_append_key (&string, &size, tmp, sdp->k_key, &next_tmp);
if (i != 0) { if (i != 0) {
osip_free (string); osip_free (string);
return -1; return -1;
 End of changes. 36 change blocks. 
35 lines changed or deleted 36 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)