Bug 805533 Send SDP parse errors through single function for reporting r=jesup

This commit is contained in:
Ethan Hugg 2012-10-26 13:05:50 -07:00
parent 8ef69d2aac
commit 8c9b130043
18 changed files with 1476 additions and 1685 deletions

View File

@ -74,7 +74,7 @@ typedef enum {
/* Forward references */
static cc_causes_t
gsmsdp_init_local_sdp (cc_sdp_t **sdp_pp);
gsmsdp_init_local_sdp (const char *peerconnection, cc_sdp_t **sdp_pp);
static void
gsmsdp_set_media_capability(fsmdef_media_t *media,
@ -2242,7 +2242,7 @@ gsmsdp_update_local_sdp_media (fsmdef_dcb_t *dcb_p, cc_sdp_t *cc_sdp_p,
if (sdp_p == NULL) {
gsmsdp_init_local_sdp(&(dcb_p->sdp));
gsmsdp_init_local_sdp(dcb_p->peerconnection, &(dcb_p->sdp));
cc_sdp_p = dcb_p->sdp;
if ((cc_sdp_p == NULL) || (cc_sdp_p->src_sdp == NULL)) {
@ -4393,6 +4393,7 @@ gsmsdp_get_offered_media_types (fsm_fcb_t *fcb_p, cc_sdp_t *sdp_p, boolean *has_
*
* Parameters:
*
* peerconnection - handle to peerconnection object
* sdp_pp - Pointer to the local sdp
*
* returns cc_causes_t
@ -4400,7 +4401,7 @@ gsmsdp_get_offered_media_types (fsm_fcb_t *fcb_p, cc_sdp_t *sdp_p, boolean *has_
* CC_CAUSE_ERROR - indicates failure
*/
static cc_causes_t
gsmsdp_init_local_sdp (cc_sdp_t **sdp_pp)
gsmsdp_init_local_sdp (const char *peerconnection, cc_sdp_t **sdp_pp)
{
char addr_str[MAX_IPADDR_STR_LEN];
cpr_ip_addr_t ipaddr;
@ -4413,7 +4414,7 @@ gsmsdp_init_local_sdp (cc_sdp_t **sdp_pp)
cpr_ip_mode_e ip_mode;
char *strtok_state;
if (!sdp_pp) {
if (!peerconnection || !sdp_pp) {
return CC_CAUSE_ERROR;
}
@ -4441,13 +4442,15 @@ gsmsdp_init_local_sdp (cc_sdp_t **sdp_pp)
* Create the local sdp struct
*/
if (*sdp_pp == NULL) {
sipsdp_src_dest_create(CCSIP_SRC_SDP_BIT, sdp_pp);
sipsdp_src_dest_create(peerconnection,
CCSIP_SRC_SDP_BIT, sdp_pp);
} else {
sdp_p = *sdp_pp;
if (sdp_p->src_sdp != NULL) {
sipsdp_src_dest_free(CCSIP_SRC_SDP_BIT, sdp_pp);
}
sipsdp_src_dest_create(CCSIP_SRC_SDP_BIT, sdp_pp);
sipsdp_src_dest_create(peerconnection,
CCSIP_SRC_SDP_BIT, sdp_pp);
}
sdp_p = *sdp_pp;
@ -4707,7 +4710,8 @@ gsmsdp_create_local_sdp (fsmdef_dcb_t *dcb_p, boolean force_streams_enabled,
int sdpmode = 0;
boolean media_enabled;
if ( CC_CAUSE_OK != gsmsdp_init_local_sdp(&(dcb_p->sdp)) )
if ( CC_CAUSE_OK != gsmsdp_init_local_sdp(dcb_p->peerconnection,
&(dcb_p->sdp)) )
return CC_CAUSE_ERROR;
config_get_value(CFGID_SDPMODE, &sdpmode, sizeof(sdpmode));
@ -4833,8 +4837,8 @@ gsmsdp_create_options_sdp (cc_sdp_t ** sdp_pp)
{
cc_sdp_t *sdp_p;
if (gsmsdp_init_local_sdp(sdp_pp) == CC_CAUSE_ERROR) {
/* This empty string represents to associated peerconnection object */
if (gsmsdp_init_local_sdp("", sdp_pp) == CC_CAUSE_ERROR) {
return;
}
@ -5586,7 +5590,8 @@ gsmsdp_encode_sdp_and_update_version (fsmdef_dcb_t *dcb_p, cc_msgbody_info_t *ms
if ( dcb_p->sdp == NULL || dcb_p->sdp->src_sdp == NULL )
{
if ( CC_CAUSE_OK != gsmsdp_init_local_sdp(&(dcb_p->sdp)) )
if ( CC_CAUSE_OK != gsmsdp_init_local_sdp(dcb_p->peerconnection,
&(dcb_p->sdp)) )
{
return CC_CAUSE_ERROR;
}
@ -5678,7 +5683,8 @@ gsmsdp_realloc_dest_sdp (fsmdef_dcb_t *dcb_p)
/* There are SDPs to process, prepare for parsing the SDP */
if (dcb_p->sdp == NULL) {
/* Create internal SDP information block with dest sdp block */
sipsdp_src_dest_create(CCSIP_DEST_SDP_BIT, &dcb_p->sdp);
sipsdp_src_dest_create(dcb_p->peerconnection,
CCSIP_DEST_SDP_BIT, &dcb_p->sdp);
} else {
/*
* SDP info. block exists, remove the previously received
@ -5688,7 +5694,8 @@ gsmsdp_realloc_dest_sdp (fsmdef_dcb_t *dcb_p)
if (dcb_p->sdp->dest_sdp) {
sipsdp_src_dest_free(CCSIP_DEST_SDP_BIT, &dcb_p->sdp);
}
sipsdp_src_dest_create(CCSIP_DEST_SDP_BIT, &dcb_p->sdp);
sipsdp_src_dest_create(dcb_p->peerconnection,
CCSIP_DEST_SDP_BIT, &dcb_p->sdp);
}
/* No SDP info block and parsed control block are available */
@ -5887,7 +5894,7 @@ gsmsdp_process_offer_sdp (fsm_fcb_t *fcb_p,
}
if (init) {
(void)gsmsdp_init_local_sdp(&(dcb_p->sdp));
(void)gsmsdp_init_local_sdp(dcb_p->peerconnection, &(dcb_p->sdp));
/* Note that there should not a previous version here as well */
}

View File

@ -24,7 +24,6 @@ typedef int cc_causes_t;
#define CC_CALL_NONE CC_CALL_TYPE_NONE
#define CC_CALL_INCOMING CC_CALL_TYPE_INCOMING
#define SDP_SIZE 4096 /* must increase this */
#define PC_HANDLE_SIZE 17 /* 8 random bytes in hex plus null */
#define CANDIDATE_SIZE 150
#define MID_SIZE 150

View File

@ -5,6 +5,7 @@
#ifndef _SDP_H_
#define _SDP_H_
#include "cc_constants.h"
#include "sdp_os_defs.h"
#include "ccsdp.h"
@ -510,6 +511,529 @@ typedef enum sdp_srtp_crypto_suite_t_ {
#define SDP_SRTP_F8_128_HMAC_SHA1_80_KEY_BYTES 16
#define SDP_SRTP_F8_128_HMAC_SHA1_80_SALT_BYTES 14
/* SDP Defines */
#define SDP_MAX_STRING_LEN 256 /* Max len for SDP string */
#define SDP_MAX_SHORT_STRING_LEN 12 /* Max len for a short SDP string */
#define SDP_MAX_PAYLOAD_TYPES 23 /* Max payload types in m= line */
#define SDP_TOKEN_LEN 2 /* Len of <token>= */
#define SDP_CURRENT_VERSION 0 /* Current default SDP version */
#define SDP_MAX_PORT_PARAMS 4 /* Max m= port params - x/x/x/x */
#define SDP_MIN_DYNAMIC_PAYLOAD 96 /* Min dynamic payload */
#define SDP_MAX_DYNAMIC_PAYLOAD 127 /* Max dynamic payload */
#define SDP_MIN_CIF_VALUE 1 /* applies to all QCIF,CIF,CIF4,CIF16,SQCIF */
#define SDP_MAX_CIF_VALUE 32 /* applies to all QCIF,CIF,CIF4,CIF16,SQCIF */
#define SDP_MAX_SRC_ADDR_LIST 1 /* Max source addrs for which filter applies */
#define SDP_DEFAULT_PACKETIZATION_MODE_VALUE 0 /* max packetization mode for H.264 */
#define SDP_MAX_PACKETIZATION_MODE_VALUE 2 /* max packetization mode for H.264 */
#define SDP_MAX_LEVEL_ASYMMETRY_ALLOWED_VALUE 1 /* max level asymmetry allowed value for H.264 */
#define SDP_DEFAULT_LEVEL_ASYMMETRY_ALLOWED_VALUE 1 /* default level asymmetry allowed value for H.264 */
#define SDP_INVALID_LEVEL_ASYMMETRY_ALLOWED_VALUE 2 /* invalid value for level-asymmetry-allowed param for H.264 */
/* Max number of stream ids that can be grouped together */
#define SDP_MAX_GROUP_STREAM_ID 10
#define SDP_MAGIC_NUM 0xabcdabcd
#define SDP_UNSUPPORTED "Unsupported"
#define SDP_MAX_LINE_LEN 256 /* Max len for SDP Line */
#define SDP_MAX_PROFILE_VALUE 10
#define SDP_MAX_LEVEL_VALUE 100
#define SDP_MIN_PROFILE_LEVEL_VALUE 0
#define SDP_MAX_TTL_VALUE 255
#define SDP_MIN_MCAST_ADDR_HI_BIT_VAL 224
#define SDP_MAX_MCAST_ADDR_HI_BIT_VAL 239
/* SDP Enum Types */
typedef enum {
SDP_ERR_INVALID_CONF_PTR,
SDP_ERR_INVALID_SDP_PTR,
SDP_ERR_INTERNAL,
SDP_MAX_ERR_TYPES
} sdp_errmsg_e;
/* SDP Structure Definitions */
/* String names of varios tokens */
typedef struct {
char *name;
u8 strlen;
} sdp_namearray_t;
/* c= line info */
typedef struct {
sdp_nettype_e nettype;
sdp_addrtype_e addrtype;
char conn_addr[SDP_MAX_STRING_LEN+1];
tinybool is_multicast;
u16 ttl;
u16 num_of_addresses;
} sdp_conn_t;
/* t= line info */
typedef struct sdp_timespec {
char start_time[SDP_MAX_STRING_LEN+1];
char stop_time[SDP_MAX_STRING_LEN+1];
struct sdp_timespec *next_p;
} sdp_timespec_t;
/* k= line info */
typedef struct sdp_encryptspec {
sdp_encrypt_type_e encrypt_type;
char encrypt_key[SDP_MAX_STRING_LEN+1];
} sdp_encryptspec_t;
/* FMTP attribute deals with named events in the range of 0-255 as
* defined in RFC 2833 */
#define SDP_MIN_NE_VALUE 0
#define SDP_MAX_NE_VALUES 256
#define SDP_NE_BITS_PER_WORD ( sizeof(u32) * 8 )
#define SDP_NE_NUM_BMAP_WORDS ((SDP_MAX_NE_VALUES + SDP_NE_BITS_PER_WORD - 1)/SDP_NE_BITS_PER_WORD )
#define SDP_NE_BIT_0 ( 0x00000001 )
#define SDP_NE_ALL_BITS ( 0xFFFFFFFF )
#define SDP_DEINT_BUF_REQ_FLAG 0x1
#define SDP_INIT_BUF_TIME_FLAG 0x2
#define SDP_MAX_RCMD_NALU_SIZE_FLAG 0x4
#define SDP_DEINT_BUF_CAP_FLAG 0x8
typedef struct sdp_fmtp {
u16 payload_num;
u32 maxval; /* maxval optimizes bmap search */
u32 bmap[ SDP_NE_NUM_BMAP_WORDS ];
sdp_fmtp_format_type_e fmtp_format; /* Gives the format type
for FMTP attribute*/
tinybool annexb_required;
tinybool annexa_required;
tinybool annexa;
tinybool annexb;
u32 bitrate;
u32 mode;
/* some OPUS specific fmtp params */
u32 maxaveragebitrate;
u16 usedtx;
u16 stereo;
u16 useinbandfec;
char maxcodedaudiobandwidth[SDP_MAX_STRING_LEN+1];
u16 cbr;
/* some Data Channel specific fmtp params */
u16 streams; /* Num streams per Data Channel */
char protocol[SDP_MAX_STRING_LEN+1];
/* BEGIN - All Video related FMTP parameters */
u16 qcif;
u16 cif;
u16 maxbr;
u16 sqcif;
u16 cif4;
u16 cif16;
u16 custom_x;
u16 custom_y;
u16 custom_mpi;
/* CUSTOM=360,240,4 implies X-AXIS=360, Y-AXIS=240; MPI=4 */
u16 par_width;
u16 par_height;
/* PAR=12:11 implies par_width=12, par_height=11 */
/* CPCF should be a float. IOS does not support float and so it is u16 */
/* For portable stack, CPCF should be defined as float and the parsing should
* be modified accordingly */
u16 cpcf;
u16 bpp;
u16 hrd;
int16 profile;
int16 level;
tinybool is_interlace;
/* some more H.264 specific fmtp params */
char profile_level_id[SDP_MAX_STRING_LEN+1];
char parameter_sets[SDP_MAX_STRING_LEN+1];
u16 packetization_mode;
u16 level_asymmetry_allowed;
u16 interleaving_depth;
u32 deint_buf_req;
u32 max_don_diff;
u32 init_buf_time;
u32 max_mbps;
u32 max_fs;
u32 max_cpb;
u32 max_dpb;
u32 max_br;
tinybool redundant_pic_cap;
u32 deint_buf_cap;
u32 max_rcmd_nalu_size;
tinybool parameter_add;
tinybool annex_d;
tinybool annex_f;
tinybool annex_i;
tinybool annex_j;
tinybool annex_t;
/* H.263 codec requires annex K,N and P to have values */
u16 annex_k_val;
u16 annex_n_val;
/* Annex P can take one or more values in the range 1-4 . e.g P=1,3 */
u16 annex_p_val_picture_resize; /* 1 = four; 2 = sixteenth */
u16 annex_p_val_warp; /* 3 = half; 4=sixteenth */
u8 flag;
/* END - All Video related FMTP parameters */
} sdp_fmtp_t;
/* a=qos|secure|X-pc-qos|X-qos info */
typedef struct sdp_qos {
sdp_qos_strength_e strength;
sdp_qos_dir_e direction;
tinybool confirm;
sdp_qos_status_types_e status_type;
} sdp_qos_t;
/* a=curr:qos status_type direction */
typedef struct sdp_curr {
sdp_curr_type_e type;
sdp_qos_status_types_e status_type;
sdp_qos_dir_e direction;
} sdp_curr_t;
/* a=des:qos strength status_type direction */
typedef struct sdp_des {
sdp_des_type_e type;
sdp_qos_strength_e strength;
sdp_qos_status_types_e status_type;
sdp_qos_dir_e direction;
} sdp_des_t;
/* a=conf:qos status_type direction */
typedef struct sdp_conf {
sdp_conf_type_e type;
sdp_qos_status_types_e status_type;
sdp_qos_dir_e direction;
} sdp_conf_t;
/* a=rtpmap or a=sprtmap info */
typedef struct sdp_transport_map {
u16 payload_num;
char encname[SDP_MAX_STRING_LEN+1];
u32 clockrate;
u16 num_chan;
} sdp_transport_map_t;
/* a=rtr info */
typedef struct sdp_rtr {
tinybool confirm;
} sdp_rtr_t;
/* a=subnet info */
typedef struct sdp_subnet {
sdp_nettype_e nettype;
sdp_addrtype_e addrtype;
char addr[SDP_MAX_STRING_LEN+1];
int32 prefix;
} sdp_subnet_t;
/* a=X-pc-codec info */
typedef struct sdp_pccodec {
u16 num_payloads;
ushort payload_type[SDP_MAX_PAYLOAD_TYPES];
} sdp_pccodec_t;
/* a=direction info */
typedef struct sdp_comediadir {
sdp_mediadir_role_e role;
tinybool conn_info_present;
sdp_conn_t conn_info;
u32 src_port;
} sdp_comediadir_t;
/* a=silenceSupp info */
typedef struct sdp_silencesupp {
tinybool enabled;
tinybool timer_null;
u16 timer;
sdp_silencesupp_pref_e pref;
sdp_silencesupp_siduse_e siduse;
tinybool fxnslevel_null;
u8 fxnslevel;
} sdp_silencesupp_t;
/*
* a=mptime info */
/* Note that an interval value of zero corresponds to
* the "-" syntax on the a= line.
*/
typedef struct sdp_mptime {
u16 num_intervals;
ushort intervals[SDP_MAX_PAYLOAD_TYPES];
} sdp_mptime_t;
/*
* a=X-sidin:<val>, a=X-sidout:< val> and a=X-confid: <val>
* Stream Id,ConfID related attributes to be used for audio/video conferencing
*
*/
typedef struct sdp_stream_data {
char x_sidin[SDP_MAX_STRING_LEN+1];
char x_sidout[SDP_MAX_STRING_LEN+1];
char x_confid[SDP_MAX_STRING_LEN+1];
sdp_group_attr_e group_attr; /* FID or LS */
u16 num_group_id;
u16 group_id_arr[SDP_MAX_GROUP_STREAM_ID];
} sdp_stream_data_t;
/*
* a=source-filter:<filter-mode> <filter-spec>
* <filter-spec> = <nettype> <addrtype> <dest-addr> <src_addr><src_addr>...
* One or more source addresses to apply filter, for one or more connection
* address in unicast/multicast environments
*/
typedef struct sdp_source_filter {
sdp_src_filter_mode_e mode;
sdp_nettype_e nettype;
sdp_addrtype_e addrtype;
char dest_addr[SDP_MAX_STRING_LEN+1];
u16 num_src_addr;
char src_list[SDP_MAX_SRC_ADDR_LIST+1][SDP_MAX_STRING_LEN+1];
} sdp_source_filter_t;
/*
* b=<bw-modifier>:<val>
*
*/
typedef struct sdp_bw_data {
struct sdp_bw_data *next_p;
sdp_bw_modifier_e bw_modifier;
int bw_val;
} sdp_bw_data_t;
/*
* This structure houses a linked list of sdp_bw_data_t instances. Each
* sdp_bw_data_t instance represents one b= line.
*/
typedef struct sdp_bw {
u16 bw_data_count;
sdp_bw_data_t *bw_data_list;
} sdp_bw_t;
/* Media lines for AAL2 may have more than one transport type defined
* each with its own payload type list. These are referred to as
* profile types instead of transport types. This structure is used
* to handle these multiple profile types. Note: One additional profile
* field is needed because of the way parsing is done. This is not an
* error. */
typedef struct sdp_media_profiles {
u16 num_profiles;
sdp_transport_e profile[SDP_MAX_PROFILES+1];
u16 num_payloads[SDP_MAX_PROFILES];
sdp_payload_ind_e payload_indicator[SDP_MAX_PROFILES][SDP_MAX_PAYLOAD_TYPES];
u16 payload_type[SDP_MAX_PROFILES][SDP_MAX_PAYLOAD_TYPES];
} sdp_media_profiles_t;
/*
* sdp_srtp_crypto_context_t
* This type is used to hold cryptographic context information.
*
*/
typedef struct sdp_srtp_crypto_context_t_ {
int32 tag;
unsigned long selection_flags;
sdp_srtp_crypto_suite_t suite;
unsigned char master_key[SDP_SRTP_MAX_KEY_SIZE_BYTES];
unsigned char master_salt[SDP_SRTP_MAX_SALT_SIZE_BYTES];
unsigned char master_key_size_bytes;
unsigned char master_salt_size_bytes;
unsigned long ssrc; /* not used */
unsigned long roc; /* not used */
unsigned long kdr; /* not used */
unsigned short seq; /* not used */
sdp_srtp_fec_order_t fec_order; /* not used */
unsigned char master_key_lifetime[SDP_SRTP_MAX_LIFETIME_BYTES];
unsigned char mki[SDP_SRTP_MAX_MKI_SIZE_BYTES];
u16 mki_size_bytes;
char* session_parameters;
} sdp_srtp_crypto_context_t;
/* m= line info and associated attribute list */
/* Note: Most of the port parameter values are 16-bit values. We set
* the type to int32 so we can return either a 16-bit value or the
* choose value. */
typedef struct sdp_mca {
sdp_media_e media;
sdp_conn_t conn;
sdp_transport_e transport;
sdp_port_format_e port_format;
int32 port;
int32 sctpport;
int32 num_ports;
int32 vpi;
u32 vci; /* VCI needs to be 32-bit */
int32 vcci;
int32 cid;
u16 num_payloads;
sdp_payload_ind_e payload_indicator[SDP_MAX_PAYLOAD_TYPES];
u16 payload_type[SDP_MAX_PAYLOAD_TYPES];
sdp_media_profiles_t *media_profiles_p;
tinybool sessinfo_found;
sdp_encryptspec_t encrypt;
sdp_bw_t bw;
sdp_attr_e media_direction; /* Either INACTIVE, SENDONLY,
RECVONLY, or SENDRECV */
u32 mid;
struct sdp_attr *media_attrs_p;
struct sdp_mca *next_p;
} sdp_mca_t;
/* generic a= line info */
typedef struct sdp_attr {
sdp_attr_e type;
union {
tinybool boolean_val;
u32 u32_val;
char string_val[SDP_MAX_STRING_LEN+1];
char ice_attr[SDP_MAX_STRING_LEN+1];
sdp_fmtp_t fmtp;
sdp_qos_t qos;
sdp_curr_t curr;
sdp_des_t des;
sdp_conf_t conf;
sdp_transport_map_t transport_map; /* A rtpmap or sprtmap */
sdp_subnet_t subnet;
sdp_t38_ratemgmt_e t38ratemgmt;
sdp_t38_udpec_e t38udpec;
sdp_pccodec_t pccodec;
sdp_silencesupp_t silencesupp;
sdp_mca_t *cap_p; /* A X-CAP or CDSC attribute */
sdp_rtr_t rtr;
sdp_comediadir_t comediadir;
sdp_srtp_crypto_context_t srtp_context;
sdp_mptime_t mptime;
sdp_stream_data_t stream_data;
char unknown[SDP_MAX_STRING_LEN+1];
sdp_source_filter_t source_filter;
} attr;
struct sdp_attr *next_p;
} sdp_attr_t;
typedef struct sdp_srtp_crypto_suite_list_ {
sdp_srtp_crypto_suite_t crypto_suite_val;
char * crypto_suite_str;
unsigned char key_size_bytes;
unsigned char salt_size_bytes;
} sdp_srtp_crypto_suite_list;
/* Application configuration options */
typedef struct sdp_conf_options {
u32 magic_num;
tinybool debug_flag[SDP_MAX_DEBUG_TYPES];
tinybool version_reqd;
tinybool owner_reqd;
tinybool session_name_reqd;
tinybool timespec_reqd;
tinybool media_supported[SDP_MAX_MEDIA_TYPES];
tinybool nettype_supported[SDP_MAX_NETWORK_TYPES];
tinybool addrtype_supported[SDP_MAX_ADDR_TYPES];
tinybool transport_supported[SDP_MAX_TRANSPORT_TYPES];
tinybool allow_choose[SDP_MAX_CHOOSE_PARAMS];
/* Statistics counts */
u32 num_builds;
u32 num_parses;
u32 num_not_sdp_desc;
u32 num_invalid_token_order;
u32 num_invalid_param;
u32 num_no_resource;
struct sdp_conf_options *next_p;
} sdp_conf_options_t;
/* Session level SDP info with pointers to media line info. */
/* Elements here that can only be one of are included directly. Elements */
/* that can be more than one are pointers. */
typedef struct {
char peerconnection[PC_HANDLE_SIZE];
u32 magic_num;
sdp_conf_options_t *conf_p;
tinybool debug_flag[SDP_MAX_DEBUG_TYPES];
char debug_str[SDP_MAX_STRING_LEN+1];
u32 debug_id;
int32 version; /* version is really a u16 */
char owner_name[SDP_MAX_STRING_LEN+1];
char owner_sessid[SDP_MAX_STRING_LEN+1];
char owner_version[SDP_MAX_STRING_LEN+1];
sdp_nettype_e owner_network_type;
sdp_addrtype_e owner_addr_type;
char owner_addr[SDP_MAX_STRING_LEN+1];
char sessname[SDP_MAX_STRING_LEN+1];
tinybool sessinfo_found;
tinybool uri_found;
sdp_conn_t default_conn;
sdp_timespec_t *timespec_p;
sdp_encryptspec_t encrypt;
sdp_bw_t bw;
sdp_attr_t *sess_attrs_p;
/* Info to help with building capability attributes. */
u16 cur_cap_num;
sdp_mca_t *cur_cap_p;
/* Info to help parsing X-cpar attrs. */
u16 cap_valid;
u16 last_cap_inst;
/* Info to help building X-cpar/cpar attrs. */
sdp_attr_e last_cap_type;
/* MCA - Media, connection, and attributes */
sdp_mca_t *mca_p;
ushort mca_count;
} sdp_t;
/* Token processing table. */
typedef struct {
char *name;
sdp_result_e (*parse_func)(sdp_t *sdp_p, u16 level, const char *ptr);
sdp_result_e (*build_func)(sdp_t *sdp_p, u16 level, flex_string *fs);
} sdp_tokenarray_t;
/* Attribute processing table. */
typedef struct {
char *name;
u16 strlen;
sdp_result_e (*parse_func)(sdp_t *sdp_p, sdp_attr_t *attr_p,
const char *ptr);
sdp_result_e (*build_func)(sdp_t *sdp_p, sdp_attr_t *attr_p,
flex_string *fs);
} sdp_attrarray_t;
/* Prototypes */
@ -534,13 +1058,14 @@ extern void sdp_allow_choose(void *config_p, sdp_choose_param_e param,
tinybool choose_allowed);
/* sdp_main.c */
extern void *sdp_init_description(void *config_p);
extern void sdp_debug(void *sdp_ptr, sdp_debug_e debug_type, tinybool debug_flag);
extern void sdp_set_string_debug(void *sdp_ptr, char *debug_str);
extern sdp_result_e sdp_parse(void *sdp_ptr, char **bufp, u16 len);
extern sdp_result_e sdp_build(void *sdp_ptr, flex_string *fs);
extern void *sdp_copy(void *sdp_ptr);
extern sdp_result_e sdp_free_description(void *sdp_ptr);
extern sdp_t *sdp_init_description(const char *peerconnection, void *config_p);
extern void sdp_debug(sdp_t *sdp_ptr, sdp_debug_e debug_type, tinybool debug_flag);
extern void sdp_set_string_debug(sdp_t *sdp_ptr, const char *debug_str);
extern sdp_result_e sdp_parse(sdp_t *sdp_ptr, char **bufp, u16 len);
extern sdp_result_e sdp_build(sdp_t *sdp_ptr, flex_string *fs);
extern sdp_t *sdp_copy(sdp_t *sdp_ptr);
extern sdp_result_e sdp_free_description(sdp_t *sdp_ptr);
extern void sdp_parse_error(const char *peerconnection, const char *format, ...);
extern const char *sdp_get_result_name(sdp_result_e rc);

View File

@ -7,6 +7,9 @@
#include "sdp_private.h"
#include "ccsip_sdp.h"
#include "rtp_defs.h"
#include "CSFLog.h"
static const char* logTag = "sdp_access";
/* Function: sdp_find_media_level
* Description: Find and return a pointer to the specified media level,
@ -1325,7 +1328,7 @@ int32 sdp_get_media_portnum (void *sdp_ptr, u16 level)
(mca_p->port_format != SDP_PORT_NUM_VPI_VCI) &&
(mca_p->port_format != SDP_PORT_NUM_VPI_VCI_CID)) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Port num not valid for media line %u",
CSFLogError(logTag, "%s Port num not valid for media line %u",
sdp_p->debug_str, level);
}
sdp_p->conf_p->num_invalid_param++;
@ -1360,7 +1363,7 @@ int32 sdp_get_media_portcount (void *sdp_ptr, u16 level)
/* Make sure port number is valid for the specified format. */
if (mca_p->port_format != SDP_PORT_NUM_COUNT) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Port count not valid for media line %u",
CSFLogError(logTag, "%s Port count not valid for media line %u",
sdp_p->debug_str, level);
}
sdp_p->conf_p->num_invalid_param++;
@ -1397,7 +1400,7 @@ int32 sdp_get_media_vpi (void *sdp_ptr, u16 level)
(mca_p->port_format != SDP_PORT_NUM_VPI_VCI) &&
(mca_p->port_format != SDP_PORT_NUM_VPI_VCI_CID)) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s VPI not valid for media line %u",
CSFLogError(logTag, "%s VPI not valid for media line %u",
sdp_p->debug_str, level);
}
sdp_p->conf_p->num_invalid_param++;
@ -1434,7 +1437,7 @@ u32 sdp_get_media_vci (void *sdp_ptr, u16 level)
(mca_p->port_format != SDP_PORT_NUM_VPI_VCI) &&
(mca_p->port_format != SDP_PORT_NUM_VPI_VCI_CID)) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s VCI not valid for media line %u",
CSFLogError(logTag, "%s VCI not valid for media line %u",
sdp_p->debug_str, level);
}
sdp_p->conf_p->num_invalid_param++;
@ -1470,7 +1473,7 @@ int32 sdp_get_media_vcci (void *sdp_ptr, u16 level)
if ((mca_p->port_format != SDP_PORT_VCCI) &&
(mca_p->port_format != SDP_PORT_VCCI_CID)) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s VCCI not valid for media line %u",
CSFLogError(logTag, "%s VCCI not valid for media line %u",
sdp_p->debug_str, level);
}
sdp_p->conf_p->num_invalid_param++;
@ -1506,7 +1509,7 @@ int32 sdp_get_media_cid (void *sdp_ptr, u16 level)
if ((mca_p->port_format != SDP_PORT_VCCI_CID) &&
(mca_p->port_format != SDP_PORT_NUM_VPI_VCI_CID)) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s CID not valid for media line %u",
CSFLogError(logTag, "%s CID not valid for media line %u",
sdp_p->debug_str, level);
}
sdp_p->conf_p->num_invalid_param++;
@ -1822,7 +1825,7 @@ sdp_result_e sdp_insert_media_line (void *sdp_ptr, u16 level)
if ((level < 1) || (level > (sdp_p->mca_count+1))) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Invalid media line (%u) to insert, max is "
CSFLogError(logTag, "%s Invalid media line (%u) to insert, max is "
"(%u).", sdp_p->debug_str, level, sdp_p->mca_count);
}
sdp_p->conf_p->num_invalid_param++;
@ -2229,7 +2232,7 @@ sdp_result_e sdp_add_media_profile (void *sdp_ptr, u16 level,
if (mca_p->media_profiles_p->num_profiles >= SDP_MAX_PROFILES) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Max number of media profiles already specified"
CSFLogError(logTag, "%s Max number of media profiles already specified"
" for media level %u", sdp_p->debug_str, level);
}
sdp_p->conf_p->num_invalid_param++;
@ -2272,7 +2275,7 @@ sdp_result_e sdp_add_media_payload_type (void *sdp_ptr, u16 level,
if (mca_p->num_payloads == SDP_MAX_PAYLOAD_TYPES) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Max number of payload types already defined "
CSFLogError(logTag, "%s Max number of payload types already defined "
"for media line %u", sdp_p->debug_str, level);
}
sdp_p->conf_p->num_invalid_param++;
@ -2317,7 +2320,7 @@ sdp_result_e sdp_add_media_profile_payload_type (void *sdp_ptr, u16 level,
if ((prof_num < 1) ||
(prof_num > mca_p->media_profiles_p->num_profiles)) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Invalid profile number (%u) for set profile "
CSFLogError(logTag, "%s Invalid profile number (%u) for set profile "
" payload type", sdp_p->debug_str, level);
}
sdp_p->conf_p->num_invalid_param++;
@ -2327,7 +2330,7 @@ sdp_result_e sdp_add_media_profile_payload_type (void *sdp_ptr, u16 level,
if (mca_p->media_profiles_p->num_payloads[prof_num-1] ==
SDP_MAX_PAYLOAD_TYPES) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Max number of profile payload types already "
CSFLogError(logTag, "%s Max number of profile payload types already "
"defined profile %u on media line %u",
sdp_p->debug_str, prof_num, level);
}
@ -2429,7 +2432,7 @@ sdp_result_e sdp_copy_all_bw_lines (void *src_sdp_ptr, void *dst_sdp_ptr,
mca_p = sdp_find_media_level(src_sdp_p, src_level);
if (mca_p == NULL) {
if (src_sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Invalid src media level (%u) for copy all "
CSFLogError(logTag, "%s Invalid src media level (%u) for copy all "
"attrs ", src_sdp_p->debug_str, src_level);
}
return (SDP_INVALID_PARAMETER);
@ -2444,7 +2447,7 @@ sdp_result_e sdp_copy_all_bw_lines (void *src_sdp_ptr, void *dst_sdp_ptr,
mca_p = sdp_find_media_level(dst_sdp_p, dst_level);
if (mca_p == NULL) {
if (src_sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Invalid dst media level (%u) for copy all "
CSFLogError(logTag, "%s Invalid dst media level (%u) for copy all "
"attrs ", src_sdp_p->debug_str, dst_level);
}
return (SDP_INVALID_PARAMETER);
@ -2725,7 +2728,7 @@ sdp_result_e sdp_delete_bw_line (void *sdp_ptr, u16 level, u16 inst_num)
if (bw_data_p == NULL) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s bw line instance %d not found.",
CSFLogError(logTag, "%s bw line instance %d not found.",
sdp_p->debug_str, inst_num);
}
sdp_p->conf_p->num_invalid_param++;
@ -2772,7 +2775,7 @@ sdp_result_e sdp_set_bw (void *sdp_ptr, u16 level, u16 inst_num,
if ((bw_modifier < SDP_BW_MODIFIER_AS) ||
(bw_modifier >= SDP_MAX_BW_MODIFIER_VAL)) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Invalid bw modifier type: %d.",
CSFLogError(logTag, "%s Invalid bw modifier type: %d.",
sdp_p->debug_str, bw_modifier);
}
sdp_p->conf_p->num_invalid_param++;
@ -2782,7 +2785,7 @@ sdp_result_e sdp_set_bw (void *sdp_ptr, u16 level, u16 inst_num,
bw_data_p = sdp_find_bw_line(sdp_p, level, inst_num);
if (bw_data_p == NULL) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s The %u instance of a b= line was not found at level %u.",
CSFLogError(logTag, "%s The %u instance of a b= line was not found at level %u.",
sdp_p->debug_str, inst_num, level);
}
sdp_p->conf_p->num_invalid_param++;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,9 @@
#include "sdp_os_defs.h"
#include "sdp.h"
#include "sdp_private.h"
#include "CSFLog.h"
static const char* logTag = "sdp_config";
/* Function: sdp_verify_conf_ptr
* Description: Verify the configuration pointer is valid by checking for
@ -21,7 +23,7 @@ tinybool sdp_verify_conf_ptr (sdp_conf_options_t *conf_p)
if ((conf_p != NULL) && (conf_p->magic_num == SDP_MAGIC_NUM)) {
return (TRUE);
} else {
sdp_log_errmsg(SDP_ERR_INVALID_CONF_PTR, NULL);
CSFLogError(logTag, "SDP: Invalid Config pointer.");
return (FALSE);
}
}

View File

@ -5,7 +5,9 @@
#include "sdp_os_defs.h"
#include "sdp.h"
#include "sdp_private.h"
#include "CSFLog.h"
static const char* logTag = "sdp_main";
/* Note: These *must* be in the same order as the enum types. */
const sdp_tokenarray_t sdp_token[SDP_MAX_TOKENS] =
@ -710,7 +712,7 @@ inline tinybool sdp_verify_sdp_ptr (sdp_t *sdp_p)
if ((sdp_p != NULL) && (sdp_p->magic_num == SDP_MAGIC_NUM)) {
return (TRUE);
} else {
sdp_log_errmsg(SDP_ERR_INVALID_SDP_PTR, NULL);
CSFLogError(logTag, "SDP: Invalid SDP pointer.");
return (FALSE);
}
}
@ -725,7 +727,7 @@ inline tinybool sdp_verify_sdp_ptr (sdp_t *sdp_p)
* Parameters: config_p The config handle returned by sdp_init_config
* Returns: A handle for a new SDP structure as a void ptr.
*/
void *sdp_init_description (void *config_p)
sdp_t *sdp_init_description (const char *peerconnection, void *config_p)
{
int i;
sdp_t *sdp_p;
@ -740,6 +742,8 @@ void *sdp_init_description (void *config_p)
return (NULL);
}
sstrncpy(sdp_p->peerconnection, peerconnection, sizeof(sdp_p->peerconnection));
/* Initialize magic number. */
sdp_p->magic_num = SDP_MAGIC_NUM;
@ -779,7 +783,7 @@ void *sdp_init_description (void *config_p)
}
/* Function: void sdp_debug(void *sdp_p, sdp_debug_e debug_type,
/* Function: void sdp_debug(sdp_t *sdp_p, sdp_debug_e debug_type,
* tinybool my_bool);
* Description: Define the type of debug for this particular SDP structure.
* By default, each SDP description has the settings that are
@ -792,10 +796,8 @@ void *sdp_init_description (void *config_p)
* my_bool Defines whether the debug should be enabled or not.
* Returns: Nothing.
*/
void sdp_debug (void *sdp_ptr, sdp_debug_e debug_type, tinybool debug_flag)
void sdp_debug (sdp_t *sdp_p, sdp_debug_e debug_type, tinybool debug_flag)
{
sdp_t *sdp_p = (sdp_t *)sdp_ptr;
if (sdp_verify_sdp_ptr(sdp_p) == FALSE) {
return;
}
@ -806,20 +808,18 @@ void sdp_debug (void *sdp_ptr, sdp_debug_e debug_type, tinybool debug_flag)
}
/* Function: void sdp_set_string_debug(void *sdp_p, char *debug_str)
/* Function: void sdp_set_string_debug(sdp_t *sdp_p, char *debug_str)
* Description: Define a string to be associated with all debug output
* for this SDP. The string will be copied into the SDP
* structure and so the library will not be dependent on
* the application's memory for this string.
* Parameters: sdp_ptr The SDP handle returned by sdp_init_description.
* Parameters: sdp_p The SDP handle returned by sdp_init_description.
* debug_str Pointer to a string that should be printed out
* with every debug msg.
* Returns: Nothing.
*/
void sdp_set_string_debug (void *sdp_ptr, char *debug_str)
void sdp_set_string_debug (sdp_t *sdp_p, const char *debug_str)
{
sdp_t *sdp_p = (sdp_t *)sdp_ptr;
if (sdp_verify_sdp_ptr(sdp_p) == FALSE) {
return;
}
@ -846,11 +846,10 @@ sdp_result_e sdp_validate_sdp (sdp_t *sdp_p)
num_media_levels = sdp_get_num_media_lines((void *)sdp_p);
for (i=1; i <= num_media_levels; i++) {
if (sdp_connection_valid((void *)sdp_p, (unsigned short)i) == FALSE) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s c= connection line not specified for "
"every media level, validation failed.",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s c= connection line not specified for "
"every media level, validation failed.",
sdp_p->debug_str);
return (SDP_FAILURE);
}
}
@ -859,28 +858,25 @@ sdp_result_e sdp_validate_sdp (sdp_t *sdp_p)
/* Validate required lines were specified */
if ((sdp_owner_valid((void *)sdp_p) == FALSE) &&
(sdp_p->conf_p->owner_reqd == TRUE)) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s o= owner line not specified, validation "
"failed.", sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s o= owner line not specified, validation failed.",
sdp_p->debug_str);
return (SDP_FAILURE);
}
if ((sdp_session_name_valid((void *)sdp_p) == FALSE) &&
(sdp_p->conf_p->session_name_reqd == TRUE)) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s s= session name line not specified, validation "
"failed.", sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s s= session name line not specified, validation failed.",
sdp_p->debug_str);
return (SDP_FAILURE);
}
if ((sdp_timespec_valid((void *)sdp_p) == FALSE) &&
(sdp_p->conf_p->timespec_reqd == TRUE)) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s t= timespec line not specified, validation "
"failed.", sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s t= timespec line not specified, validation failed.",
sdp_p->debug_str);
return (SDP_FAILURE);
}
@ -889,7 +885,7 @@ sdp_result_e sdp_validate_sdp (sdp_t *sdp_p)
/* Function: sdp_parse
* Description: Parse an SDP description in the specified buffer.
* Parameters: sdp_ptr The SDP handle returned by sdp_init_description
* Parameters: sdp_p The SDP handle returned by sdp_init_description
* bufp Pointer to the buffer containing the SDP
* description to parse.
* len The length of the buffer.
@ -897,7 +893,7 @@ sdp_result_e sdp_validate_sdp (sdp_t *sdp_p)
* if not, what type of error was encountered. The
* information from the parse is stored in the sdp_p structure.
*/
sdp_result_e sdp_parse (void *sdp_ptr, char **bufp, u16 len)
sdp_result_e sdp_parse (sdp_t *sdp_p, char **bufp, u16 len)
{
u8 i;
u16 cur_level = SDP_SESSION_LEVEL;
@ -910,7 +906,6 @@ sdp_result_e sdp_parse (void *sdp_ptr, char **bufp, u16 len)
tinybool end_found = FALSE;
tinybool first_line = TRUE;
tinybool unrec_token = FALSE;
sdp_t *sdp_p = (sdp_t *)sdp_ptr;
if (sdp_verify_sdp_ptr(sdp_p) == FALSE) {
return (SDP_INVALID_SDP_PTR);
@ -942,10 +937,9 @@ sdp_result_e sdp_parse (void *sdp_ptr, char **bufp, u16 len)
ptr = next_ptr;
line_end = sdp_findchar(ptr, "\n");
if (line_end >= (*bufp + len)) {
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s End of line beyond end of buffer.",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s End of line beyond end of buffer.",
sdp_p->debug_str);
end_found = TRUE;
break;
}
@ -972,18 +966,15 @@ sdp_result_e sdp_parse (void *sdp_ptr, char **bufp, u16 len)
unrec_token = TRUE;
}
if (first_line == TRUE) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Attempt to parse text not recognized as "
"SDP text, parse fails.", sdp_p->debug_str);
sdp_parse_error(sdp_p->peerconnection,
"%s Attempt to parse text not recognized as "
"SDP text, parse fails.", sdp_p->debug_str);
/* If we haven't already printed out the line we
* were trying to parse, do it now.
*/
if (!sdp_p->debug_flag[SDP_DEBUG_TRACE]) {
SDP_PRINT("%s ", sdp_p->debug_str);
SDP_PRINT("%*s", line_end - ptr, ptr);
}
if (!sdp_p->debug_flag[SDP_DEBUG_TRACE]) {
SDP_PRINT("%s ", sdp_p->debug_str);
SDP_PRINT("%*s", line_end - ptr, ptr);
}
sdp_p->conf_p->num_not_sdp_desc++;
return (SDP_NOT_SDP_DESCRIPTION);
@ -1018,10 +1009,9 @@ sdp_result_e sdp_parse (void *sdp_ptr, char **bufp, u16 len)
(i != SDP_TOKEN_B) && (i != SDP_TOKEN_K) &&
(i != SDP_TOKEN_A) && (i != SDP_TOKEN_M)) {
sdp_p->conf_p->num_invalid_token_order++;
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: Invalid token %s found at media "
"level", sdp_p->debug_str, sdp_token[i].name);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: Invalid token %s found at media level",
sdp_p->debug_str, sdp_token[i].name);
continue;
}
}
@ -1030,10 +1020,9 @@ sdp_result_e sdp_parse (void *sdp_ptr, char **bufp, u16 len)
if (first_line == TRUE) {
if (i != SDP_TOKEN_V) {
if (sdp_p->conf_p->version_reqd == TRUE) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s First line not v=, parse fails",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s First line not v=, parse fails",
sdp_p->debug_str);
sdp_p->conf_p->num_invalid_token_order++;
result = SDP_INVALID_TOKEN_ORDERING;
parse_done = TRUE;
@ -1047,11 +1036,10 @@ sdp_result_e sdp_parse (void *sdp_ptr, char **bufp, u16 len)
} else {
if (i < last_token) {
sdp_p->conf_p->num_invalid_token_order++;
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: Invalid token ordering detected, "
"token %s found after token %s", sdp_p->debug_str,
sdp_token[i].name, sdp_token[last_token].name);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: Invalid token ordering detected, "
"token %s found after token %s", sdp_p->debug_str,
sdp_token[i].name, sdp_token[last_token].name);
}
}
@ -1105,16 +1093,15 @@ sdp_result_e sdp_parse (void *sdp_ptr, char **bufp, u16 len)
/* Function: sdp_build
* Description: Build an SDP description in the specified buffer based
* on the information in the given SDP structure.
* Parameters: sdp_ptr The SDP handle returned by sdp_init_description
* Parameters: sdp_p The SDP handle returned by sdp_init_description
* fs A flex_string where the SDP description should be built.
* Returns: A result value indicating if the build was successful and
* if not, what type of error was encountered - e.g.,
* description was too long for the given buffer.
*/
sdp_result_e sdp_build (void *sdp_ptr, flex_string *fs)
sdp_result_e sdp_build (sdp_t *sdp_p, flex_string *fs)
{
int i, j;
sdp_t *sdp_p = (sdp_t *)sdp_ptr;
sdp_result_e result = SDP_SUCCESS;
if (sdp_verify_sdp_ptr(sdp_p) == FALSE) {
@ -1164,16 +1151,15 @@ sdp_result_e sdp_build (void *sdp_ptr, flex_string *fs)
/* Function: sdp_copy
* Description: Create a new SDP structure that is an exact copy of the
* one passed in.
* Parameters: sdp_ptr The SDP handle of the SDP to be copied.
* Parameters: orig_sdp_p The SDP handle of the SDP to be copied.
* Returns: A handle for a new SDP structure as a void ptr.
*/
void *sdp_copy (void *sdp_ptr)
sdp_t *sdp_copy (sdp_t *orig_sdp_p)
{
int i, j;
u16 cur_level;
sdp_result_e rc;
sdp_t *new_sdp_p;
sdp_t *orig_sdp_p = (sdp_t *)sdp_ptr;
sdp_timespec_t *cur_time_p = NULL;
sdp_timespec_t *orig_time_p = NULL;
sdp_mca_t *orig_mca_p = NULL;
@ -1195,6 +1181,9 @@ void *sdp_copy (void *sdp_ptr)
return (NULL);
}
sstrncpy(new_sdp_p->peerconnection, orig_sdp_p->peerconnection,
sizeof(new_sdp_p->peerconnection));
/* Initialize magic number. */
new_sdp_p->magic_num = orig_sdp_p->magic_num;
@ -1381,14 +1370,13 @@ void *sdp_copy (void *sdp_ptr)
/* Function: sdp_free_description
* Description: Free an SDP description and all memory associated with it.
* Parameters: sdp_ptr The SDP handle returned by sdp_init_description
* Parameters: sdp_p The SDP handle returned by sdp_init_description
* Returns: A result value indicating if the free was successful and
* if not, what type of error was encountered - e.g., sdp_p
* was invalid and didn't point to an SDP structure.
*/
sdp_result_e sdp_free_description (void *sdp_ptr)
sdp_result_e sdp_free_description (sdp_t *sdp_p)
{
sdp_t *sdp_p = (sdp_t *)sdp_ptr;
sdp_timespec_t *time_p, *next_time_p;
sdp_attr_t *attr_p, *next_attr_p;
sdp_mca_t *mca_p, *next_mca_p;
@ -1459,3 +1447,17 @@ sdp_result_e sdp_free_description (void *sdp_ptr)
return (SDP_SUCCESS);
}
/*
* sdp_parse_error
* Send SDP parsing errors to log and up to peerconnection
*/
void sdp_parse_error(const char *peerconnection, const char *format, ...) {
va_list ap;
/* TODO - report error up to PeerConnection here */
va_start(ap, format);
CSFLogErrorV("SDP Parse", format, ap);
va_end(ap);
}

View File

@ -13,8 +13,6 @@
#include "phone_debug.h"
#define SDP_ERROR buginf
#define SDP_WARN buginf
#define SDP_PRINT buginf
#define SDP_MALLOC(x) cpr_calloc(1, (x))
#define SDP_FREE cpr_free

View File

@ -8,531 +8,6 @@
#include "sdp.h"
/* SDP Defines */
#define SDP_MAX_STRING_LEN 256 /* Max len for SDP string */
#define SDP_MAX_SHORT_STRING_LEN 12 /* Max len for a short SDP string */
#define SDP_MAX_PAYLOAD_TYPES 23 /* Max payload types in m= line */
#define SDP_TOKEN_LEN 2 /* Len of <token>= */
#define SDP_CURRENT_VERSION 0 /* Current default SDP version */
#define SDP_MAX_PORT_PARAMS 4 /* Max m= port params - x/x/x/x */
#define SDP_MIN_DYNAMIC_PAYLOAD 96 /* Min dynamic payload */
#define SDP_MAX_DYNAMIC_PAYLOAD 127 /* Max dynamic payload */
#define SDP_MIN_CIF_VALUE 1 /* applies to all QCIF,CIF,CIF4,CIF16,SQCIF */
#define SDP_MAX_CIF_VALUE 32 /* applies to all QCIF,CIF,CIF4,CIF16,SQCIF */
#define SDP_MAX_SRC_ADDR_LIST 1 /* Max source addrs for which filter applies */
#define SDP_DEFAULT_PACKETIZATION_MODE_VALUE 0 /* max packetization mode for H.264 */
#define SDP_MAX_PACKETIZATION_MODE_VALUE 2 /* max packetization mode for H.264 */
#define SDP_MAX_LEVEL_ASYMMETRY_ALLOWED_VALUE 1 /* max level asymmetry allowed value for H.264 */
#define SDP_DEFAULT_LEVEL_ASYMMETRY_ALLOWED_VALUE 1 /* default level asymmetry allowed value for H.264 */
#define SDP_INVALID_LEVEL_ASYMMETRY_ALLOWED_VALUE 2 /* invalid value for level-asymmetry-allowed param for H.264 */
/* Max number of stream ids that can be grouped together */
#define SDP_MAX_GROUP_STREAM_ID 10
#define SDP_MAGIC_NUM 0xabcdabcd
#define SDP_UNSUPPORTED "Unsupported"
#define SDP_MAX_LINE_LEN 256 /* Max len for SDP Line */
#define SDP_MAX_PROFILE_VALUE 10
#define SDP_MAX_LEVEL_VALUE 100
#define SDP_MIN_PROFILE_LEVEL_VALUE 0
#define SDP_MAX_TTL_VALUE 255
#define SDP_MIN_MCAST_ADDR_HI_BIT_VAL 224
#define SDP_MAX_MCAST_ADDR_HI_BIT_VAL 239
/* SDP Enum Types */
typedef enum {
SDP_ERR_INVALID_CONF_PTR,
SDP_ERR_INVALID_SDP_PTR,
SDP_ERR_INTERNAL,
SDP_MAX_ERR_TYPES
} sdp_errmsg_e;
/* SDP Structure Definitions */
/* String names of varios tokens */
typedef struct {
char *name;
u8 strlen;
} sdp_namearray_t;
/* c= line info */
typedef struct {
sdp_nettype_e nettype;
sdp_addrtype_e addrtype;
char conn_addr[SDP_MAX_STRING_LEN+1];
tinybool is_multicast;
u16 ttl;
u16 num_of_addresses;
} sdp_conn_t;
/* t= line info */
typedef struct sdp_timespec {
char start_time[SDP_MAX_STRING_LEN+1];
char stop_time[SDP_MAX_STRING_LEN+1];
struct sdp_timespec *next_p;
} sdp_timespec_t;
/* k= line info */
typedef struct sdp_encryptspec {
sdp_encrypt_type_e encrypt_type;
char encrypt_key[SDP_MAX_STRING_LEN+1];
} sdp_encryptspec_t;
/* FMTP attribute deals with named events in the range of 0-255 as
* defined in RFC 2833 */
#define SDP_MIN_NE_VALUE 0
#define SDP_MAX_NE_VALUES 256
#define SDP_NE_BITS_PER_WORD ( sizeof(u32) * 8 )
#define SDP_NE_NUM_BMAP_WORDS ((SDP_MAX_NE_VALUES + SDP_NE_BITS_PER_WORD - 1)/SDP_NE_BITS_PER_WORD )
#define SDP_NE_BIT_0 ( 0x00000001 )
#define SDP_NE_ALL_BITS ( 0xFFFFFFFF )
#define SDP_DEINT_BUF_REQ_FLAG 0x1
#define SDP_INIT_BUF_TIME_FLAG 0x2
#define SDP_MAX_RCMD_NALU_SIZE_FLAG 0x4
#define SDP_DEINT_BUF_CAP_FLAG 0x8
typedef struct sdp_fmtp {
u16 payload_num;
u32 maxval; /* maxval optimizes bmap search */
u32 bmap[ SDP_NE_NUM_BMAP_WORDS ];
sdp_fmtp_format_type_e fmtp_format; /* Gives the format type
for FMTP attribute*/
tinybool annexb_required;
tinybool annexa_required;
tinybool annexa;
tinybool annexb;
u32 bitrate;
u32 mode;
/* some OPUS specific fmtp params */
u32 maxaveragebitrate;
u16 usedtx;
u16 stereo;
u16 useinbandfec;
char maxcodedaudiobandwidth[SDP_MAX_STRING_LEN+1];
u16 cbr;
/* some Data Channel specific fmtp params */
u16 streams; /* Num streams per Data Channel */
char protocol[SDP_MAX_STRING_LEN+1];
/* BEGIN - All Video related FMTP parameters */
u16 qcif;
u16 cif;
u16 maxbr;
u16 sqcif;
u16 cif4;
u16 cif16;
u16 custom_x;
u16 custom_y;
u16 custom_mpi;
/* CUSTOM=360,240,4 implies X-AXIS=360, Y-AXIS=240; MPI=4 */
u16 par_width;
u16 par_height;
/* PAR=12:11 implies par_width=12, par_height=11 */
/* CPCF should be a float. IOS does not support float and so it is u16 */
/* For portable stack, CPCF should be defined as float and the parsing should
* be modified accordingly */
u16 cpcf;
u16 bpp;
u16 hrd;
int16 profile;
int16 level;
tinybool is_interlace;
/* some more H.264 specific fmtp params */
char profile_level_id[SDP_MAX_STRING_LEN+1];
char parameter_sets[SDP_MAX_STRING_LEN+1];
u16 packetization_mode;
u16 level_asymmetry_allowed;
u16 interleaving_depth;
u32 deint_buf_req;
u32 max_don_diff;
u32 init_buf_time;
u32 max_mbps;
u32 max_fs;
u32 max_cpb;
u32 max_dpb;
u32 max_br;
tinybool redundant_pic_cap;
u32 deint_buf_cap;
u32 max_rcmd_nalu_size;
tinybool parameter_add;
tinybool annex_d;
tinybool annex_f;
tinybool annex_i;
tinybool annex_j;
tinybool annex_t;
/* H.263 codec requires annex K,N and P to have values */
u16 annex_k_val;
u16 annex_n_val;
/* Annex P can take one or more values in the range 1-4 . e.g P=1,3 */
u16 annex_p_val_picture_resize; /* 1 = four; 2 = sixteenth */
u16 annex_p_val_warp; /* 3 = half; 4=sixteenth */
u8 flag;
/* END - All Video related FMTP parameters */
} sdp_fmtp_t;
/* a=qos|secure|X-pc-qos|X-qos info */
typedef struct sdp_qos {
sdp_qos_strength_e strength;
sdp_qos_dir_e direction;
tinybool confirm;
sdp_qos_status_types_e status_type;
} sdp_qos_t;
/* a=curr:qos status_type direction */
typedef struct sdp_curr {
sdp_curr_type_e type;
sdp_qos_status_types_e status_type;
sdp_qos_dir_e direction;
} sdp_curr_t;
/* a=des:qos strength status_type direction */
typedef struct sdp_des {
sdp_des_type_e type;
sdp_qos_strength_e strength;
sdp_qos_status_types_e status_type;
sdp_qos_dir_e direction;
} sdp_des_t;
/* a=conf:qos status_type direction */
typedef struct sdp_conf {
sdp_conf_type_e type;
sdp_qos_status_types_e status_type;
sdp_qos_dir_e direction;
} sdp_conf_t;
/* a=rtpmap or a=sprtmap info */
typedef struct sdp_transport_map {
u16 payload_num;
char encname[SDP_MAX_STRING_LEN+1];
u32 clockrate;
u16 num_chan;
} sdp_transport_map_t;
/* a=rtr info */
typedef struct sdp_rtr {
tinybool confirm;
} sdp_rtr_t;
/* a=subnet info */
typedef struct sdp_subnet {
sdp_nettype_e nettype;
sdp_addrtype_e addrtype;
char addr[SDP_MAX_STRING_LEN+1];
int32 prefix;
} sdp_subnet_t;
/* a=X-pc-codec info */
typedef struct sdp_pccodec {
u16 num_payloads;
ushort payload_type[SDP_MAX_PAYLOAD_TYPES];
} sdp_pccodec_t;
/* a=direction info */
typedef struct sdp_comediadir {
sdp_mediadir_role_e role;
tinybool conn_info_present;
sdp_conn_t conn_info;
u32 src_port;
} sdp_comediadir_t;
/* a=silenceSupp info */
typedef struct sdp_silencesupp {
tinybool enabled;
tinybool timer_null;
u16 timer;
sdp_silencesupp_pref_e pref;
sdp_silencesupp_siduse_e siduse;
tinybool fxnslevel_null;
u8 fxnslevel;
} sdp_silencesupp_t;
/*
* a=mptime info */
/* Note that an interval value of zero corresponds to
* the "-" syntax on the a= line.
*/
typedef struct sdp_mptime {
u16 num_intervals;
ushort intervals[SDP_MAX_PAYLOAD_TYPES];
} sdp_mptime_t;
/*
* a=X-sidin:<val>, a=X-sidout:< val> and a=X-confid: <val>
* Stream Id,ConfID related attributes to be used for audio/video conferencing
*
*/
typedef struct sdp_stream_data {
char x_sidin[SDP_MAX_STRING_LEN+1];
char x_sidout[SDP_MAX_STRING_LEN+1];
char x_confid[SDP_MAX_STRING_LEN+1];
sdp_group_attr_e group_attr; /* FID or LS */
u16 num_group_id;
u16 group_id_arr[SDP_MAX_GROUP_STREAM_ID];
} sdp_stream_data_t;
/*
* a=source-filter:<filter-mode> <filter-spec>
* <filter-spec> = <nettype> <addrtype> <dest-addr> <src_addr><src_addr>...
* One or more source addresses to apply filter, for one or more connection
* address in unicast/multicast environments
*/
typedef struct sdp_source_filter {
sdp_src_filter_mode_e mode;
sdp_nettype_e nettype;
sdp_addrtype_e addrtype;
char dest_addr[SDP_MAX_STRING_LEN+1];
u16 num_src_addr;
char src_list[SDP_MAX_SRC_ADDR_LIST+1][SDP_MAX_STRING_LEN+1];
} sdp_source_filter_t;
/*
* b=<bw-modifier>:<val>
*
*/
typedef struct sdp_bw_data {
struct sdp_bw_data *next_p;
sdp_bw_modifier_e bw_modifier;
int bw_val;
} sdp_bw_data_t;
/*
* This structure houses a linked list of sdp_bw_data_t instances. Each
* sdp_bw_data_t instance represents one b= line.
*/
typedef struct sdp_bw {
u16 bw_data_count;
sdp_bw_data_t *bw_data_list;
} sdp_bw_t;
/* Media lines for AAL2 may have more than one transport type defined
* each with its own payload type list. These are referred to as
* profile types instead of transport types. This structure is used
* to handle these multiple profile types. Note: One additional profile
* field is needed because of the way parsing is done. This is not an
* error. */
typedef struct sdp_media_profiles {
u16 num_profiles;
sdp_transport_e profile[SDP_MAX_PROFILES+1];
u16 num_payloads[SDP_MAX_PROFILES];
sdp_payload_ind_e payload_indicator[SDP_MAX_PROFILES][SDP_MAX_PAYLOAD_TYPES];
u16 payload_type[SDP_MAX_PROFILES][SDP_MAX_PAYLOAD_TYPES];
} sdp_media_profiles_t;
/*
* sdp_srtp_crypto_context_t
* This type is used to hold cryptographic context information.
*
*/
typedef struct sdp_srtp_crypto_context_t_ {
int32 tag;
unsigned long selection_flags;
sdp_srtp_crypto_suite_t suite;
unsigned char master_key[SDP_SRTP_MAX_KEY_SIZE_BYTES];
unsigned char master_salt[SDP_SRTP_MAX_SALT_SIZE_BYTES];
unsigned char master_key_size_bytes;
unsigned char master_salt_size_bytes;
unsigned long ssrc; /* not used */
unsigned long roc; /* not used */
unsigned long kdr; /* not used */
unsigned short seq; /* not used */
sdp_srtp_fec_order_t fec_order; /* not used */
unsigned char master_key_lifetime[SDP_SRTP_MAX_LIFETIME_BYTES];
unsigned char mki[SDP_SRTP_MAX_MKI_SIZE_BYTES];
u16 mki_size_bytes;
char* session_parameters;
} sdp_srtp_crypto_context_t;
/* m= line info and associated attribute list */
/* Note: Most of the port parameter values are 16-bit values. We set
* the type to int32 so we can return either a 16-bit value or the
* choose value. */
typedef struct sdp_mca {
sdp_media_e media;
sdp_conn_t conn;
sdp_transport_e transport;
sdp_port_format_e port_format;
int32 port;
int32 sctpport;
int32 num_ports;
int32 vpi;
u32 vci; /* VCI needs to be 32-bit */
int32 vcci;
int32 cid;
u16 num_payloads;
sdp_payload_ind_e payload_indicator[SDP_MAX_PAYLOAD_TYPES];
u16 payload_type[SDP_MAX_PAYLOAD_TYPES];
sdp_media_profiles_t *media_profiles_p;
tinybool sessinfo_found;
sdp_encryptspec_t encrypt;
sdp_bw_t bw;
sdp_attr_e media_direction; /* Either INACTIVE, SENDONLY,
RECVONLY, or SENDRECV */
u32 mid;
struct sdp_attr *media_attrs_p;
struct sdp_mca *next_p;
} sdp_mca_t;
/* generic a= line info */
typedef struct sdp_attr {
sdp_attr_e type;
union {
tinybool boolean_val;
u32 u32_val;
char string_val[SDP_MAX_STRING_LEN+1];
char ice_attr[SDP_MAX_STRING_LEN+1];
sdp_fmtp_t fmtp;
sdp_qos_t qos;
sdp_curr_t curr;
sdp_des_t des;
sdp_conf_t conf;
sdp_transport_map_t transport_map; /* A rtpmap or sprtmap */
sdp_subnet_t subnet;
sdp_t38_ratemgmt_e t38ratemgmt;
sdp_t38_udpec_e t38udpec;
sdp_pccodec_t pccodec;
sdp_silencesupp_t silencesupp;
sdp_mca_t *cap_p; /* A X-CAP or CDSC attribute */
sdp_rtr_t rtr;
sdp_comediadir_t comediadir;
sdp_srtp_crypto_context_t srtp_context;
sdp_mptime_t mptime;
sdp_stream_data_t stream_data;
char unknown[SDP_MAX_STRING_LEN+1];
sdp_source_filter_t source_filter;
} attr;
struct sdp_attr *next_p;
} sdp_attr_t;
typedef struct sdp_srtp_crypto_suite_list_ {
sdp_srtp_crypto_suite_t crypto_suite_val;
char * crypto_suite_str;
unsigned char key_size_bytes;
unsigned char salt_size_bytes;
} sdp_srtp_crypto_suite_list;
/* Application configuration options */
typedef struct sdp_conf_options {
u32 magic_num;
tinybool debug_flag[SDP_MAX_DEBUG_TYPES];
tinybool version_reqd;
tinybool owner_reqd;
tinybool session_name_reqd;
tinybool timespec_reqd;
tinybool media_supported[SDP_MAX_MEDIA_TYPES];
tinybool nettype_supported[SDP_MAX_NETWORK_TYPES];
tinybool addrtype_supported[SDP_MAX_ADDR_TYPES];
tinybool transport_supported[SDP_MAX_TRANSPORT_TYPES];
tinybool allow_choose[SDP_MAX_CHOOSE_PARAMS];
/* Statistics counts */
u32 num_builds;
u32 num_parses;
u32 num_not_sdp_desc;
u32 num_invalid_token_order;
u32 num_invalid_param;
u32 num_no_resource;
struct sdp_conf_options *next_p;
} sdp_conf_options_t;
/* Session level SDP info with pointers to media line info. */
/* Elements here that can only be one of are included directly. Elements */
/* that can be more than one are pointers. */
typedef struct {
u32 magic_num;
sdp_conf_options_t *conf_p;
tinybool debug_flag[SDP_MAX_DEBUG_TYPES];
char debug_str[SDP_MAX_STRING_LEN+1];
u32 debug_id;
int32 version; /* version is really a u16 */
char owner_name[SDP_MAX_STRING_LEN+1];
char owner_sessid[SDP_MAX_STRING_LEN+1];
char owner_version[SDP_MAX_STRING_LEN+1];
sdp_nettype_e owner_network_type;
sdp_addrtype_e owner_addr_type;
char owner_addr[SDP_MAX_STRING_LEN+1];
char sessname[SDP_MAX_STRING_LEN+1];
tinybool sessinfo_found;
tinybool uri_found;
sdp_conn_t default_conn;
sdp_timespec_t *timespec_p;
sdp_encryptspec_t encrypt;
sdp_bw_t bw;
sdp_attr_t *sess_attrs_p;
/* Info to help with building capability attributes. */
u16 cur_cap_num;
sdp_mca_t *cur_cap_p;
/* Info to help parsing X-cpar attrs. */
u16 cap_valid;
u16 last_cap_inst;
/* Info to help building X-cpar/cpar attrs. */
sdp_attr_e last_cap_type;
/* MCA - Media, connection, and attributes */
sdp_mca_t *mca_p;
ushort mca_count;
} sdp_t;
/* Token processing table. */
typedef struct {
char *name;
sdp_result_e (*parse_func)(sdp_t *sdp_p, u16 level, const char *ptr);
sdp_result_e (*build_func)(sdp_t *sdp_p, u16 level, flex_string *fs);
} sdp_tokenarray_t;
/* Attribute processing table. */
typedef struct {
char *name;
u16 strlen;
sdp_result_e (*parse_func)(sdp_t *sdp_p, sdp_attr_t *attr_p,
const char *ptr);
sdp_result_e (*build_func)(sdp_t *sdp_p, sdp_attr_t *attr_p,
flex_string *fs);
} sdp_attrarray_t;
/* Data declarations */
extern const sdp_attrarray_t sdp_attr[];
extern const sdp_namearray_t sdp_media[];
extern const sdp_namearray_t sdp_nettype[];
@ -829,7 +304,6 @@ extern
tinybool verify_sdescriptions_lifetime(char *buf);
/* sdp_services_xxx.c */
extern void sdp_log_errmsg(sdp_errmsg_e err_msg, char *str);
extern void sdp_dump_buffer(char *_ptr, int _size_bytes);
tinybool sdp_checkrange(sdp_t *sdp, char *num, ulong* lval);

View File

@ -15,6 +15,7 @@
/* */
/******************************************************************/
#if 0
void sdp_log_errmsg (sdp_errmsg_e errmsg, char *str)
{
switch (errmsg) {
@ -35,6 +36,7 @@ void sdp_log_errmsg (sdp_errmsg_e errmsg, char *str)
break;
}
}
#endif
/*
* sdp_dump_buffer

View File

@ -15,6 +15,7 @@
/* */
/******************************************************************/
#if 0
void sdp_log_errmsg (sdp_errmsg_e errmsg, char *str)
{
switch (errmsg) {
@ -35,6 +36,7 @@ void sdp_log_errmsg (sdp_errmsg_e errmsg, char *str)
break;
}
}
#endif
/*
* sdp_dump_buffer

View File

@ -10,6 +10,9 @@
#include "configmgr.h"
#include "prot_configmgr.h"
#include "ccapi.h"
#include "CSFLog.h"
static const char *logTag = "sdp_token";
#define MCAST_STRING_LEN 4
@ -20,10 +23,9 @@ sdp_result_e sdp_parse_version (sdp_t *sdp_p, u16 level, const char *ptr)
sdp_p->version = (u16)sdp_getnextnumtok(ptr, &ptr, " \t", &result);
if ((result != SDP_SUCCESS) || (sdp_p->version != SDP_CURRENT_VERSION)) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Invalid version (%lu) found, parse failed.",
sdp_p->debug_str, sdp_p->version);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Invalid version (%lu) found, parse failed.",
sdp_p->debug_str, sdp_p->version);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
}
@ -39,10 +41,8 @@ sdp_result_e sdp_build_version (sdp_t *sdp_p, u16 level, flex_string *fs)
{
if (sdp_p->version == SDP_INVALID_VALUE) {
if (sdp_p->conf_p->version_reqd == TRUE) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Invalid version for v= line, "
"build failed.", sdp_p->debug_str);
}
CSFLogError(logTag, "%s Invalid version for v= line, "
"build failed.", sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
} else {
@ -68,19 +68,17 @@ sdp_result_e sdp_parse_owner (sdp_t *sdp_p, u16 level, const char *ptr)
if (sdp_p->owner_name[0] != '\0') {
sdp_p->conf_p->num_invalid_token_order++;
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: More than one o= line specified.",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: More than one o= line specified.",
sdp_p->debug_str);
}
/* Find the owner name. */
ptr = sdp_getnextstrtok(ptr, sdp_p->owner_name, sizeof(sdp_p->owner_name), " \t", &result);
if (result != SDP_SUCCESS) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s No owner name specified for o=.",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s No owner name specified for o=.",
sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
}
@ -97,10 +95,9 @@ sdp_result_e sdp_parse_owner (sdp_t *sdp_p, u16 level, const char *ptr)
(const char **)&tmpptr, " \t",&result);
}
if (result != SDP_SUCCESS) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Invalid owner session id specified for o=.",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Invalid owner session id specified for o=.",
sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
}
@ -115,10 +112,9 @@ sdp_result_e sdp_parse_owner (sdp_t *sdp_p, u16 level, const char *ptr)
(const char **)&tmpptr," \t",&result);
}
if (result != SDP_SUCCESS) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Invalid owner version specified for o=.",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Invalid owner version specified for o=.",
sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
}
@ -126,10 +122,9 @@ sdp_result_e sdp_parse_owner (sdp_t *sdp_p, u16 level, const char *ptr)
/* Find the owner network type. */
ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result);
if (result != SDP_SUCCESS) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s No owner network type specified for o=.",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s No owner network type specified for o=.",
sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
}
@ -143,10 +138,9 @@ sdp_result_e sdp_parse_owner (sdp_t *sdp_p, u16 level, const char *ptr)
}
}
if (sdp_p->owner_network_type == SDP_NT_UNSUPPORTED) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Owner network type unsupported (%s)",
sdp_p->debug_str, tmp);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Owner network type unsupported (%s)",
sdp_p->debug_str, tmp);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
}
@ -154,10 +148,9 @@ sdp_result_e sdp_parse_owner (sdp_t *sdp_p, u16 level, const char *ptr)
/* Find the owner address type. */
ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result);
if (result != SDP_SUCCESS) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s No owner address type specified for o=.",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s No owner address type specified for o=.",
sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
}
@ -172,10 +165,9 @@ sdp_result_e sdp_parse_owner (sdp_t *sdp_p, u16 level, const char *ptr)
}
if ((sdp_p->owner_addr_type == SDP_AT_UNSUPPORTED) &&
(sdp_p->owner_network_type != SDP_NT_ATM)) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Owner address type unsupported (%s)",
sdp_p->debug_str, tmp);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Owner address type unsupported (%s)",
sdp_p->debug_str, tmp);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
}
@ -183,9 +175,8 @@ sdp_result_e sdp_parse_owner (sdp_t *sdp_p, u16 level, const char *ptr)
/* Find the owner address. */
ptr = sdp_getnextstrtok(ptr, sdp_p->owner_addr, sizeof(sdp_p->owner_addr), " \t", &result);
if (result != SDP_SUCCESS) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s No owner address specified.", sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s No owner address specified.", sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
}
@ -219,10 +210,8 @@ sdp_result_e sdp_build_owner (sdp_t *sdp_p, u16 level, flex_string *fs)
}
if (sdp_p->conf_p->owner_reqd == TRUE) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Invalid params for o= owner line, "
"build failed.", sdp_p->debug_str);
}
CSFLogError(logTag, "%s Invalid params for o= owner line, "
"build failed.", sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
} else {
@ -251,18 +240,16 @@ sdp_result_e sdp_parse_sessname (sdp_t *sdp_p, u16 level, const char *ptr)
if (sdp_p->sessname[0] != '\0') {
sdp_p->conf_p->num_invalid_token_order++;
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: More than one s= line specified.",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: More than one s= line specified.",
sdp_p->debug_str);
}
endptr = sdp_findchar(ptr, "\r\n");
if (ptr == endptr) {
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: No session name specified.",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: No session name specified.",
sdp_p->debug_str);
}
str_len = MIN(endptr - ptr, SDP_MAX_STRING_LEN);
sstrncpy(sdp_p->sessname, ptr, str_len+1);
@ -278,10 +265,8 @@ sdp_result_e sdp_build_sessname (sdp_t *sdp_p, u16 level, flex_string *fs)
{
if (sdp_p->sessname[0] == '\0') {
if (sdp_p->conf_p->session_name_reqd == TRUE) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s No param defined for s= session name line, "
"build failed.", sdp_p->debug_str);
}
CSFLogError(logTag, "%s No param defined for s= session name line, "
"build failed.", sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
} else {
@ -310,10 +295,9 @@ sdp_result_e sdp_parse_sessinfo (sdp_t *sdp_p, u16 level, const char *ptr)
if (level == SDP_SESSION_LEVEL) {
if (sdp_p->sessinfo_found == TRUE) {
sdp_p->conf_p->num_invalid_token_order++;
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: More than one i= line specified.",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: More than one i= line specified.",
sdp_p->debug_str);
}
sdp_p->sessinfo_found = TRUE;
} else {
@ -323,20 +307,18 @@ sdp_result_e sdp_parse_sessinfo (sdp_t *sdp_p, u16 level, const char *ptr)
}
if (mca_p->sessinfo_found == TRUE) {
sdp_p->conf_p->num_invalid_token_order++;
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: More than one i= line specified"
" for media line %d.", sdp_p->debug_str, level);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: More than one i= line specified"
" for media line %d.", sdp_p->debug_str, level);
}
mca_p->sessinfo_found = TRUE;
}
endptr = sdp_findchar(ptr, "\n");
if (ptr == endptr) {
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: No session info specified.",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: No session info specified.",
sdp_p->debug_str);
}
if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) {
@ -357,18 +339,16 @@ sdp_result_e sdp_parse_uri (sdp_t *sdp_p, u16 level, const char *ptr)
if (sdp_p->uri_found == TRUE) {
sdp_p->conf_p->num_invalid_token_order++;
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: More than one u= line specified.",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: More than one u= line specified.",
sdp_p->debug_str);
}
sdp_p->uri_found = TRUE;
endptr = sdp_findchar(ptr, "\n");
if (ptr == endptr) {
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: No URI info specified.", sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: No URI info specified.", sdp_p->debug_str);
}
if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) {
@ -389,9 +369,8 @@ sdp_result_e sdp_parse_email (sdp_t *sdp_p, u16 level, const char *ptr)
endptr = sdp_findchar(ptr, "\n");
if (ptr == endptr) {
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: No email info specified.", sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: No email info specified.", sdp_p->debug_str);
}
if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) {
@ -412,10 +391,9 @@ sdp_result_e sdp_parse_phonenum (sdp_t *sdp_p, u16 level, const char *ptr)
endptr = sdp_findchar(ptr, "\n");
if (ptr == endptr) {
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: No phone number info specified.",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: No phone number info specified.",
sdp_p->debug_str);
}
if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) {
@ -459,20 +437,18 @@ sdp_result_e sdp_parse_connection (sdp_t *sdp_p, u16 level, const char *ptr)
*/
if (conn_p->nettype != SDP_NT_INVALID) {
sdp_p->conf_p->num_invalid_token_order++;
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s c= line specified twice at same level, "
"parse failed.", sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s c= line specified twice at same level, "
"parse failed.", sdp_p->debug_str);
return (SDP_INVALID_TOKEN_ORDERING);
}
/* Find the connection network type. */
ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result);
if (result != SDP_SUCCESS) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s No connection network type specified for c=.",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s No connection network type specified for c=.",
sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
}
@ -486,10 +462,9 @@ sdp_result_e sdp_parse_connection (sdp_t *sdp_p, u16 level, const char *ptr)
}
}
if (conn_p->nettype == SDP_NT_UNSUPPORTED) {
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: Connection network type unsupported "
"(%s) for c=.", sdp_p->debug_str, tmp);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: Connection network type unsupported "
"(%s) for c=.", sdp_p->debug_str, tmp);
}
/* Find the connection address type. */
@ -503,10 +478,9 @@ sdp_result_e sdp_parse_connection (sdp_t *sdp_p, u16 level, const char *ptr)
}
return (SDP_SUCCESS);
} else {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s No connection address type specified for "
"c=.", sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s No connection address type specified for "
"c=.", sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
}
@ -521,19 +495,17 @@ sdp_result_e sdp_parse_connection (sdp_t *sdp_p, u16 level, const char *ptr)
}
}
if (conn_p->addrtype == SDP_AT_UNSUPPORTED) {
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: Connection address type unsupported "
"(%s) for c=.", sdp_p->debug_str, tmp);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: Connection address type unsupported "
"(%s) for c=.", sdp_p->debug_str, tmp);
}
/* Find the connection address. */
ptr = sdp_getnextstrtok(ptr, conn_p->conn_addr, sizeof(conn_p->conn_addr), " \t", &result);
if (result != SDP_SUCCESS) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s No connection address specified for c=.",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s No connection address specified for c=.",
sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
}
@ -550,10 +522,9 @@ sdp_result_e sdp_parse_connection (sdp_t *sdp_p, u16 level, const char *ptr)
strtoul_result = strtoul(mcast_str, &strtoul_end, 10);
if (errno || mcast_str == strtoul_end || strtoul_result > 255) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Error parsing address %s for mcast.",
sdp_p->debug_str, mcast_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Error parsing address %s for mcast.",
sdp_p->debug_str, mcast_str);
sdp_p->conf_p->num_invalid_param++;
return SDP_INVALID_PARAMETER;
}
@ -576,10 +547,9 @@ sdp_result_e sdp_parse_connection (sdp_t *sdp_p, u16 level, const char *ptr)
slash_ptr++;
slash_ptr = sdp_getnextstrtok(slash_ptr, tmp, sizeof(tmp), "/", &result);
if (result != SDP_SUCCESS) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s No ttl value specified for this multicast addr with a slash",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s No ttl value specified for this multicast addr with a slash",
sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
}
@ -588,10 +558,9 @@ sdp_result_e sdp_parse_connection (sdp_t *sdp_p, u16 level, const char *ptr)
strtoul_result = strtoul(tmp, &strtoul_end, 10);
if (errno || tmp == strtoul_end || conn_p->ttl > SDP_MAX_TTL_VALUE) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Invalid TTL: Value must be in the range 0-255 ",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Invalid TTL: Value must be in the range 0-255 ",
sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
}
@ -613,10 +582,9 @@ sdp_result_e sdp_parse_connection (sdp_t *sdp_p, u16 level, const char *ptr)
strtoul_result = strtoul(slash_ptr, &strtoul_end, 10);
if (errno || slash_ptr == strtoul_end || strtoul_result == 0) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Invalid Num of addresses: Value must be > 0 ",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Invalid Num of addresses: Value must be > 0 ",
sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return SDP_INVALID_PARAMETER;
}
@ -635,10 +603,9 @@ sdp_result_e sdp_parse_connection (sdp_t *sdp_p, u16 level, const char *ptr)
/* See if the address is the choose param and if it's allowed. */
if ((sdp_p->conf_p->allow_choose[SDP_CHOOSE_CONN_ADDR] == FALSE) &&
(strcmp(conn_p->conn_addr, "$") == 0)) {
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: Choose parameter for connection "
"address specified but not allowed.", sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: Choose parameter for connection "
"address specified but not allowed.", sdp_p->debug_str);
}
if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) {
@ -750,10 +717,9 @@ sdp_result_e sdp_parse_bandwidth (sdp_t *sdp_p, u16 level, const char *ptr)
/* Find the bw type (AS, CT or TIAS) */
ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), ":", &result);
if (result != SDP_SUCCESS) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s No bandwidth type specified for b= ",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s No bandwidth type specified for b= ",
sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
}
@ -766,10 +732,9 @@ sdp_result_e sdp_parse_bandwidth (sdp_t *sdp_p, u16 level, const char *ptr)
}
if (bw_modifier == SDP_BW_MODIFIER_UNSUPPORTED) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Error: BW Modifier type unsupported (%s).",
sdp_p->debug_str, tmp);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Error: BW Modifier type unsupported (%s).",
sdp_p->debug_str, tmp);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
}
@ -782,11 +747,9 @@ sdp_result_e sdp_parse_bandwidth (sdp_t *sdp_p, u16 level, const char *ptr)
ptr++;
bw_val = sdp_getnextnumtok(ptr, &ptr, " \t", &result);
if ((result != SDP_SUCCESS)) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Error: No BW Value specified ",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Error: No BW Value specified ",
sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
}
@ -892,10 +855,9 @@ sdp_result_e sdp_parse_timespec (sdp_t *sdp_p, u16 level, const char *ptr)
(const char **)&tmpptr, " \t", &result);
}
if (result != SDP_SUCCESS) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Invalid timespec start time specified.",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Invalid timespec start time specified.",
sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
SDP_FREE(timespec_p);
return (SDP_INVALID_PARAMETER);
@ -910,10 +872,9 @@ sdp_result_e sdp_parse_timespec (sdp_t *sdp_p, u16 level, const char *ptr)
(const char **)&tmpptr, " \t", &result);
}
if (result != SDP_SUCCESS) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Invalid timespec stop time specified.",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Invalid timespec stop time specified.",
sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
SDP_FREE(timespec_p);
return (SDP_INVALID_PARAMETER);
@ -942,10 +903,8 @@ sdp_result_e sdp_build_timespec (sdp_t *sdp_p, u16 level, flex_string *fs)
(sdp_p->timespec_p->start_time == '\0') ||
(sdp_p->timespec_p->stop_time == '\0')) {
if (sdp_p->conf_p->timespec_reqd == TRUE) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Invalid params for t= time spec line, "
"build failed.", sdp_p->debug_str);
}
CSFLogError(logTag, "%s Invalid params for t= time spec line, "
"build failed.", sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
} else {
@ -970,10 +929,9 @@ sdp_result_e sdp_parse_repeat_time (sdp_t *sdp_p, u16 level, const char *ptr)
endptr = sdp_findchar(ptr, "\n");
if (ptr == endptr) {
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: No repeat time parameters "
"specified.", sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: No repeat time parameters "
"specified.", sdp_p->debug_str);
}
if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) {
@ -994,10 +952,9 @@ sdp_result_e sdp_parse_timezone_adj (sdp_t *sdp_p, u16 level, const char *ptr)
endptr = sdp_findchar(ptr, "\n");
if (ptr == endptr) {
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: No timezone parameters specified.",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: No timezone parameters specified.",
sdp_p->debug_str);
}
if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) {
@ -1034,10 +991,9 @@ sdp_result_e sdp_parse_encryption (sdp_t *sdp_p, u16 level, const char *ptr)
/* Find the encryption type. */
ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), ":", &result);
if (result != SDP_SUCCESS) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s No encryption type specified for k=.",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s No encryption type specified for k=.",
sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
}
@ -1050,10 +1006,9 @@ sdp_result_e sdp_parse_encryption (sdp_t *sdp_p, u16 level, const char *ptr)
}
}
if (encrypt_p->encrypt_type == SDP_ENCRYPT_UNSUPPORTED) {
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: Encryption type unsupported (%s).",
sdp_p->debug_str, tmp);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: Encryption type unsupported (%s).",
sdp_p->debug_str, tmp);
}
/* Find the encryption key. */
@ -1069,10 +1024,9 @@ sdp_result_e sdp_parse_encryption (sdp_t *sdp_p, u16 level, const char *ptr)
((encrypt_p->encrypt_type == SDP_ENCRYPT_CLEAR) ||
(encrypt_p->encrypt_type == SDP_ENCRYPT_BASE64) ||
(encrypt_p->encrypt_type == SDP_ENCRYPT_URI))) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Warning: No encryption key specified "
"as required.", sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: No encryption key specified "
"as required.", sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
}
@ -1149,10 +1103,9 @@ sdp_result_e sdp_parse_media (sdp_t *sdp_p, u16 level, const char *ptr)
/* Find the media type. */
ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result);
if (result != SDP_SUCCESS) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s No media type specified, parse failed.",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s No media type specified, parse failed.",
sdp_p->debug_str);
SDP_FREE(mca_p);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
@ -1165,10 +1118,9 @@ sdp_result_e sdp_parse_media (sdp_t *sdp_p, u16 level, const char *ptr)
}
}
if (mca_p->media == SDP_MEDIA_UNSUPPORTED) {
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: Media type unsupported (%s).",
sdp_p->debug_str, tmp);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: Media type unsupported (%s).",
sdp_p->debug_str, tmp);
}
/* Find the port token parameters, but don't process it until
@ -1177,10 +1129,9 @@ sdp_result_e sdp_parse_media (sdp_t *sdp_p, u16 level, const char *ptr)
*/
ptr = sdp_getnextstrtok(ptr, port, sizeof(port), " \t", &result);
if (result != SDP_SUCCESS) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s No port specified in m= media line, "
"parse failed.", sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s No port specified in m= media line, "
"parse failed.", sdp_p->debug_str);
SDP_FREE(mca_p);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
@ -1202,10 +1153,9 @@ sdp_result_e sdp_parse_media (sdp_t *sdp_p, u16 level, const char *ptr)
/* Find the transport protocol type. */
ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result);
if (result != SDP_SUCCESS) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s No transport protocol type specified, "
"parse failed.", sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s No transport protocol type specified, "
"parse failed.", sdp_p->debug_str);
SDP_FREE(mca_p);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
@ -1223,10 +1173,9 @@ sdp_result_e sdp_parse_media (sdp_t *sdp_p, u16 level, const char *ptr)
* just store the first num as the port.
*/
mca_p->port = num[0];
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: Transport protocol type unsupported "
"(%s).", sdp_p->debug_str, tmp);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: Transport protocol type unsupported "
"(%s).", sdp_p->debug_str, tmp);
}
/* Check for each of the possible port formats according to the
@ -1369,13 +1318,12 @@ sdp_result_e sdp_parse_media (sdp_t *sdp_p, u16 level, const char *ptr)
break;
}
if (valid_param == FALSE) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Invalid port format (%s) specified for transport "
"protocol (%s), parse failed.", sdp_p->debug_str,
port, sdp_get_transport_name(mca_p->transport));
}
sdp_parse_error(sdp_p->peerconnection,
"%s Invalid port format (%s) specified for transport "
"protocol (%s), parse failed.", sdp_p->debug_str,
port, sdp_get_transport_name(mca_p->transport));
sdp_p->conf_p->num_invalid_param++;
SDP_FREE(mca_p);
SDP_FREE(mca_p);
return (SDP_INVALID_PARAMETER);
}
@ -1400,10 +1348,9 @@ sdp_result_e sdp_parse_media (sdp_t *sdp_p, u16 level, const char *ptr)
if (mca_p->transport == SDP_TRANSPORT_SCTPDTLS) {
ptr = sdp_getnextstrtok(ptr, port, sizeof(port), " \t", &result);
if (result != SDP_SUCCESS) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s No sctp port specified in m= media line, "
"parse failed.", sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s No sctp port specified in m= media line, "
"parse failed.", sdp_p->debug_str);
SDP_FREE(mca_p);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
@ -1506,10 +1453,8 @@ sdp_result_e sdp_build_media (sdp_t *sdp_p, u16 level, flex_string *fs)
}
if (invalid_params == TRUE) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Invalid params for m= media line, "
"build failed.", sdp_p->debug_str);
}
CSFLogError(logTag, "%s Invalid params for m= media line, "
"build failed.", sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
}
@ -1542,10 +1487,8 @@ sdp_result_e sdp_build_media (sdp_t *sdp_p, u16 level, flex_string *fs)
} else if ((mca_p->vcci == SDP_CHOOSE_PARAM) ||
(mca_p->cid == SDP_CHOOSE_PARAM)) {
/* If one is set but not the other, this is an error. */
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s Invalid params for m= port parameter, "
"build failed.", sdp_p->debug_str);
}
CSFLogError(logTag, "%s Invalid params for m= port parameter, "
"build failed.", sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
} else {
@ -1638,13 +1581,12 @@ void sdp_parse_payload_types (sdp_t *sdp_p, sdp_mca_t *mca_p, const char *ptr)
if (result == SDP_SUCCESS) {
if ((mca_p->media == SDP_MEDIA_IMAGE) &&
(mca_p->transport == SDP_TRANSPORT_UDPTL)) {
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: Numeric payload type not "
"valid for media %s with transport %s.",
sdp_p->debug_str,
sdp_get_media_name(mca_p->media),
sdp_get_transport_name(mca_p->transport));
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: Numeric payload type not "
"valid for media %s with transport %s.",
sdp_p->debug_str,
sdp_get_media_name(mca_p->media),
sdp_get_transport_name(mca_p->transport));
} else {
mca_p->payload_indicator[num_payloads] = SDP_PAYLOAD_NUMERIC;
mca_p->num_payloads++;
@ -1685,28 +1627,25 @@ void sdp_parse_payload_types (sdp_t *sdp_p, sdp_mca_t *mca_p, const char *ptr)
mca_p->num_payloads++;
num_payloads++;
} else {
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: Payload type %s not valid for "
"media %s with transport %s.",
sdp_p->debug_str,
sdp_get_payload_name((sdp_payload_e)i),
sdp_get_media_name(mca_p->media),
sdp_get_transport_name(mca_p->transport));
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: Payload type %s not valid for "
"media %s with transport %s.",
sdp_p->debug_str,
sdp_get_payload_name((sdp_payload_e)i),
sdp_get_media_name(mca_p->media),
sdp_get_transport_name(mca_p->transport));
}
} else {
/* Payload type wasn't recognized. */
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: Payload type "
"unsupported (%s).", sdp_p->debug_str, tmp);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: Payload type "
"unsupported (%s).", sdp_p->debug_str, tmp);
}
}
if (mca_p->num_payloads == 0) {
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: No payload types specified.",
sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: No payload types specified.",
sdp_p->debug_str);
}
}
@ -1786,10 +1725,9 @@ sdp_result_e sdp_parse_multiple_profile_payload_types (sdp_t *sdp_p,
/* This token must be a payload type. Make sure there aren't
* too many payload types. */
if (payload >= SDP_MAX_PAYLOAD_TYPES) {
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: Too many payload types "
"found, truncating.", sdp_p->debug_str);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: Too many payload types "
"found, truncating.", sdp_p->debug_str);
continue;
}
@ -1808,19 +1746,17 @@ sdp_result_e sdp_parse_multiple_profile_payload_types (sdp_t *sdp_p,
/* No string payload types are currently valid for the AAL2
* transport types. This support can be added when needed. */
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: Unsupported payload type "
"found (%s).", sdp_p->debug_str, tmp);
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: Unsupported payload type "
"found (%s).", sdp_p->debug_str, tmp);
}
for (i=0; i < profile_p->num_profiles; i++) {
/* Make sure we have payloads for each profile type. */
if (profile_p->num_payloads[i] == 0) {
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
SDP_WARN("%s Warning: No payload types specified "
"for AAL2 profile %s.", sdp_p->debug_str,
sdp_get_transport_name(profile_p->profile[i]));
}
sdp_parse_error(sdp_p->peerconnection,
"%s Warning: No payload types specified "
"for AAL2 profile %s.", sdp_p->debug_str,
sdp_get_transport_name(profile_p->profile[i]));
}
}
return (SDP_SUCCESS);

View File

@ -7,9 +7,12 @@
#include "sdp_os_defs.h"
#include "sdp.h"
#include "sdp_private.h"
#include "CSFLog.h"
#define MKI_BUF_LEN 4
static const char* logTag = "sdp_utils";
sdp_mca_t *sdp_alloc_mca () {
sdp_mca_t *mca_p;
@ -728,7 +731,7 @@ tinybool sdp_checkrange (sdp_t *sdp_p, char *num, ulong *u_val)
if (*num == '-') {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s ERROR: Parameter value is a negative number: %s",
CSFLogError(logTag, "%s ERROR: Parameter value is a negative number: %s",
sdp_p->debug_str, num);
}
return FALSE;
@ -739,7 +742,7 @@ tinybool sdp_checkrange (sdp_t *sdp_p, char *num, ulong *u_val)
if (l_val > 4294967295UL) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s ERROR: Parameter value: %s is greater than 4294967295",
CSFLogError(logTag, "%s ERROR: Parameter value: %s is greater than 4294967295",
sdp_p->debug_str, num);
}
return FALSE;
@ -754,7 +757,7 @@ tinybool sdp_checkrange (sdp_t *sdp_p, char *num, ulong *u_val)
*/
if (strcmp("4294967295", num)) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
SDP_ERROR("%s ERROR: Parameter value: %s is greater than 4294967295",
CSFLogError(logTag, "%s ERROR: Parameter value: %s is greater than 4294967295",
sdp_p->debug_str, num);
}
return FALSE;

View File

@ -964,8 +964,11 @@ sip_util_extract_sdp (ccsipCCB_t *ccb, sipMessage_t *message)
/*
* Allocate a SDP buffer to work with (only destination buffer is needed).
*
* Here we are handing in an empty string to designate that we are not
* in the context of a peerconnection object
*/
sipsdp_src_dest_create(CCSIP_DEST_SDP_BIT, &sip_msg_sdp);
sipsdp_src_dest_create("", CCSIP_DEST_SDP_BIT, &sip_msg_sdp);
if ((sip_msg_sdp == NULL) || (sip_msg_sdp->dest_sdp == NULL)) {
/* Unable to get SDP */
CCSIP_DEBUG_ERROR(get_debug_string(DEBUG_SIP_SDP_CREATE_BUF_ERROR),

View File

@ -105,21 +105,19 @@ sip_sdp_init (void)
}
/*
* sip_sdp_create()
* sipsdp_create()
*
* Allocate a standard SDP with SIP config and set debug options
* based on ccsip debug settings
*/
void *
sipsdp_create (void)
sdp_t *
sipsdp_create (const char *peerconnection)
{
const char *fname = "sipsdp_create :";
void *sdp;
// char debug_str[80];
sdp_t *sdp;
sdp = sdp_init_description(ccsip_sdp_config);
sdp = sdp_init_description(peerconnection, ccsip_sdp_config);
if (!sdp) {
CCSIP_DEBUG_ERROR(SIP_F_PREFIX"SDP allocation failure\n", fname);
CCSIP_DEBUG_ERROR(SIP_F_PREFIX"SDP allocation failure\n", __FUNCTION__);
return (NULL);
}
@ -282,7 +280,8 @@ sipsdp_src_dest_free (uint16_t flags, cc_sdp_t **sdp_info)
* NULL - failure to allocate storage
*/
void
sipsdp_src_dest_create (uint16_t flags, cc_sdp_t **sdp_info)
sipsdp_src_dest_create (const char *peerconnection,
uint16_t flags, cc_sdp_t **sdp_info)
{
if (!(*sdp_info)) {
@ -294,7 +293,7 @@ sipsdp_src_dest_create (uint16_t flags, cc_sdp_t **sdp_info)
/* Create the SRC and/or DEST SDP */
if (flags & CCSIP_SRC_SDP_BIT) {
(*sdp_info)->src_sdp = sipsdp_create();
(*sdp_info)->src_sdp = sipsdp_create(peerconnection);
if (!((*sdp_info)->src_sdp)) {
sipsdp_src_dest_free(flags, sdp_info);
return;
@ -302,7 +301,7 @@ sipsdp_src_dest_create (uint16_t flags, cc_sdp_t **sdp_info)
}
if (flags & CCSIP_DEST_SDP_BIT) {
(*sdp_info)->dest_sdp = sipsdp_create();
(*sdp_info)->dest_sdp = sipsdp_create(peerconnection);
if (!((*sdp_info)->dest_sdp)) {
sipsdp_src_dest_free(flags, sdp_info);
return;
@ -310,50 +309,6 @@ sipsdp_src_dest_create (uint16_t flags, cc_sdp_t **sdp_info)
}
}
/*
* sipsdp_create_from_buf()
*
* Parse buffer into common SDP structure
*
* Returns: NULL if non-recoverable error encountered
*
*/
cc_sdp_t *
sipsdp_create_from_buf (char *buf, uint32_t nbytes, cc_sdp_t *sdp)
{
const char *fname = "sipsdp_create_from_buf";
cc_sdp_t *sip_info = NULL;
if (!buf) {
return (NULL);
}
if (sdp) {
sip_info = sdp;
} else {
sipsdp_src_dest_create(CCSIP_DEST_SDP_BIT | CCSIP_SRC_SDP_BIT,
&sip_info);
}
if (!sip_info) {
/*
* make sure that the src_sdp and dest_sdp are
* valid as well.
*/
return (NULL);
}
if (sdp_parse(sip_info->dest_sdp, &buf, (uint16_t)nbytes) != SDP_SUCCESS) {
sipsdp_src_dest_free(CCSIP_DEST_SDP_BIT | CCSIP_SRC_SDP_BIT,
&sip_info);
CCSIP_DEBUG_ERROR(SIP_F_PREFIX"Error parsing SDP\n", fname);
return (NULL);
}
return (sip_info);
}
/*
* sipsdp_write_to_buf()
*

View File

@ -21,10 +21,11 @@
* appropriate values initialized
*/
PMH_EXTERN boolean sip_sdp_init(void);
PMH_EXTERN void *sipsdp_create(void);
PMH_EXTERN sdp_t *sipsdp_create(const char *peerconnection);
PMH_EXTERN cc_sdp_t *sipsdp_info_create(void);
PMH_EXTERN void sipsdp_src_dest_free(uint16_t flags, cc_sdp_t **sdp_info);
PMH_EXTERN void sipsdp_src_dest_create(uint16_t flags, cc_sdp_t **sdp_info);
PMH_EXTERN void sipsdp_src_dest_create(const char *peerconnection,
uint16_t flags, cc_sdp_t **sdp_info);
PMH_EXTERN void sipsdp_free(cc_sdp_t **sip_sdp);
/*
@ -38,18 +39,6 @@ PMH_EXTERN void sipsdp_free(cc_sdp_t **sip_sdp);
#define SIPSDP_MAX_SESSION_VERSION_LENGTH 32
/*
* Create a SDP structure from a packet got from the network. This
* also parses the message and fills in the values of address, port etc.
* Memory is allocated. To free it properly, use sipsdp_free_internal(),
* followed by free()
* buf = raw message.
* nbytes = number of bytes in buf.
*
*/
PMH_EXTERN cc_sdp_t *sipsdp_create_from_buf(char *buf, uint32_t nbytes,
cc_sdp_t *sdp);
/*
* Standard session-level parameters
*/

View File

@ -6,6 +6,8 @@
#define _CC_CONSTANTS_H_
#include "cc_types.h"
#define PC_HANDLE_SIZE 17 /* 8 random bytes in hex plus null */
/**
* Max call servers
*/