Fork me on GitHub
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
sdp.c File Reference

SDP processing. More...

#include <netdb.h>
#include "janus.h"
#include "ice.h"
#include "sdp.h"
#include "utils.h"
#include "ip-utils.h"
#include "debug.h"
#include "events.h"
Include dependency graph for sdp.c:

Functions

janus_sdpjanus_sdp_preparse (void *ice_handle, const char *jsep_sdp, int *audio, int *video, int *data, char *error_str, size_t errlen)
 Method to pre-parse a session description to generate a Janus SDP instance. More...
 
int janus_sdp_process_remote (void *ice_handle, janus_sdp *remote_sdp, gboolean update)
 Method to process a remote parsed session description. More...
 
int janus_sdp_process_local (void *ice_handle, janus_sdp *remote_sdp, gboolean update)
 Method to process a local parsed session description. More...
 
int janus_sdp_parse_candidate (void *webrtc, const char *candidate, int trickle)
 Method to parse a single candidate. More...
 
int janus_sdp_parse_ssrc_group (void *m, const char *group_attr, int video)
 Method to parse a SSRC group attribute. More...
 
int janus_sdp_parse_ssrc (void *m, const char *ssrc_attr, int video)
 Method to parse a SSRC attribute. More...
 
int janus_sdp_anonymize (janus_sdp *anon)
 Method to strip/anonymize a session description. More...
 
char * janus_sdp_merge (void *ice_handle, janus_sdp *anon, gboolean offer)
 Method to merge a stripped session description and the right transport information. More...
 

Detailed Description

SDP processing.

Author
Lorenzo Miniero loren.nosp@m.zo@m.nosp@m.eetec.nosp@m.ho.c.nosp@m.om

Implementation of an SDP parser/merger/generator in the server. Each SDP coming from peers is stripped/anonymized before it is passed to the plugins: all DTLS/ICE/transport related information is removed, only leaving the relevant information in place. SDP coming from plugins is stripped/anonymized as well, and merged with the proper DTLS/ICE/transport information before it is sent to the peers. The actual SDP processing (parsing SDP strings, representation of SDP as an internal format, and so on) is done via the tools provided in sdp-utils.h.

Protocols

Function Documentation

int janus_sdp_anonymize ( janus_sdp sdp)

Method to strip/anonymize a session description.

Parameters
[in,out]sdpThe Janus SDP description object to strip/anonymize
Returns
0 in case of success, a non-zero integer in case of an error
char* janus_sdp_merge ( void *  handle,
janus_sdp sdp,
gboolean  offer 
)

Method to merge a stripped session description and the right transport information.

Parameters
[in]handleOpaque pointer to the ICE handle this session description is related to
[in]sdpThe Janus SDP description object to merge/enrich
[in]offerWhether the SDP is an offer or an answer
Returns
A string containing the full session description in case of success, NULL if the SDP is invalid
int janus_sdp_parse_candidate ( void *  webrtc,
const char *  candidate,
int  trickle 
)

Method to parse a single candidate.

This method will parse a single remote candidate provided by a peer, whether it is trickling or not

Parameters
[in]webrtcOpaque pointer to the WebRTC PeerConnection this candidate refers to
[in]candidateThe remote candidate to process
[in]trickleWhether this is a trickle candidate, or coming from the SDP
Returns
0 in case of success, a non-zero integer in case of an error
int janus_sdp_parse_ssrc ( void *  medium,
const char *  ssrc_attr,
int  video 
)

Method to parse a SSRC attribute.

This method will parse a SSRC attribute, and set it for the peer

Parameters
[in]mediumOpaque pointer to the medium this candidate refers to
[in]ssrc_attrThe SSRC attribute value to parse
[in]videoWhether this is a video SSRC or not
Returns
0 in case of success, a non-zero integer in case of an error
int janus_sdp_parse_ssrc_group ( void *  medium,
const char *  group_attr,
int  video 
)

Method to parse a SSRC group attribute.

This method will parse a SSRC group attribute, and set the parsed values for the peer

Parameters
[in]mediumOpaque pointer to the medium this candidate refers to
[in]group_attrThe SSRC group attribute value to parse
Returns
0 in case of success, a non-zero integer in case of an error
janus_sdp* janus_sdp_preparse ( void *  handle,
const char *  jsep_sdp,
int *  audio,
int *  video,
int *  data,
char *  error_str,
size_t  errlen 
)

Method to pre-parse a session description to generate a Janus SDP instance.

Parameters
[in]handleOpaque pointer to the ICE handle this session description will modify
[in]jsep_sdpThe SDP that the browser peer originated
[in,out]audioThe number of audio m-lines in the SDP
[in,out]videoThe number of video m-lines in the SDP
[in,out]dataThe number of data m-lines in the SDP
[in,out]error_strBuffer to receive a reason for an error, if any
[in]errlenThe length of the error buffer
Returns
The Janus SDP object in case of success, NULL in case the SDP is invalid
int janus_sdp_process_local ( void *  handle,
janus_sdp sdp,
gboolean  update 
)

Method to process a local parsed session description.

This method will process a session description coming from a plugin, and set up media accordingly

Parameters
[in]handleOpaque pointer to the ICE handle this session description will modify
[in]sdpThe Janus SDP object to process
[in]updateWhether this SDP is an update to an existing session or not
Returns
0 in case of success, -1 in case of an error
int janus_sdp_process_remote ( void *  handle,
janus_sdp sdp,
gboolean  update 
)

Method to process a remote parsed session description.

This method will process a session description coming from a peer, and set up the ICE candidates accordingly

Parameters
[in]handleOpaque pointer to the ICE handle this session description will modify
[in]sdpThe Janus SDP object to process
[in]updateWhether this SDP is an update to an existing session or not
Returns
0 in case of success, -1 in case of an error