Skip to content

Commit

Permalink
sdp: store msg body in streams and sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
razvancrainea committed Nov 22, 2017
1 parent d38e627 commit cb69431
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 8 additions & 4 deletions parser/sdp/sdp.c
Expand Up @@ -64,7 +64,7 @@ static inline sdp_info_t* new_sdp(void)
/**
* Alocate a new session cell.
*/
static inline sdp_session_cell_t *add_sdp_session(sdp_info_t* _sdp, int session_num, str* cnt_disp)
static inline sdp_session_cell_t *add_sdp_session(sdp_info_t* _sdp, int session_num, str* cnt_disp, str body)
{
sdp_session_cell_t *session;
int len;
Expand All @@ -83,6 +83,8 @@ static inline sdp_session_cell_t *add_sdp_session(sdp_info_t* _sdp, int session_
session->cnt_disp.len = cnt_disp->len;
}

session->body = body;

/* Insert the new session */
session->next = _sdp->sessions;
_sdp->sessions = session;
Expand All @@ -95,7 +97,7 @@ static inline sdp_session_cell_t *add_sdp_session(sdp_info_t* _sdp, int session_
* Allocate a new stream cell.
*/
static inline sdp_stream_cell_t *add_sdp_stream(sdp_session_cell_t* _session, int stream_num,
str* media, str* port, str* transport, str* payloads, int is_rtp, int pf, str* sdp_ip)
str* media, str* port, str* transport, str* payloads, int is_rtp, int pf, str* sdp_ip, str body)
{
sdp_stream_cell_t *stream;
int len;
Expand Down Expand Up @@ -125,6 +127,8 @@ static inline sdp_stream_cell_t *add_sdp_stream(sdp_session_cell_t* _session, in
stream->ip_addr.s = sdp_ip->s;
stream->ip_addr.len = sdp_ip->len;

stream->body = body;

/* Insert the new stream */
stream->next = _session->streams;
_session->streams = stream;
Expand Down Expand Up @@ -370,7 +374,7 @@ int parse_sdp_session(str *sdp_body, int session_num, str *cnt_disp, sdp_info_t*
return -1;
}
/* Allocate a session cell */
session = add_sdp_session(_sdp, session_num, cnt_disp);
session = add_sdp_session(_sdp, session_num, cnt_disp, body);
if (session == NULL) return -1;

/* Get origin IP */
Expand Down Expand Up @@ -442,7 +446,7 @@ int parse_sdp_session(str *sdp_body, int session_num, str *cnt_disp, sdp_info_t*
}

/* Allocate a stream cell */
stream = add_sdp_stream(session, stream_num, &sdp_media, &sdp_port, &sdp_transport, &sdp_payload, is_rtp, pf, &sdp_ip);
stream = add_sdp_stream(session, stream_num, &sdp_media, &sdp_port, &sdp_transport, &sdp_payload, is_rtp, pf, &sdp_ip, tmpstr1);
if (stream == 0) return -1;

/* increment total number of streams */
Expand Down
4 changes: 4 additions & 0 deletions parser/sdp/sdp.h
Expand Up @@ -46,6 +46,8 @@ typedef struct sdp_payload_attr {

typedef struct sdp_stream_cell {
struct sdp_stream_cell *next;
/**< body of the entire stream */
str body;
/* c=<network type> <address type> <connection address> */
/**< connection address family: AF_INET/AF_INET6 */
int pf;
Expand Down Expand Up @@ -93,6 +95,8 @@ typedef struct sdp_stream_cell {

typedef struct sdp_session_cell {
struct sdp_session_cell *next;
/**< body of the entire session */
str body;
/**< session index inside sdp */
int session_num;
/**< the Content-Disposition header (for Content-Type:multipart/mixed) */
Expand Down

0 comments on commit cb69431

Please sign in to comment.