| File: | root/firefox-clang/third_party/sipcc/sdp_attr.c |
| Warning: | line 4062, column 5 Value stored to 'ptr' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 | |
| 5 | #include <errno(*__errno_location ()).h> |
| 6 | #include <limits.h> |
| 7 | #include <stdio.h> |
| 8 | |
| 9 | #include "plstr.h" |
| 10 | #include "sdp_os_defs.h" |
| 11 | #include "sipcc_sdp.h" |
| 12 | #include "sdp_private.h" |
| 13 | #include "sdp_base64.h" |
| 14 | |
| 15 | #include "sdp_log.h" |
| 16 | |
| 17 | static const char* logTag = "sdp_attr"; |
| 18 | |
| 19 | /* |
| 20 | * Macro for sdp_build_attr_fmtp |
| 21 | * Adds name-value pair where value is char* |
| 22 | */ |
| 23 | #define FMTP_BUILD_STRING(condition, name, value)if ((condition)) { sdp_append_name_and_string(fs, (name), (value ), semicolon); semicolon = 1; } \ |
| 24 | if ((condition)) { \ |
| 25 | sdp_append_name_and_string(fs, (name), (value), semicolon); \ |
| 26 | semicolon = TRUE1; \ |
| 27 | } |
| 28 | |
| 29 | /* |
| 30 | * Macro for sdp_build_attr_fmtp |
| 31 | * Adds name-value pair where value is unsigned |
| 32 | */ |
| 33 | #define FMTP_BUILD_UNSIGNED(condition, name, value)if ((condition)) { sdp_append_name_and_unsigned(fs, (name), ( value), semicolon); semicolon = 1; } \ |
| 34 | if ((condition)) { \ |
| 35 | sdp_append_name_and_unsigned(fs, (name), (value), semicolon); \ |
| 36 | semicolon = TRUE1; \ |
| 37 | } |
| 38 | |
| 39 | /* |
| 40 | * Macro for sdp_build_attr_fmtp |
| 41 | * Adds flag string on condition |
| 42 | */ |
| 43 | #define FMTP_BUILD_FLAG(condition, name)if ((condition)) { if (semicolon) { flex_string_append(fs, ";" ); } flex_string_append(fs, name); semicolon = 1; } \ |
| 44 | if ((condition)) { \ |
| 45 | if (semicolon) { \ |
| 46 | flex_string_append(fs, ";"); \ |
| 47 | } \ |
| 48 | flex_string_append(fs, name); \ |
| 49 | semicolon = TRUE1; \ |
| 50 | } |
| 51 | |
| 52 | static int find_token_enum(const char *attr_name, |
| 53 | sdp_t *sdp_p, |
| 54 | const char **ptr, |
| 55 | const sdp_namearray_t *types, |
| 56 | int type_count, |
| 57 | int unknown_value) |
| 58 | { |
| 59 | sdp_result_e result = SDP_SUCCESS; |
| 60 | char tmp[SDP_MAX_STRING_LEN256+1]; |
| 61 | int i; |
| 62 | |
| 63 | *ptr = sdp_getnextstrtok(*ptr, tmp, sizeof(tmp), " \t", &result); |
| 64 | if (result != SDP_SUCCESS) { |
| 65 | sdp_parse_error(sdp_p, |
| 66 | "%s Warning: problem parsing %s", sdp_p->debug_str, attr_name); |
| 67 | sdp_p->conf_p->num_invalid_param++; |
| 68 | return -1; |
| 69 | } |
| 70 | |
| 71 | for (i=0; i < type_count; i++) { |
| 72 | if (!cpr_strncasecmpstrncasecmp(tmp, types[i].name, types[i].strlen)) { |
| 73 | return i; |
| 74 | } |
| 75 | } |
| 76 | return unknown_value; |
| 77 | } |
| 78 | |
| 79 | /* |
| 80 | * Helper function for adding nv-pair where value is string. |
| 81 | */ |
| 82 | static void sdp_append_name_and_string(flex_string *fs, |
| 83 | const char *name, |
| 84 | const char *value, |
| 85 | tinybool semicolon) |
| 86 | { |
| 87 | flex_string_sprintf(fs, "%s%s=%s", |
| 88 | semicolon ? ";" : "", |
| 89 | name, |
| 90 | value); |
| 91 | } |
| 92 | |
| 93 | /* |
| 94 | * Helper function for adding nv-pair where value is unsigned. |
| 95 | */ |
| 96 | static void sdp_append_name_and_unsigned(flex_string *fs, |
| 97 | const char *name, |
| 98 | unsigned int value, |
| 99 | tinybool semicolon) |
| 100 | { |
| 101 | flex_string_sprintf(fs, "%s%s=%u", |
| 102 | semicolon ? ";" : "", |
| 103 | name, |
| 104 | value); |
| 105 | } |
| 106 | |
| 107 | /* Function: sdp_parse_attribute |
| 108 | * Description: Figure out the type of attribute and call the appropriate |
| 109 | * parsing routine. If parsing errors are encountered, |
| 110 | * warnings will be printed and the attribute will be ignored. |
| 111 | * Unrecognized/invalid attributes do not cause overall parsing |
| 112 | * errors. All errors detected are noted as warnings. |
| 113 | * Parameters: sdp_p The SDP handle returned by sdp_init_description. |
| 114 | * level The level to check for the attribute. |
| 115 | * ptr Pointer to the attribute string to parse. |
| 116 | */ |
| 117 | sdp_result_e sdp_parse_attribute (sdp_t *sdp_p, uint16_t level, const char *ptr) |
| 118 | { |
| 119 | int i; |
| 120 | uint8_t xcpar_flag = FALSE0; |
| 121 | sdp_result_e result; |
| 122 | sdp_mca_t *mca_p=NULL((void*)0); |
| 123 | sdp_attr_t *attr_p; |
| 124 | sdp_attr_t *next_attr_p; |
| 125 | sdp_attr_t *prev_attr_p = NULL((void*)0); |
| 126 | char tmp[SDP_MAX_STRING_LEN256]; |
| 127 | |
| 128 | /* Validate the level */ |
| 129 | if (level != SDP_SESSION_LEVEL0xFFFF) { |
| 130 | mca_p = sdp_find_media_level(sdp_p, level); |
| 131 | if (mca_p == NULL((void*)0)) { |
| 132 | return (SDP_FAILURE); |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | /* Find the attribute type. */ |
| 137 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), ": \t", &result); |
| 138 | if (ptr == NULL((void*)0)) { |
| 139 | sdp_parse_error(sdp_p, |
| 140 | "%s No attribute type specified, parse failed.", sdp_p->debug_str); |
| 141 | sdp_p->conf_p->num_invalid_param++; |
| 142 | return (SDP_INVALID_PARAMETER); |
| 143 | } |
| 144 | if (ptr[0] == ':') { |
| 145 | /* Skip the ':' char for parsing attribute parameters. */ |
| 146 | ptr++; |
| 147 | } |
| 148 | if (result != SDP_SUCCESS) { |
| 149 | sdp_parse_error(sdp_p, |
| 150 | "%s No attribute type specified, parse failed.", sdp_p->debug_str); |
| 151 | sdp_p->conf_p->num_invalid_param++; |
| 152 | return (SDP_INVALID_PARAMETER); |
| 153 | } |
| 154 | |
| 155 | attr_p = (sdp_attr_t *)SDP_MALLOC(sizeof(sdp_attr_t))calloc(1, (sizeof(sdp_attr_t))); |
| 156 | if (attr_p == NULL((void*)0)) { |
| 157 | sdp_p->conf_p->num_no_resource++; |
| 158 | return (SDP_NO_RESOURCE); |
| 159 | } |
| 160 | attr_p->line_number = sdp_p->parse_line; |
| 161 | attr_p->type = SDP_ATTR_INVALID; |
| 162 | attr_p->next_p = NULL((void*)0); |
| 163 | for (i=0; i < SDP_MAX_ATTR_TYPES; i++) { |
| 164 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_attr[i].name, sdp_attr[i].strlen) == 0) { |
| 165 | attr_p->type = (sdp_attr_e)i; |
| 166 | break; |
| 167 | } |
| 168 | } |
| 169 | if (attr_p->type == SDP_ATTR_INVALID) { |
| 170 | sdp_parse_error(sdp_p, |
| 171 | "%s Warning: Unrecognized attribute (%s) ", |
| 172 | sdp_p->debug_str, tmp); |
| 173 | sdp_free_attr(attr_p); |
| 174 | return (SDP_SUCCESS); |
| 175 | } |
| 176 | |
| 177 | /* If this is an X-cpar or cpar attribute, set the flag. The attribute |
| 178 | * type will be changed by the parse. */ |
| 179 | if ((attr_p->type == SDP_ATTR_X_CPAR) || |
| 180 | (attr_p->type == SDP_ATTR_CPAR)) { |
| 181 | xcpar_flag = TRUE1; |
| 182 | } |
| 183 | |
| 184 | /* Parse the attribute. */ |
| 185 | result = sdp_attr[attr_p->type].parse_func(sdp_p, attr_p, ptr); |
| 186 | if (result != SDP_SUCCESS) { |
| 187 | sdp_free_attr(attr_p); |
| 188 | /* Return success so the parse won't fail. We don't want to |
| 189 | * fail on errors with attributes but just ignore them. |
| 190 | */ |
| 191 | return (SDP_SUCCESS); |
| 192 | } |
| 193 | |
| 194 | /* If this was an X-cpar/cpar attribute, it was hooked into the X-cap/cdsc |
| 195 | * structure, so we're finished. |
| 196 | */ |
| 197 | if (xcpar_flag == TRUE1) { |
| 198 | return (result); |
| 199 | } |
| 200 | |
| 201 | /* Add the attribute in the appropriate place. */ |
| 202 | if (level == SDP_SESSION_LEVEL0xFFFF) { |
| 203 | for (next_attr_p = sdp_p->sess_attrs_p; next_attr_p != NULL((void*)0); |
| 204 | prev_attr_p = next_attr_p, |
| 205 | next_attr_p = next_attr_p->next_p) { |
| 206 | ; /* Empty for */ |
| 207 | } |
| 208 | if (prev_attr_p == NULL((void*)0)) { |
| 209 | sdp_p->sess_attrs_p = attr_p; |
| 210 | } else { |
| 211 | prev_attr_p->next_p = attr_p; |
| 212 | } |
| 213 | } else { |
| 214 | for (next_attr_p = mca_p->media_attrs_p; next_attr_p != NULL((void*)0); |
| 215 | prev_attr_p = next_attr_p, |
| 216 | next_attr_p = next_attr_p->next_p) { |
| 217 | ; /* Empty for */ |
| 218 | } |
| 219 | if (prev_attr_p == NULL((void*)0)) { |
| 220 | mca_p->media_attrs_p = attr_p; |
| 221 | } else { |
| 222 | prev_attr_p->next_p = attr_p; |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | return (result); |
| 227 | } |
| 228 | |
| 229 | /* Build all of the attributes defined for the specified level. */ |
| 230 | sdp_result_e sdp_build_attribute (sdp_t *sdp_p, uint16_t level, flex_string *fs) |
| 231 | { |
| 232 | sdp_attr_t *attr_p; |
| 233 | sdp_mca_t *mca_p=NULL((void*)0); |
| 234 | sdp_result_e result; |
| 235 | |
| 236 | if (level == SDP_SESSION_LEVEL0xFFFF) { |
| 237 | attr_p = sdp_p->sess_attrs_p; |
| 238 | } else { |
| 239 | mca_p = sdp_find_media_level(sdp_p, level); |
| 240 | if (mca_p == NULL((void*)0)) { |
| 241 | return (SDP_FAILURE); |
| 242 | } |
| 243 | attr_p = mca_p->media_attrs_p; |
| 244 | } |
| 245 | /* Re-initialize the current capability number for this new level. */ |
| 246 | sdp_p->cur_cap_num = 1; |
| 247 | |
| 248 | /* Build all of the attributes for this level. Note that if there |
| 249 | * is a problem building an attribute, we don't fail but just ignore it.*/ |
| 250 | while (attr_p != NULL((void*)0)) { |
| 251 | if (attr_p->type >= SDP_MAX_ATTR_TYPES) { |
| 252 | if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) { |
| 253 | SDPLogDebug(logTag, "%s Invalid attribute type to build (%u)",SDPLog(SDP_LOG_DEBUG, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 254, logTag, "%s Invalid attribute type to build (%u)", sdp_p ->debug_str, (unsigned)attr_p->type) |
| 254 | sdp_p->debug_str, (unsigned)attr_p->type)SDPLog(SDP_LOG_DEBUG, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 254, logTag, "%s Invalid attribute type to build (%u)", sdp_p ->debug_str, (unsigned)attr_p->type); |
| 255 | } |
| 256 | } else { |
| 257 | result = sdp_attr[attr_p->type].build_func(sdp_p, attr_p, fs); |
| 258 | |
| 259 | if (result != SDP_SUCCESS) { |
| 260 | SDPLogError(logTag, "%s error building attribute %d", __FUNCTION__, result)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 260, logTag, "%s error building attribute %d", __FUNCTION__ , result); |
| 261 | return result; |
| 262 | } |
| 263 | |
| 264 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 265 | SDP_PRINT("%s Built a=%s attribute line", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 266, "sdp", "%s Built a=%s attribute line", sdp_p->debug_str , sdp_get_attr_name(attr_p->type)) |
| 266 | sdp_get_attr_name(attr_p->type))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 266, "sdp", "%s Built a=%s attribute line", sdp_p->debug_str , sdp_get_attr_name(attr_p->type)); |
| 267 | } |
| 268 | } |
| 269 | attr_p = attr_p->next_p; |
| 270 | } |
| 271 | |
| 272 | return SDP_SUCCESS; |
| 273 | } |
| 274 | |
| 275 | sdp_result_e sdp_parse_attr_simple_string (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 276 | const char *ptr) |
| 277 | { |
| 278 | sdp_result_e result; |
| 279 | |
| 280 | ptr = sdp_getnextstrtok(ptr, attr_p->attr.string_val, |
| 281 | sizeof(attr_p->attr.string_val), " \t", &result); |
| 282 | |
| 283 | if (result != SDP_SUCCESS) { |
| 284 | sdp_parse_error(sdp_p, |
| 285 | "%s Warning: No string token found for %s attribute", |
| 286 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type)); |
| 287 | sdp_p->conf_p->num_invalid_param++; |
| 288 | return (SDP_INVALID_PARAMETER); |
| 289 | } else { |
| 290 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 291 | SDP_PRINT("%s Parsed a=%s, %s", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 293, "sdp", "%s Parsed a=%s, %s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), attr_p->attr.string_val) |
| 292 | sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 293, "sdp", "%s Parsed a=%s, %s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), attr_p->attr.string_val) |
| 293 | attr_p->attr.string_val)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 293, "sdp", "%s Parsed a=%s, %s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), attr_p->attr.string_val); |
| 294 | } |
| 295 | return (SDP_SUCCESS); |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | sdp_result_e sdp_build_attr_simple_string (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 300 | flex_string *fs) |
| 301 | { |
| 302 | flex_string_sprintf(fs, "a=%s:%s\r\n", sdp_attr[attr_p->type].name, |
| 303 | attr_p->attr.string_val); |
| 304 | |
| 305 | return SDP_SUCCESS; |
| 306 | } |
| 307 | |
| 308 | sdp_result_e sdp_parse_attr_simple_u32 (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 309 | const char *ptr) |
| 310 | { |
| 311 | sdp_result_e result; |
| 312 | |
| 313 | attr_p->attr.u32_val = sdp_getnextnumtok(ptr, &ptr, " \t", &result); |
| 314 | |
| 315 | if (result != SDP_SUCCESS) { |
| 316 | sdp_parse_error(sdp_p, |
| 317 | "%s Warning: Numeric token for %s attribute not found", |
| 318 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type)); |
| 319 | sdp_p->conf_p->num_invalid_param++; |
| 320 | return (SDP_INVALID_PARAMETER); |
| 321 | } else { |
| 322 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 323 | SDP_PRINT("%s Parsed a=%s, %u", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 324, "sdp", "%s Parsed a=%s, %u", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), attr_p->attr.u32_val) |
| 324 | sdp_get_attr_name(attr_p->type), attr_p->attr.u32_val)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 324, "sdp", "%s Parsed a=%s, %u", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), attr_p->attr.u32_val); |
| 325 | } |
| 326 | return (SDP_SUCCESS); |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | sdp_result_e sdp_build_attr_simple_u32 (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 331 | flex_string *fs) |
| 332 | { |
| 333 | flex_string_sprintf(fs, "a=%s:%u\r\n", sdp_attr[attr_p->type].name, |
| 334 | attr_p->attr.u32_val); |
| 335 | |
| 336 | return SDP_SUCCESS; |
| 337 | } |
| 338 | |
| 339 | sdp_result_e sdp_parse_attr_simple_bool (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 340 | const char *ptr) |
| 341 | { |
| 342 | sdp_result_e result; |
| 343 | |
| 344 | if (sdp_getnextnumtok(ptr, &ptr, " \t", &result) == 0) { |
| 345 | attr_p->attr.boolean_val = FALSE0; |
| 346 | } else { |
| 347 | attr_p->attr.boolean_val= TRUE1; |
| 348 | } |
| 349 | |
| 350 | if (result != SDP_SUCCESS) { |
| 351 | sdp_parse_error(sdp_p, |
| 352 | "%s Warning: Boolean token for %s attribute not found", |
| 353 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type)); |
| 354 | sdp_p->conf_p->num_invalid_param++; |
| 355 | return (SDP_INVALID_PARAMETER); |
| 356 | } else { |
| 357 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 358 | if (attr_p->attr.boolean_val) { |
| 359 | SDP_PRINT("%s Parsed a=%s, boolean is TRUE", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 360, "sdp", "%s Parsed a=%s, boolean is TRUE", sdp_p->debug_str , sdp_get_attr_name(attr_p->type)) |
| 360 | sdp_get_attr_name(attr_p->type))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 360, "sdp", "%s Parsed a=%s, boolean is TRUE", sdp_p->debug_str , sdp_get_attr_name(attr_p->type)); |
| 361 | } else { |
| 362 | SDP_PRINT("%s Parsed a=%s, boolean is FALSE", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 363, "sdp", "%s Parsed a=%s, boolean is FALSE", sdp_p->debug_str , sdp_get_attr_name(attr_p->type)) |
| 363 | sdp_get_attr_name(attr_p->type))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 363, "sdp", "%s Parsed a=%s, boolean is FALSE", sdp_p->debug_str , sdp_get_attr_name(attr_p->type)); |
| 364 | } |
| 365 | } |
| 366 | return (SDP_SUCCESS); |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | sdp_result_e sdp_build_attr_simple_bool (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 371 | flex_string *fs) |
| 372 | { |
| 373 | flex_string_sprintf(fs, "a=%s:%s\r\n", sdp_attr[attr_p->type].name, |
| 374 | attr_p->attr.boolean_val ? "1" : "0"); |
| 375 | |
| 376 | return SDP_SUCCESS; |
| 377 | } |
| 378 | |
| 379 | /* |
| 380 | * sdp_parse_attr_maxprate |
| 381 | * |
| 382 | * This function parses maxprate attribute lines. The ABNF for this a= |
| 383 | * line is: |
| 384 | * max-p-rate-def = "a" "=" "maxprate" ":" packet-rate CRLF |
| 385 | * packet-rate = 1*DIGIT ["." 1*DIGIT] |
| 386 | * |
| 387 | * Returns: |
| 388 | * SDP_INVALID_PARAMETER - If we are unable to parse the string OR if |
| 389 | * packet-rate is not in the right format as per |
| 390 | * the ABNF. |
| 391 | * |
| 392 | * SDP_SUCCESS - If we are able to successfully parse the a= line. |
| 393 | */ |
| 394 | sdp_result_e sdp_parse_attr_maxprate (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 395 | const char *ptr) |
| 396 | { |
| 397 | sdp_result_e result; |
| 398 | |
| 399 | ptr = sdp_getnextstrtok(ptr, attr_p->attr.string_val, |
| 400 | sizeof(attr_p->attr.string_val), " \t", &result); |
| 401 | |
| 402 | if (result != SDP_SUCCESS) { |
| 403 | sdp_parse_error(sdp_p, |
| 404 | "%s Warning: No string token found for %s attribute", |
| 405 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type)); |
| 406 | sdp_p->conf_p->num_invalid_param++; |
| 407 | return (SDP_INVALID_PARAMETER); |
| 408 | } else { |
| 409 | if (!sdp_validate_maxprate(attr_p->attr.string_val)) { |
| 410 | sdp_parse_error(sdp_p, |
| 411 | "%s is not a valid maxprate value.", |
| 412 | attr_p->attr.string_val); |
| 413 | sdp_p->conf_p->num_invalid_param++; |
| 414 | return (SDP_INVALID_PARAMETER); |
| 415 | } |
| 416 | |
| 417 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 418 | SDP_PRINT("%s Parsed a=%s, %s", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 420, "sdp", "%s Parsed a=%s, %s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), attr_p->attr.string_val) |
| 419 | sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 420, "sdp", "%s Parsed a=%s, %s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), attr_p->attr.string_val) |
| 420 | attr_p->attr.string_val)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 420, "sdp", "%s Parsed a=%s, %s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), attr_p->attr.string_val); |
| 421 | } |
| 422 | return (SDP_SUCCESS); |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | /* |
| 427 | * sdp_attr_fmtp_no_value |
| 428 | * Helper function for sending the warning when a parameter value is |
| 429 | * missing. |
| 430 | * |
| 431 | */ |
| 432 | static void sdp_attr_fmtp_no_value(sdp_t *sdp, const char *param_name) |
| 433 | { |
| 434 | sdp_parse_error(sdp, |
| 435 | "%s Warning: No %s value specified for fmtp attribute", |
| 436 | sdp->debug_str, param_name); |
| 437 | sdp->conf_p->num_invalid_param++; |
| 438 | } |
| 439 | |
| 440 | /* |
| 441 | * sdp_attr_fmtp_invalid_value |
| 442 | * Helper function for sending the warning when a parameter value is |
| 443 | * incorrect. |
| 444 | * |
| 445 | */ |
| 446 | static void sdp_attr_fmtp_invalid_value(sdp_t *sdp, const char *param_name, |
| 447 | const char* param_value) |
| 448 | { |
| 449 | sdp_parse_error(sdp, |
| 450 | "%s Warning: Invalid %s: %s specified for fmtp attribute", |
| 451 | sdp->debug_str, param_name, param_value); |
| 452 | sdp->conf_p->num_invalid_param++; |
| 453 | } |
| 454 | |
| 455 | /* |
| 456 | * sdp_verify_attr_fmtp_telephone_event |
| 457 | * Helper function for verifying the telephone-event fmtp format |
| 458 | */ |
| 459 | static sdp_result_e sdp_verify_attr_fmtp_telephone_event(char *fmtpVal) |
| 460 | { |
| 461 | size_t len = fmtpVal ? strlen(fmtpVal) : 0; |
| 462 | |
| 463 | // make sure the basics are good: |
| 464 | // - at least 1 character |
| 465 | // - no illegal chars |
| 466 | // - first char is a number |
| 467 | if (len < 1 |
| 468 | || strspn(fmtpVal, "0123456789,-") != len |
| 469 | || PL_strstr(fmtpVal, ",,") |
| 470 | || fmtpVal[len-1] == ',' |
| 471 | || !('0' <= fmtpVal[0] && fmtpVal[0] <= '9')) { |
| 472 | return SDP_INVALID_PARAMETER; |
| 473 | } |
| 474 | |
| 475 | // Now that we've passed the basic sanity test, copy the string so we |
| 476 | // can tokenize and check the format of the tokens without disturbing |
| 477 | // the input string. |
| 478 | char dtmf_tones[SDP_MAX_STRING_LEN256+1]; |
| 479 | PL_strncpyz(dtmf_tones, fmtpVal, sizeof(dtmf_tones)); |
| 480 | |
| 481 | char *strtok_state; |
| 482 | char *temp = PL_strtok_r(dtmf_tones, ",", &strtok_state); |
| 483 | |
| 484 | while (temp != NULL((void*)0)) { |
| 485 | len = strlen(temp); |
| 486 | if (len > 5) { |
| 487 | // an example of a max size token is "11-15", so if the |
| 488 | // token is longer than 5 it is bad |
| 489 | return SDP_INVALID_PARAMETER; |
| 490 | } |
| 491 | |
| 492 | // case where we have 1 or 2 characters, example 4 or 23 |
| 493 | if (len < 3 && strspn(temp, "0123456789") != len) { |
| 494 | return SDP_INVALID_PARAMETER; |
| 495 | } else if (len >= 3) { |
| 496 | // case where we have 3-5 characters, ex 3-5, 2-33, or 10-20 |
| 497 | sdp_result_e result1 = SDP_SUCCESS; |
| 498 | sdp_result_e result2 = SDP_SUCCESS; |
| 499 | uint8_t low_val; |
| 500 | uint8_t high_val; |
| 501 | low_val = (uint8_t)sdp_getnextnumtok(temp, (const char **)&temp, |
| 502 | "-", &result1); |
| 503 | high_val = (uint8_t)sdp_getnextnumtok(temp, (const char **)&temp, |
| 504 | "-", &result2); |
| 505 | if (temp[0] // we don't want to find a second hyphen |
| 506 | || result1 != SDP_SUCCESS |
| 507 | || result2 != SDP_SUCCESS) { |
| 508 | return SDP_INVALID_PARAMETER; |
| 509 | } |
| 510 | |
| 511 | if (low_val > 99 |
| 512 | || high_val > 99 |
| 513 | || high_val <= low_val) { |
| 514 | return SDP_INVALID_PARAMETER; |
| 515 | } |
| 516 | } |
| 517 | |
| 518 | temp=PL_strtok_r(NULL((void*)0), ",", &strtok_state); |
| 519 | } |
| 520 | |
| 521 | return SDP_SUCCESS; |
| 522 | } |
| 523 | |
| 524 | /* Note: The fmtp attribute formats currently handled are: |
| 525 | * fmtp:<payload type> <event>,<event>... |
| 526 | * fmtp:<payload_type> [annexa=yes/no] [annexb=yes/no] [bitrate=<value>] |
| 527 | * [QCIF =<value>] [CIF =<value>] [MaxBR = <value>] one or more |
| 528 | * Other FMTP params as per H.263, H.263+, H.264 codec support. |
| 529 | * Note -"value" is a numeric value > 0 and each event is a |
| 530 | * single number or a range separated by a '-'. |
| 531 | * Example: fmtp:101 1,3-15,20 |
| 532 | * Video codecs have annexes that can be listed in the following legal formats: |
| 533 | * a) a=fmtp:34 param1=token;D;I;J;K=1;N=2;P=1,3 |
| 534 | * b) a=fmtp:34 param1=token;D;I;J;K=1;N=2;P=1,3;T |
| 535 | * c) a=fmtp:34 param1=token;D;I;J |
| 536 | * |
| 537 | */ |
| 538 | sdp_result_e sdp_get_fmtp_tok(sdp_t *sdp_p, |
| 539 | const char** fmtp_ptr, |
| 540 | const char* fmtp_name, |
| 541 | char* buf, |
| 542 | size_t buf_size, |
| 543 | char** tok) |
| 544 | { |
| 545 | sdp_result_e result1 = SDP_SUCCESS; |
| 546 | |
| 547 | *fmtp_ptr = sdp_getnextstrtok(*fmtp_ptr, buf, buf_size, "; \t", &result1); |
| 548 | if (result1 != SDP_SUCCESS) { |
| 549 | *fmtp_ptr = sdp_getnextstrtok(*fmtp_ptr, buf, buf_size, " \t", &result1); |
| 550 | if (result1 != SDP_SUCCESS) { |
| 551 | sdp_attr_fmtp_no_value(sdp_p, fmtp_name); |
| 552 | return SDP_INVALID_PARAMETER; |
| 553 | } |
| 554 | } |
| 555 | *tok = buf; |
| 556 | (*tok)++; |
| 557 | |
| 558 | return SDP_SUCCESS; |
| 559 | } |
| 560 | |
| 561 | sdp_result_e sdp_get_fmtp_tok_val(sdp_t *sdp_p, |
| 562 | const char** fmtp_ptr, |
| 563 | const char* fmtp_name, |
| 564 | char* buf, |
| 565 | size_t buf_size, |
| 566 | char** tok, |
| 567 | unsigned long* strtoul_result, |
| 568 | unsigned long illegal_value, |
| 569 | unsigned long min_limit, |
| 570 | unsigned long max_limit) |
| 571 | { |
| 572 | sdp_result_e result1 = SDP_SUCCESS; |
| 573 | unsigned long value; |
| 574 | char* strtoul_end; |
| 575 | |
| 576 | result1 = sdp_get_fmtp_tok(sdp_p, fmtp_ptr, fmtp_name, buf, buf_size, tok); |
| 577 | if (result1 != SDP_SUCCESS) return result1; |
| 578 | |
| 579 | errno(*__errno_location ()) = 0; |
| 580 | value = strtoul(*tok, &strtoul_end, 10); |
| 581 | |
| 582 | if (errno(*__errno_location ()) |
| 583 | || (*tok == strtoul_end) |
| 584 | || (illegal_value != ULONG_MAX(9223372036854775807L *2UL+1UL) && value == illegal_value) |
| 585 | || (min_limit != ULONG_MAX(9223372036854775807L *2UL+1UL) && value < min_limit) |
| 586 | || (max_limit != ULONG_MAX(9223372036854775807L *2UL+1UL) && value > max_limit)) { |
| 587 | sdp_attr_fmtp_invalid_value(sdp_p, fmtp_name, *tok); |
| 588 | return SDP_INVALID_PARAMETER; |
| 589 | } |
| 590 | *strtoul_result = value; |
| 591 | |
| 592 | return SDP_SUCCESS; |
| 593 | } |
| 594 | |
| 595 | sdp_result_e sdp_parse_attr_fmtp (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 596 | const char *ptr) |
| 597 | { |
| 598 | uint16_t i; |
| 599 | uint32_t mapword; |
| 600 | uint32_t bmap; |
| 601 | uint8_t low_val; |
| 602 | uint8_t high_val; |
| 603 | const char *ptr2; |
| 604 | const char *fmtp_ptr; |
| 605 | sdp_result_e result1 = SDP_SUCCESS; |
| 606 | sdp_result_e result2 = SDP_SUCCESS; |
| 607 | tinybool done = FALSE0; |
| 608 | tinybool codec_info_found = FALSE0; |
| 609 | sdp_fmtp_t *fmtp_p; |
| 610 | char tmp[SDP_MAX_STRING_LEN256]; |
| 611 | char *src_ptr; |
| 612 | char *temp_ptr = NULL((void*)0); |
| 613 | char *tok=NULL((void*)0); |
| 614 | char *temp=NULL((void*)0); |
| 615 | uint16_t custom_x=0; |
| 616 | uint16_t custom_y=0; |
| 617 | uint16_t custom_mpi=0; |
| 618 | uint16_t par_height=0; |
| 619 | uint16_t par_width=0; |
| 620 | uint16_t cpcf=0; |
| 621 | uint16_t iter=0; |
| 622 | |
| 623 | ulong l_val = 0; |
| 624 | char* strtok_state; |
| 625 | unsigned long strtoul_result; |
| 626 | char* strtoul_end; |
| 627 | |
| 628 | /* Find the payload type number. */ |
| 629 | attr_p->attr.fmtp.payload_num = (uint16_t)sdp_getnextnumtok(ptr, &ptr, |
| 630 | " \t", &result1); |
| 631 | if (result1 != SDP_SUCCESS) { |
| 632 | sdp_attr_fmtp_no_value(sdp_p, "payload type"); |
| 633 | return SDP_INVALID_PARAMETER; |
| 634 | } |
| 635 | fmtp_p = &(attr_p->attr.fmtp); |
| 636 | fmtp_p->fmtp_format = SDP_FMTP_UNKNOWN_TYPE; |
| 637 | fmtp_p->parameter_add = 1; |
| 638 | fmtp_p->flag = 0; |
| 639 | |
| 640 | /* |
| 641 | * set default value of packetization mode and level-asymmetry-allowed. If |
| 642 | * remote sdp does not specify any value for these two parameters, then the |
| 643 | * default value will be assumed for remote sdp. If remote sdp does specify |
| 644 | * any value for these parameters, then default value will be overridden. |
| 645 | */ |
| 646 | fmtp_p->packetization_mode = SDP_DEFAULT_PACKETIZATION_MODE_VALUE0; |
| 647 | fmtp_p->level_asymmetry_allowed = SDP_DEFAULT_LEVEL_ASYMMETRY_ALLOWED_VALUE0; |
| 648 | |
| 649 | temp_ptr = cpr_strdup(ptr); |
| 650 | if (temp_ptr == NULL((void*)0)) { |
| 651 | return (SDP_FAILURE); |
| 652 | } |
| 653 | fmtp_ptr = src_ptr = temp_ptr; |
| 654 | |
| 655 | src_ptr = temp_ptr; |
| 656 | while (!done) { |
| 657 | fmtp_ptr = sdp_getnextstrtok(fmtp_ptr, tmp, sizeof(tmp), "= \t", &result1); |
| 658 | if (result1 == SDP_SUCCESS) { |
| 659 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_fmtp_codec_param[1].name, |
| 660 | sdp_fmtp_codec_param[1].strlen) == 0) { |
| 661 | result1 = sdp_get_fmtp_tok(sdp_p, &fmtp_ptr, "annexb", tmp, sizeof(tmp), &tok); |
| 662 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 663 | |
| 664 | if (cpr_strncasecmpstrncasecmp(tok,sdp_fmtp_codec_param_val[0].name, |
| 665 | sdp_fmtp_codec_param_val[0].strlen) == 0) { |
| 666 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 667 | fmtp_p->annexb_required = TRUE1; |
| 668 | fmtp_p->annexb = TRUE1; |
| 669 | } else if (cpr_strncasecmpstrncasecmp(tok,sdp_fmtp_codec_param_val[1].name, |
| 670 | sdp_fmtp_codec_param_val[1].strlen) == 0) { |
| 671 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 672 | fmtp_p->annexb_required = TRUE1; |
| 673 | fmtp_p->annexb = FALSE0; |
| 674 | } else { |
| 675 | sdp_attr_fmtp_invalid_value(sdp_p, "annexb", tok); |
| 676 | SDP_FREEfree(temp_ptr); |
| 677 | return SDP_INVALID_PARAMETER; |
| 678 | } |
| 679 | codec_info_found = TRUE1; |
| 680 | |
| 681 | } else if (cpr_strncasecmpstrncasecmp(tmp, sdp_fmtp_codec_param[0].name, |
| 682 | sdp_fmtp_codec_param[0].strlen) == 0) { |
| 683 | result1 = sdp_get_fmtp_tok(sdp_p, &fmtp_ptr, "annexa", tmp, sizeof(tmp), &tok); |
| 684 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 685 | |
| 686 | if (cpr_strncasecmpstrncasecmp(tok,sdp_fmtp_codec_param_val[0].name, |
| 687 | sdp_fmtp_codec_param_val[0].strlen) == 0) { |
| 688 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 689 | fmtp_p->annexa = TRUE1; |
| 690 | fmtp_p->annexa_required = TRUE1; |
| 691 | } else if (cpr_strncasecmpstrncasecmp(tok,sdp_fmtp_codec_param_val[1].name, |
| 692 | sdp_fmtp_codec_param_val[1].strlen) == 0) { |
| 693 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 694 | fmtp_p->annexa = FALSE0; |
| 695 | fmtp_p->annexa_required = TRUE1; |
| 696 | } else { |
| 697 | sdp_attr_fmtp_invalid_value(sdp_p, "annexa", tok); |
| 698 | SDP_FREEfree(temp_ptr); |
| 699 | return SDP_INVALID_PARAMETER; |
| 700 | } |
| 701 | codec_info_found = TRUE1; |
| 702 | |
| 703 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[2].name, |
| 704 | sdp_fmtp_codec_param[2].strlen) == 0) { |
| 705 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "bitrate", tmp, sizeof(tmp), |
| 706 | &tok, &strtoul_result, 0, -1, UINT_MAX(2147483647 *2U +1U)); |
| 707 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 708 | |
| 709 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 710 | fmtp_p->bitrate = (uint32_t) strtoul_result; |
| 711 | codec_info_found = TRUE1; |
| 712 | |
| 713 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[41].name, |
| 714 | sdp_fmtp_codec_param[41].strlen) == 0) { |
| 715 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "mode", tmp, sizeof(tmp), |
| 716 | &tok, &strtoul_result, -1, -1, UINT_MAX(2147483647 *2U +1U)); |
| 717 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 718 | |
| 719 | fmtp_p->fmtp_format = SDP_FMTP_MODE; |
| 720 | fmtp_p->mode = (uint32_t) strtoul_result; |
| 721 | codec_info_found = TRUE1; |
| 722 | |
| 723 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[3].name, |
| 724 | sdp_fmtp_codec_param[3].strlen) == 0) { |
| 725 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "qcif", tmp, sizeof(tmp), |
| 726 | &tok, &strtoul_result, -1, SDP_MIN_CIF_VALUE1, SDP_MAX_CIF_VALUE32); |
| 727 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 728 | |
| 729 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 730 | fmtp_p->qcif = (uint16_t) strtoul_result; |
| 731 | codec_info_found = TRUE1; |
| 732 | |
| 733 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[4].name, |
| 734 | sdp_fmtp_codec_param[4].strlen) == 0) { |
| 735 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "cif", tmp, sizeof(tmp), |
| 736 | &tok, &strtoul_result, -1, SDP_MIN_CIF_VALUE1, SDP_MAX_CIF_VALUE32); |
| 737 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 738 | |
| 739 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 740 | fmtp_p->cif = (uint16_t) strtoul_result; |
| 741 | codec_info_found = TRUE1; |
| 742 | |
| 743 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[5].name, |
| 744 | sdp_fmtp_codec_param[5].strlen) == 0) { |
| 745 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "maxbr", tmp, sizeof(tmp), |
| 746 | &tok, &strtoul_result, 0, -1, USHRT_MAX(32767 * 2 + 1)); |
| 747 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 748 | |
| 749 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 750 | fmtp_p->maxbr = (uint16_t) strtoul_result; |
| 751 | codec_info_found = TRUE1; |
| 752 | |
| 753 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[6].name, |
| 754 | sdp_fmtp_codec_param[6].strlen) == 0) { |
| 755 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "sqcif", tmp, sizeof(tmp), |
| 756 | &tok, &strtoul_result, -1, SDP_MIN_CIF_VALUE1, SDP_MAX_CIF_VALUE32); |
| 757 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 758 | |
| 759 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 760 | fmtp_p->sqcif = (uint16_t) strtoul_result; |
| 761 | codec_info_found = TRUE1; |
| 762 | |
| 763 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[7].name, |
| 764 | sdp_fmtp_codec_param[7].strlen) == 0) { |
| 765 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "cif4", tmp, sizeof(tmp), |
| 766 | &tok, &strtoul_result, -1, SDP_MIN_CIF_VALUE1, SDP_MAX_CIF_VALUE32); |
| 767 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 768 | |
| 769 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 770 | fmtp_p->cif4 = (uint16_t) strtoul_result; |
| 771 | codec_info_found = TRUE1; |
| 772 | |
| 773 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[8].name, |
| 774 | sdp_fmtp_codec_param[8].strlen) == 0) { |
| 775 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "cif16", tmp, sizeof(tmp), |
| 776 | &tok, &strtoul_result, -1, SDP_MIN_CIF_VALUE1, SDP_MAX_CIF_VALUE32); |
| 777 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 778 | |
| 779 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 780 | fmtp_p->cif16 = (uint16_t) strtoul_result; |
| 781 | codec_info_found = TRUE1; |
| 782 | |
| 783 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[9].name, |
| 784 | sdp_fmtp_codec_param[9].strlen) == 0) { |
| 785 | result1 = sdp_get_fmtp_tok(sdp_p, &fmtp_ptr, "custom", tmp, sizeof(tmp), &tok); |
| 786 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 787 | |
| 788 | temp=PL_strtok_r(tok, ",", &strtok_state); |
| 789 | iter++; |
| 790 | if (temp) { |
| 791 | iter=1; |
| 792 | while (temp != NULL((void*)0)) { |
| 793 | errno(*__errno_location ()) = 0; |
| 794 | strtoul_result = strtoul(temp, &strtoul_end, 10); |
| 795 | |
| 796 | if (errno(*__errno_location ()) || temp == strtoul_end || strtoul_result > USHRT_MAX(32767 * 2 + 1)){ |
| 797 | custom_x = custom_y = custom_mpi = 0; |
| 798 | break; |
| 799 | } |
| 800 | |
| 801 | if (iter == 1) |
| 802 | custom_x = (uint16_t) strtoul_result; |
| 803 | if (iter == 2) |
| 804 | custom_y = (uint16_t) strtoul_result; |
| 805 | if (iter == 3) |
| 806 | custom_mpi = (uint16_t) strtoul_result; |
| 807 | |
| 808 | temp=PL_strtok_r(NULL((void*)0), ",", &strtok_state); |
| 809 | iter++; |
| 810 | } |
| 811 | } |
| 812 | |
| 813 | /* custom x,y and mpi values from tmp */ |
| 814 | if (!custom_x || !custom_y || !custom_mpi) { |
| 815 | sdp_attr_fmtp_invalid_value(sdp_p, "x/y/MPI", temp); |
| 816 | SDP_FREEfree(temp_ptr); |
| 817 | return SDP_INVALID_PARAMETER; |
| 818 | } |
| 819 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 820 | fmtp_p->custom_x = custom_x; |
| 821 | fmtp_p->custom_y = custom_y; |
| 822 | fmtp_p->custom_mpi = custom_mpi; |
| 823 | codec_info_found = TRUE1; |
| 824 | |
| 825 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[10].name, |
| 826 | sdp_fmtp_codec_param[10].strlen) == 0) { |
| 827 | result1 = sdp_get_fmtp_tok(sdp_p, &fmtp_ptr, "par", tmp, sizeof(tmp), &tok); |
| 828 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 829 | |
| 830 | temp=PL_strtok_r(tok, ":", &strtok_state); |
| 831 | if (temp) { |
| 832 | iter=1; |
| 833 | /* get par width and par height for the aspect ratio */ |
| 834 | while (temp != NULL((void*)0)) { |
| 835 | errno(*__errno_location ()) = 0; |
| 836 | strtoul_result = strtoul(temp, &strtoul_end, 10); |
| 837 | |
| 838 | if (errno(*__errno_location ()) || temp == strtoul_end || strtoul_result > USHRT_MAX(32767 * 2 + 1)) { |
| 839 | par_width = par_height = 0; |
| 840 | break; |
| 841 | } |
| 842 | |
| 843 | if (iter == 1) |
| 844 | par_width = (uint16_t) strtoul_result; |
| 845 | else |
| 846 | par_height = (uint16_t) strtoul_result; |
| 847 | |
| 848 | temp=PL_strtok_r(NULL((void*)0), ",", &strtok_state); |
| 849 | iter++; |
| 850 | } |
| 851 | } |
| 852 | if (!par_width || !par_height) { |
| 853 | sdp_attr_fmtp_invalid_value(sdp_p, "par_width or par_height", temp); |
| 854 | SDP_FREEfree(temp_ptr); |
| 855 | return SDP_INVALID_PARAMETER; |
| 856 | } |
| 857 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 858 | fmtp_p->par_width = par_width; |
| 859 | fmtp_p->par_height = par_height; |
| 860 | codec_info_found = TRUE1; |
| 861 | |
| 862 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[11].name, |
| 863 | sdp_fmtp_codec_param[11].strlen) == 0) { |
| 864 | result1 = sdp_get_fmtp_tok(sdp_p, &fmtp_ptr, "cpcf", tmp, sizeof(tmp), &tok); |
| 865 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 866 | |
| 867 | temp=PL_strtok_r(tok, ".", &strtok_state); |
| 868 | if ( temp != NULL((void*)0) ) { |
| 869 | errno(*__errno_location ()) = 0; |
| 870 | strtoul_result = strtoul(temp, &strtoul_end, 10); |
| 871 | |
| 872 | if (errno(*__errno_location ()) || temp == strtoul_end || strtoul_result > USHRT_MAX(32767 * 2 + 1)) { |
| 873 | cpcf = 0; |
| 874 | } else { |
| 875 | cpcf = (uint16_t) strtoul_result; |
| 876 | } |
| 877 | } |
| 878 | |
| 879 | if (!cpcf) { |
| 880 | sdp_attr_fmtp_invalid_value(sdp_p, "cpcf", tok); |
| 881 | SDP_FREEfree(temp_ptr); |
| 882 | return SDP_INVALID_PARAMETER; |
| 883 | } |
| 884 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 885 | fmtp_p->cpcf = cpcf; |
| 886 | codec_info_found = TRUE1; |
| 887 | |
| 888 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[12].name, |
| 889 | sdp_fmtp_codec_param[12].strlen) == 0) { |
| 890 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "bpp", tmp, sizeof(tmp), |
| 891 | &tok, &strtoul_result, 0, -1, USHRT_MAX(32767 * 2 + 1)); |
| 892 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 893 | |
| 894 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 895 | fmtp_p->bpp = (uint16_t) strtoul_result; |
| 896 | codec_info_found = TRUE1; |
| 897 | |
| 898 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[13].name, |
| 899 | sdp_fmtp_codec_param[13].strlen) == 0) { |
| 900 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "hrd", tmp, sizeof(tmp), |
| 901 | &tok, &strtoul_result, 0, -1, USHRT_MAX(32767 * 2 + 1)); |
| 902 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 903 | |
| 904 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 905 | fmtp_p->hrd = (uint16_t) strtoul_result; |
| 906 | codec_info_found = TRUE1; |
| 907 | |
| 908 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[14].name, |
| 909 | sdp_fmtp_codec_param[14].strlen) == 0) { |
| 910 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "profile", tmp, sizeof(tmp), |
| 911 | &tok, &strtoul_result, -1, -1, SDP_MAX_PROFILE_VALUE10); |
| 912 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 913 | |
| 914 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 915 | fmtp_p->profile = (short) strtoul_result; |
| 916 | fmtp_p->av1_has_profile = TRUE1; |
| 917 | fmtp_p->av1_profile = (uint8_t) strtoul_result; |
| 918 | codec_info_found = TRUE1; |
| 919 | |
| 920 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[15].name, |
| 921 | sdp_fmtp_codec_param[15].strlen) == 0) { |
| 922 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "level", tmp, sizeof(tmp), |
| 923 | &tok, &strtoul_result, -1, -1, SDP_MAX_LEVEL_VALUE100); |
| 924 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 925 | |
| 926 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 927 | fmtp_p->level = (short) strtoul_result; |
| 928 | codec_info_found = TRUE1; |
| 929 | |
| 930 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[16].name, |
| 931 | sdp_fmtp_codec_param[16].strlen) == 0) { |
| 932 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 933 | fmtp_p->is_interlace = TRUE1; |
| 934 | codec_info_found = TRUE1; |
| 935 | |
| 936 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[17].name, |
| 937 | sdp_fmtp_codec_param[17].strlen) == 0) { |
| 938 | result1 = sdp_get_fmtp_tok(sdp_p, &fmtp_ptr, "profile_level_id", tmp, sizeof(tmp), &tok); |
| 939 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 940 | |
| 941 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 942 | sstrncpy(fmtp_p->profile_level_id , tok, sizeof(fmtp_p->profile_level_id)); |
| 943 | codec_info_found = TRUE1; |
| 944 | |
| 945 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[18].name, |
| 946 | sdp_fmtp_codec_param[18].strlen) == 0) { |
| 947 | result1 = sdp_get_fmtp_tok(sdp_p, &fmtp_ptr, "parameter_sets", tmp, sizeof(tmp), &tok); |
| 948 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 949 | |
| 950 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 951 | sstrncpy(fmtp_p->parameter_sets , tok, sizeof(fmtp_p->parameter_sets)); |
| 952 | codec_info_found = TRUE1; |
| 953 | |
| 954 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[19].name, |
| 955 | sdp_fmtp_codec_param[19].strlen) == 0) { |
| 956 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "packetization_mode", tmp, sizeof(tmp), |
| 957 | &tok, &strtoul_result, -1, -1, 2); |
| 958 | // this one is different for some reason. Most others don't increment |
| 959 | // the num_invalid_param field. (mjf) |
| 960 | if (result1 == SDP_INVALID_PARAMETER) { sdp_p->conf_p->num_invalid_param++; } |
| 961 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 962 | |
| 963 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 964 | fmtp_p->packetization_mode = (int16_t) strtoul_result; |
| 965 | codec_info_found = TRUE1; |
| 966 | |
| 967 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[20].name, |
| 968 | sdp_fmtp_codec_param[20].strlen) == 0) { |
| 969 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "interleaving_depth", tmp, sizeof(tmp), |
| 970 | &tok, &strtoul_result, 0, -1, USHRT_MAX(32767 * 2 + 1)); |
| 971 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 972 | |
| 973 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 974 | fmtp_p->interleaving_depth = (uint16_t) strtoul_result; |
| 975 | codec_info_found = TRUE1; |
| 976 | |
| 977 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[21].name, |
| 978 | sdp_fmtp_codec_param[21].strlen) == 0) { |
| 979 | result1 = sdp_get_fmtp_tok(sdp_p, &fmtp_ptr, "deint_buf", tmp, sizeof(tmp), &tok); |
| 980 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 981 | |
| 982 | if (sdp_checkrange(sdp_p, tok, &l_val) == TRUE1) { |
| 983 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 984 | fmtp_p->deint_buf_req = (uint32_t) l_val; |
| 985 | fmtp_p->flag |= SDP_DEINT_BUF_REQ_FLAG0x1; |
| 986 | codec_info_found = TRUE1; |
| 987 | } else { |
| 988 | sdp_attr_fmtp_invalid_value(sdp_p, "deint_buf_req", tok); |
| 989 | SDP_FREEfree(temp_ptr); |
| 990 | return SDP_INVALID_PARAMETER; |
| 991 | } |
| 992 | |
| 993 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[22].name, |
| 994 | sdp_fmtp_codec_param[22].strlen) == 0) { |
| 995 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "max_don_diff", tmp, sizeof(tmp), |
| 996 | &tok, &strtoul_result, 0, -1, UINT_MAX(2147483647 *2U +1U)); |
| 997 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 998 | |
| 999 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1000 | fmtp_p->max_don_diff = (uint32_t) strtoul_result; |
| 1001 | codec_info_found = TRUE1; |
| 1002 | |
| 1003 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[23].name, |
| 1004 | sdp_fmtp_codec_param[23].strlen) == 0) { |
| 1005 | result1 = sdp_get_fmtp_tok(sdp_p, &fmtp_ptr, "init_buf_time", tmp, sizeof(tmp), &tok); |
| 1006 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1007 | |
| 1008 | if (sdp_checkrange(sdp_p, tok, &l_val) == TRUE1) { |
| 1009 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1010 | fmtp_p->init_buf_time = (uint32_t) l_val; |
| 1011 | fmtp_p->flag |= SDP_INIT_BUF_TIME_FLAG0x2; |
| 1012 | codec_info_found = TRUE1; |
| 1013 | } else { |
| 1014 | sdp_attr_fmtp_invalid_value(sdp_p, "init_buf_time", tok); |
| 1015 | SDP_FREEfree(temp_ptr); |
| 1016 | return SDP_INVALID_PARAMETER; |
| 1017 | } |
| 1018 | |
| 1019 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[24].name, |
| 1020 | sdp_fmtp_codec_param[24].strlen) == 0) { |
| 1021 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "max_mbps", tmp, sizeof(tmp), |
| 1022 | &tok, &strtoul_result, 0, -1, UINT_MAX(2147483647 *2U +1U)); |
| 1023 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1024 | |
| 1025 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1026 | fmtp_p->max_mbps = (uint32_t) strtoul_result; |
| 1027 | codec_info_found = TRUE1; |
| 1028 | |
| 1029 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[25].name, |
| 1030 | sdp_fmtp_codec_param[25].strlen) == 0) { |
| 1031 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "max-fs", tmp, sizeof(tmp), |
| 1032 | &tok, &strtoul_result, 0, -1, UINT_MAX(2147483647 *2U +1U)); |
| 1033 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1034 | |
| 1035 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1036 | fmtp_p->max_fs = (uint32_t) strtoul_result; |
| 1037 | codec_info_found = TRUE1; |
| 1038 | |
| 1039 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[26].name, |
| 1040 | sdp_fmtp_codec_param[26].strlen) == 0) { |
| 1041 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "max_cbp", tmp, sizeof(tmp), |
| 1042 | &tok, &strtoul_result, 0, -1, UINT_MAX(2147483647 *2U +1U)); |
| 1043 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1044 | |
| 1045 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1046 | fmtp_p->max_cpb = (uint32_t) strtoul_result; |
| 1047 | codec_info_found = TRUE1; |
| 1048 | |
| 1049 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[27].name, |
| 1050 | sdp_fmtp_codec_param[27].strlen) == 0) { |
| 1051 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "max_dpb", tmp, sizeof(tmp), |
| 1052 | &tok, &strtoul_result, 0, -1, UINT_MAX(2147483647 *2U +1U)); |
| 1053 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1054 | |
| 1055 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1056 | fmtp_p->max_dpb = (uint32_t) strtoul_result; |
| 1057 | codec_info_found = TRUE1; |
| 1058 | |
| 1059 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[28].name, |
| 1060 | sdp_fmtp_codec_param[28].strlen) == 0) { |
| 1061 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "max_br", tmp, sizeof(tmp), |
| 1062 | &tok, &strtoul_result, 0, -1, UINT_MAX(2147483647 *2U +1U)); |
| 1063 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1064 | |
| 1065 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1066 | fmtp_p->max_br = (uint32_t) strtoul_result; |
| 1067 | codec_info_found = TRUE1; |
| 1068 | |
| 1069 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[29].name, |
| 1070 | sdp_fmtp_codec_param[29].strlen) == 0) { |
| 1071 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "redundant_pic_cap", tmp, sizeof(tmp), |
| 1072 | &tok, &strtoul_result, 0, -1, 1); |
| 1073 | fmtp_p->redundant_pic_cap = (result1 == SDP_SUCCESS); |
| 1074 | codec_info_found = TRUE1; |
| 1075 | |
| 1076 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[30].name, |
| 1077 | sdp_fmtp_codec_param[30].strlen) == 0) { |
| 1078 | result1 = sdp_get_fmtp_tok(sdp_p, &fmtp_ptr, "deint_buf_cap", tmp, sizeof(tmp), &tok); |
| 1079 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1080 | |
| 1081 | if (sdp_checkrange(sdp_p, tok, &l_val) == TRUE1) { |
| 1082 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1083 | fmtp_p->deint_buf_cap = (uint32_t) l_val; |
| 1084 | fmtp_p->flag |= SDP_DEINT_BUF_CAP_FLAG0x8; |
| 1085 | codec_info_found = TRUE1; |
| 1086 | } else { |
| 1087 | sdp_attr_fmtp_invalid_value(sdp_p, "deint_buf_cap", tok); |
| 1088 | SDP_FREEfree(temp_ptr); |
| 1089 | return SDP_INVALID_PARAMETER; |
| 1090 | } |
| 1091 | |
| 1092 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[31].name, |
| 1093 | sdp_fmtp_codec_param[31].strlen) == 0) { |
| 1094 | result1 = sdp_get_fmtp_tok(sdp_p, &fmtp_ptr, "max_rcmd_nalu_size", tmp, sizeof(tmp), &tok); |
| 1095 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1096 | |
| 1097 | if (sdp_checkrange(sdp_p, tok, &l_val) == TRUE1) { |
| 1098 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1099 | fmtp_p->max_rcmd_nalu_size = (uint32_t) l_val; |
| 1100 | fmtp_p->flag |= SDP_MAX_RCMD_NALU_SIZE_FLAG0x4; |
| 1101 | codec_info_found = TRUE1; |
| 1102 | } else { |
| 1103 | sdp_attr_fmtp_invalid_value(sdp_p, "max_rcmd_nalu_size", tok); |
| 1104 | SDP_FREEfree(temp_ptr); |
| 1105 | return SDP_INVALID_PARAMETER; |
| 1106 | } |
| 1107 | |
| 1108 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[32].name, |
| 1109 | sdp_fmtp_codec_param[32].strlen) == 0) { |
| 1110 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "parameter_add", tmp, sizeof(tmp), |
| 1111 | &tok, &strtoul_result, 0, -1, 1); |
| 1112 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1113 | |
| 1114 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1115 | fmtp_p->parameter_add = (uint16_t) strtoul_result; |
| 1116 | codec_info_found = TRUE1; |
| 1117 | |
| 1118 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[33].name, |
| 1119 | sdp_fmtp_codec_param[33].strlen) == 0) { |
| 1120 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1121 | fmtp_p->annex_d = TRUE1; |
| 1122 | codec_info_found = TRUE1; |
| 1123 | |
| 1124 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[34].name, |
| 1125 | sdp_fmtp_codec_param[34].strlen) == 0) { |
| 1126 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1127 | fmtp_p->annex_f = TRUE1; |
| 1128 | codec_info_found = TRUE1; |
| 1129 | |
| 1130 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[35].name, |
| 1131 | sdp_fmtp_codec_param[35].strlen) == 0) { |
| 1132 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1133 | fmtp_p->annex_i = TRUE1; |
| 1134 | codec_info_found = TRUE1; |
| 1135 | |
| 1136 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[36].name, |
| 1137 | sdp_fmtp_codec_param[36].strlen) == 0) { |
| 1138 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1139 | fmtp_p->annex_j = TRUE1; |
| 1140 | codec_info_found = TRUE1; |
| 1141 | |
| 1142 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[37].name, |
| 1143 | sdp_fmtp_codec_param[36].strlen) == 0) { |
| 1144 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1145 | fmtp_p->annex_t = TRUE1; |
| 1146 | codec_info_found = TRUE1; |
| 1147 | |
| 1148 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[38].name, |
| 1149 | sdp_fmtp_codec_param[38].strlen) == 0) { |
| 1150 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "annex_k", tmp, sizeof(tmp), |
| 1151 | &tok, &strtoul_result, 0, -1, USHRT_MAX(32767 * 2 + 1)); |
| 1152 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1153 | |
| 1154 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1155 | fmtp_p->annex_k_val = (uint16_t) strtoul_result; |
| 1156 | codec_info_found = TRUE1; |
| 1157 | |
| 1158 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[39].name, |
| 1159 | sdp_fmtp_codec_param[39].strlen) == 0) { |
| 1160 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "annex_n", tmp, sizeof(tmp), |
| 1161 | &tok, &strtoul_result, 0, -1, USHRT_MAX(32767 * 2 + 1)); |
| 1162 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1163 | |
| 1164 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1165 | fmtp_p->annex_n_val = (uint16_t) strtoul_result; |
| 1166 | codec_info_found = TRUE1; |
| 1167 | |
| 1168 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[40].name, |
| 1169 | sdp_fmtp_codec_param[40].strlen) == 0) { |
| 1170 | result1 = sdp_get_fmtp_tok(sdp_p, &fmtp_ptr, "annex_p", tmp, sizeof(tmp), &tok); |
| 1171 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1172 | |
| 1173 | fmtp_p->annex_p_val_picture_resize = 0; |
| 1174 | fmtp_p->annex_p_val_warp = 0; |
| 1175 | temp = PL_strtok_r(tok, ",", &strtok_state); |
| 1176 | if (temp) { |
| 1177 | iter=1; |
| 1178 | while (temp != NULL((void*)0)) { |
| 1179 | errno(*__errno_location ()) = 0; |
| 1180 | strtoul_result = strtoul(temp, &strtoul_end, 10); |
| 1181 | |
| 1182 | if (errno(*__errno_location ()) || temp == strtoul_end || strtoul_result > USHRT_MAX(32767 * 2 + 1)) { |
| 1183 | break; |
| 1184 | } |
| 1185 | |
| 1186 | if (iter == 1) |
| 1187 | fmtp_p->annex_p_val_picture_resize = (uint16_t) strtoul_result; |
| 1188 | else if (iter == 2) |
| 1189 | fmtp_p->annex_p_val_warp = (uint16_t) strtoul_result; |
| 1190 | |
| 1191 | temp = PL_strtok_r(NULL((void*)0), ",", &strtok_state); |
| 1192 | iter++; |
| 1193 | } |
| 1194 | } else { |
| 1195 | SDP_FREEfree(temp_ptr); |
| 1196 | return SDP_INVALID_PARAMETER; |
| 1197 | } |
| 1198 | |
| 1199 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1200 | codec_info_found = TRUE1; |
| 1201 | |
| 1202 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[42].name, |
| 1203 | sdp_fmtp_codec_param[42].strlen) == 0) { |
| 1204 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "level_asymmetry_allowed", tmp, sizeof(tmp), |
| 1205 | &tok, &strtoul_result, -1, -1, SDP_MAX_LEVEL_ASYMMETRY_ALLOWED_VALUE1); |
| 1206 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1207 | |
| 1208 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1209 | fmtp_p->level_asymmetry_allowed = (int) strtoul_result; |
| 1210 | codec_info_found = TRUE1; |
| 1211 | |
| 1212 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[43].name, |
| 1213 | sdp_fmtp_codec_param[43].strlen) == 0) { |
| 1214 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "maxaveragebitrate", tmp, sizeof(tmp), |
| 1215 | &tok, &strtoul_result, 0, -1, UINT_MAX(2147483647 *2U +1U)); |
| 1216 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1217 | |
| 1218 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1219 | fmtp_p->maxaveragebitrate = (uint32_t) strtoul_result; |
| 1220 | codec_info_found = TRUE1; |
| 1221 | |
| 1222 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[44].name, |
| 1223 | sdp_fmtp_codec_param[44].strlen) == 0) { |
| 1224 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "usedtx", tmp, sizeof(tmp), |
| 1225 | &tok, &strtoul_result, -1, -1, 1); |
| 1226 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1227 | |
| 1228 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1229 | fmtp_p->usedtx = (uint16_t) strtoul_result; |
| 1230 | codec_info_found = TRUE1; |
| 1231 | |
| 1232 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[45].name, |
| 1233 | sdp_fmtp_codec_param[45].strlen) == 0) { |
| 1234 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "stereo", tmp, sizeof(tmp), |
| 1235 | &tok, &strtoul_result, -1, -1, 1); |
| 1236 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1237 | |
| 1238 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1239 | fmtp_p->stereo = (uint16_t) strtoul_result; |
| 1240 | codec_info_found = TRUE1; |
| 1241 | |
| 1242 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[46].name, |
| 1243 | sdp_fmtp_codec_param[46].strlen) == 0) { |
| 1244 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "useinbandfec", tmp, sizeof(tmp), |
| 1245 | &tok, &strtoul_result, -1, -1, 1); |
| 1246 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1247 | |
| 1248 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1249 | fmtp_p->useinbandfec = (uint16_t) strtoul_result; |
| 1250 | codec_info_found = TRUE1; |
| 1251 | |
| 1252 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[47].name, |
| 1253 | sdp_fmtp_codec_param[47].strlen) == 0) { |
| 1254 | result1 = sdp_get_fmtp_tok(sdp_p, &fmtp_ptr, "maxcodedaudiobandwidth", tmp, sizeof(tmp), &tok); |
| 1255 | // this one is different for some reason. Most others don't increment |
| 1256 | // the num_invalid_param field. (mjf) |
| 1257 | if (result1 == SDP_INVALID_PARAMETER) { sdp_p->conf_p->num_invalid_param++; } |
| 1258 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1259 | |
| 1260 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1261 | sstrncpy(fmtp_p->maxcodedaudiobandwidth , tok, sizeof(fmtp_p->maxcodedaudiobandwidth)); |
| 1262 | codec_info_found = TRUE1; |
| 1263 | |
| 1264 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[48].name, |
| 1265 | sdp_fmtp_codec_param[48].strlen) == 0) { |
| 1266 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "cbr", tmp, sizeof(tmp), |
| 1267 | &tok, &strtoul_result, -1, -1, 1); |
| 1268 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1269 | |
| 1270 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1271 | fmtp_p->cbr = (uint16_t) strtoul_result; |
| 1272 | codec_info_found = TRUE1; |
| 1273 | |
| 1274 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[49].name, |
| 1275 | sdp_fmtp_codec_param[49].strlen) == 0) { |
| 1276 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "max-fr", tmp, sizeof(tmp), |
| 1277 | &tok, &strtoul_result, 0, -1, UINT_MAX(2147483647 *2U +1U)); |
| 1278 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1279 | |
| 1280 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1281 | fmtp_p->max_fr = (uint32_t) strtoul_result; |
| 1282 | codec_info_found = TRUE1; |
| 1283 | |
| 1284 | } else if (cpr_strncasecmpstrncasecmp(tmp,sdp_fmtp_codec_param[50].name, |
| 1285 | sdp_fmtp_codec_param[50].strlen) == 0) { |
| 1286 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "maxplaybackrate", tmp, sizeof(tmp), |
| 1287 | &tok, &strtoul_result, 0, -1, UINT_MAX(2147483647 *2U +1U)); |
| 1288 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1289 | |
| 1290 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1291 | fmtp_p->maxplaybackrate = (uint32_t) strtoul_result; |
| 1292 | codec_info_found = TRUE1; |
| 1293 | |
| 1294 | } else if (cpr_strncasecmpstrncasecmp(tmp, sdp_fmtp_codec_param[51].name, |
| 1295 | sdp_fmtp_codec_param[51].strlen) == 0) { |
| 1296 | result1 = |
| 1297 | sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "apt", tmp, sizeof(tmp), |
| 1298 | &tok, &strtoul_result, -1, 0, UINT8_MAX(255)); |
| 1299 | if (result1 != SDP_SUCCESS) { |
| 1300 | SDP_FREEfree(temp_ptr); |
| 1301 | return result1; |
| 1302 | } |
| 1303 | |
| 1304 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1305 | fmtp_p->apt = (uint8_t)strtoul_result; |
| 1306 | |
| 1307 | codec_info_found = TRUE1; |
| 1308 | |
| 1309 | } else if (cpr_strncasecmpstrncasecmp(tmp, sdp_fmtp_codec_param[52].name, |
| 1310 | sdp_fmtp_codec_param[52].strlen) == 0) { |
| 1311 | |
| 1312 | result1 = |
| 1313 | sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "rtx_time", tmp, sizeof(tmp), |
| 1314 | &tok, &strtoul_result, -1, 0, UINT_MAX(2147483647 *2U +1U)); |
| 1315 | if (result1 != SDP_SUCCESS) { |
| 1316 | SDP_FREEfree(temp_ptr); |
| 1317 | return result1; |
| 1318 | } |
| 1319 | |
| 1320 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1321 | fmtp_p->has_rtx_time = TRUE1; |
| 1322 | fmtp_p->rtx_time = (uint32_t)strtoul_result; |
| 1323 | |
| 1324 | codec_info_found = TRUE1; |
| 1325 | } else if (cpr_strncasecmpstrncasecmp(tmp, sdp_fmtp_codec_param[53].name, |
| 1326 | sdp_fmtp_codec_param[53].strlen) == 0) { |
| 1327 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "level-idx", tmp, sizeof(tmp), |
| 1328 | &tok, &strtoul_result, -1, 0, UINT8_MAX(255)); |
| 1329 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1330 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1331 | fmtp_p->av1_has_level_idx = TRUE1; |
| 1332 | fmtp_p->av1_level_idx = (uint8_t)strtoul_result; |
| 1333 | codec_info_found = TRUE1; |
| 1334 | } else if (cpr_strncasecmpstrncasecmp(tmp, sdp_fmtp_codec_param[54].name, |
| 1335 | sdp_fmtp_codec_param[54].strlen) == 0) { |
| 1336 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "tier", tmp, sizeof(tmp), |
| 1337 | &tok, &strtoul_result, -1, 0, UINT8_MAX(255)); |
| 1338 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1339 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1340 | fmtp_p->av1_has_tier = TRUE1; |
| 1341 | fmtp_p->av1_tier = (uint8_t)strtoul_result; |
| 1342 | codec_info_found = TRUE1; |
| 1343 | } else if (cpr_strncasecmpstrncasecmp(tmp, sdp_fmtp_codec_param[55].name, |
| 1344 | sdp_fmtp_codec_param[55].strlen) == 0) { |
| 1345 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "ptime", tmp, sizeof(tmp), |
| 1346 | &tok, &strtoul_result, 0, -1, UINT_MAX(2147483647 *2U +1U)); |
| 1347 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1348 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1349 | fmtp_p->opus_ptime = (uint32_t)strtoul_result; |
| 1350 | codec_info_found = TRUE1; |
| 1351 | } else if (cpr_strncasecmpstrncasecmp(tmp, sdp_fmtp_codec_param[56].name, |
| 1352 | sdp_fmtp_codec_param[56].strlen) == 0) { |
| 1353 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "minptime", tmp, sizeof(tmp), |
| 1354 | &tok, &strtoul_result, 0, -1, UINT_MAX(2147483647 *2U +1U)); |
| 1355 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1356 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1357 | fmtp_p->opus_minptime = (uint32_t)strtoul_result; |
| 1358 | codec_info_found = TRUE1; |
| 1359 | } else if (cpr_strncasecmpstrncasecmp(tmp, sdp_fmtp_codec_param[57].name, |
| 1360 | sdp_fmtp_codec_param[57].strlen) == 0) { |
| 1361 | result1 = sdp_get_fmtp_tok_val(sdp_p, &fmtp_ptr, "maxptime", tmp, sizeof(tmp), |
| 1362 | &tok, &strtoul_result, 0, -1, UINT_MAX(2147483647 *2U +1U)); |
| 1363 | if (result1 != SDP_SUCCESS) { SDP_FREEfree(temp_ptr); return result1; } |
| 1364 | fmtp_p->fmtp_format = SDP_FMTP_CODEC_INFO; |
| 1365 | fmtp_p->opus_maxptime = (uint32_t)strtoul_result; |
| 1366 | codec_info_found = TRUE1; |
| 1367 | } else if (strchr(tmp, '/')) { |
| 1368 | // XXX Note that because RFC 5109 so conveniently specified |
| 1369 | // this fmtp with no param names, we hope that nothing else |
| 1370 | // has a slash in the string because otherwise we won't know |
| 1371 | // how to differentiate. |
| 1372 | temp=PL_strtok_r(tmp, "/", &strtok_state); |
| 1373 | if (temp) { |
| 1374 | iter = 0; |
| 1375 | while (temp != NULL((void*)0)) { |
| 1376 | errno(*__errno_location ()) = 0; |
| 1377 | strtoul_result = strtoul(temp, &strtoul_end, 10); |
| 1378 | |
| 1379 | if (errno(*__errno_location ()) || |
| 1380 | temp == strtoul_end || strtoul_result > USHRT_MAX(32767 * 2 + 1)) { |
| 1381 | temp = NULL((void*)0); |
| 1382 | continue; |
| 1383 | } |
| 1384 | fmtp_p->redundant_encodings[iter++] = |
| 1385 | (uint8_t)strtoul_result; |
| 1386 | temp=PL_strtok_r(NULL((void*)0), "/", &strtok_state); |
| 1387 | } |
| 1388 | } /* if (temp) */ |
| 1389 | } else if (SDP_SUCCESS == sdp_verify_attr_fmtp_telephone_event(tmp)) { |
| 1390 | // XXX Note that DTMF fmtp will fall into here: |
| 1391 | // a=fmtp:101 0-15 (or 0-15,NN,NN etc) |
| 1392 | sstrncpy(fmtp_p->dtmf_tones , tmp, sizeof(fmtp_p->dtmf_tones)); |
| 1393 | codec_info_found = TRUE1; |
| 1394 | } else if (fmtp_ptr != NULL((void*)0) && *fmtp_ptr == '\n') { |
| 1395 | temp=PL_strtok_r(tmp, ";", &strtok_state); |
| 1396 | if (temp) { |
| 1397 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 1398 | SDP_PRINT("%s Annexes are possibly there for this fmtp %s tmp: %s line\n",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1399, "sdp", "%s Annexes are possibly there for this fmtp %s tmp: %s line\n" , sdp_p->debug_str, fmtp_ptr, tmp) |
| 1399 | sdp_p->debug_str, fmtp_ptr, tmp)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1399, "sdp", "%s Annexes are possibly there for this fmtp %s tmp: %s line\n" , sdp_p->debug_str, fmtp_ptr, tmp); |
| 1400 | } |
| 1401 | while (temp != NULL((void*)0)) { |
| 1402 | if (strchr(temp, 'D') !=NULL((void*)0)) { |
| 1403 | attr_p->attr.fmtp.annex_d = TRUE1; |
| 1404 | } |
| 1405 | if (strchr(temp, 'F') !=NULL((void*)0)) { |
| 1406 | attr_p->attr.fmtp.annex_f = TRUE1; |
| 1407 | } |
| 1408 | if (strchr(temp, 'I') !=NULL((void*)0)) { |
| 1409 | attr_p->attr.fmtp.annex_i = TRUE1; |
| 1410 | } |
| 1411 | if (strchr(temp, 'J') !=NULL((void*)0)) { |
| 1412 | attr_p->attr.fmtp.annex_j = TRUE1; |
| 1413 | } |
| 1414 | if (strchr(temp, 'T') !=NULL((void*)0)) { |
| 1415 | attr_p->attr.fmtp.annex_t = TRUE1; |
| 1416 | } |
| 1417 | temp=PL_strtok_r(NULL((void*)0), ";", &strtok_state); |
| 1418 | } |
| 1419 | } /* if (temp) */ |
| 1420 | done = TRUE1; |
| 1421 | } else { |
| 1422 | // unknown parameter - eat chars until ';' |
| 1423 | SDPLogDebug(logTag, "%s Unknown fmtp type (%s) - ignoring", __FUNCTION__,SDPLog(SDP_LOG_DEBUG, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1424, logTag, "%s Unknown fmtp type (%s) - ignoring", __FUNCTION__ , tmp) |
| 1424 | tmp)SDPLog(SDP_LOG_DEBUG, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1424, logTag, "%s Unknown fmtp type (%s) - ignoring", __FUNCTION__ , tmp); |
| 1425 | fmtp_ptr = sdp_getnextstrtok(fmtp_ptr, tmp, sizeof(tmp), "; \t", |
| 1426 | &result1); |
| 1427 | if (result1 != SDP_SUCCESS) { |
| 1428 | fmtp_ptr = sdp_getnextstrtok(fmtp_ptr, tmp, sizeof(tmp), " \t", &result1); |
| 1429 | if (result1 != SDP_SUCCESS) { |
| 1430 | // hmmm, no ; or spaces or tabs; continue on |
| 1431 | } |
| 1432 | } |
| 1433 | } |
| 1434 | if (*fmtp_ptr == '\n') { |
| 1435 | // reached end of line, stop parsing |
| 1436 | done = TRUE1; |
| 1437 | } else { |
| 1438 | fmtp_ptr++; |
| 1439 | } |
| 1440 | } else { |
| 1441 | done = TRUE1; |
| 1442 | } |
| 1443 | } /* while - done loop*/ |
| 1444 | |
| 1445 | if (codec_info_found) { |
| 1446 | |
| 1447 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 1448 | SDP_PRINT("%s Parsed a=%s, payload type %u, bitrate %u, mode %u QCIF = %u, CIF = %u, MAXBR= %u, SQCIF=%u, CIF4= %u, CIF16=%u, CUSTOM=%u,%u,%u , PAR=%u:%u,CPCF=%u, BPP=%u, HRD=%u \n",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1467, "sdp", "%s Parsed a=%s, payload type %u, bitrate %u, mode %u QCIF = %u, CIF = %u, MAXBR= %u, SQCIF=%u, CIF4= %u, CIF16=%u, CUSTOM=%u,%u,%u , PAR=%u:%u,CPCF=%u, BPP=%u, HRD=%u \n" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.bitrate, attr_p ->attr.fmtp.mode, attr_p->attr.fmtp.qcif, attr_p->attr .fmtp.cif, attr_p->attr.fmtp.maxbr, attr_p->attr.fmtp.sqcif , attr_p->attr.fmtp.cif4, attr_p->attr.fmtp.cif16, attr_p ->attr.fmtp.custom_x,attr_p->attr.fmtp.custom_y, attr_p ->attr.fmtp.custom_mpi, attr_p->attr.fmtp.par_width, attr_p ->attr.fmtp.par_height, attr_p->attr.fmtp.cpcf, attr_p-> attr.fmtp.bpp, attr_p->attr.fmtp.hrd) |
| 1449 | sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1467, "sdp", "%s Parsed a=%s, payload type %u, bitrate %u, mode %u QCIF = %u, CIF = %u, MAXBR= %u, SQCIF=%u, CIF4= %u, CIF16=%u, CUSTOM=%u,%u,%u , PAR=%u:%u,CPCF=%u, BPP=%u, HRD=%u \n" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.bitrate, attr_p ->attr.fmtp.mode, attr_p->attr.fmtp.qcif, attr_p->attr .fmtp.cif, attr_p->attr.fmtp.maxbr, attr_p->attr.fmtp.sqcif , attr_p->attr.fmtp.cif4, attr_p->attr.fmtp.cif16, attr_p ->attr.fmtp.custom_x,attr_p->attr.fmtp.custom_y, attr_p ->attr.fmtp.custom_mpi, attr_p->attr.fmtp.par_width, attr_p ->attr.fmtp.par_height, attr_p->attr.fmtp.cpcf, attr_p-> attr.fmtp.bpp, attr_p->attr.fmtp.hrd) |
| 1450 | sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1467, "sdp", "%s Parsed a=%s, payload type %u, bitrate %u, mode %u QCIF = %u, CIF = %u, MAXBR= %u, SQCIF=%u, CIF4= %u, CIF16=%u, CUSTOM=%u,%u,%u , PAR=%u:%u,CPCF=%u, BPP=%u, HRD=%u \n" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.bitrate, attr_p ->attr.fmtp.mode, attr_p->attr.fmtp.qcif, attr_p->attr .fmtp.cif, attr_p->attr.fmtp.maxbr, attr_p->attr.fmtp.sqcif , attr_p->attr.fmtp.cif4, attr_p->attr.fmtp.cif16, attr_p ->attr.fmtp.custom_x,attr_p->attr.fmtp.custom_y, attr_p ->attr.fmtp.custom_mpi, attr_p->attr.fmtp.par_width, attr_p ->attr.fmtp.par_height, attr_p->attr.fmtp.cpcf, attr_p-> attr.fmtp.bpp, attr_p->attr.fmtp.hrd) |
| 1451 | attr_p->attr.fmtp.payload_num,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1467, "sdp", "%s Parsed a=%s, payload type %u, bitrate %u, mode %u QCIF = %u, CIF = %u, MAXBR= %u, SQCIF=%u, CIF4= %u, CIF16=%u, CUSTOM=%u,%u,%u , PAR=%u:%u,CPCF=%u, BPP=%u, HRD=%u \n" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.bitrate, attr_p ->attr.fmtp.mode, attr_p->attr.fmtp.qcif, attr_p->attr .fmtp.cif, attr_p->attr.fmtp.maxbr, attr_p->attr.fmtp.sqcif , attr_p->attr.fmtp.cif4, attr_p->attr.fmtp.cif16, attr_p ->attr.fmtp.custom_x,attr_p->attr.fmtp.custom_y, attr_p ->attr.fmtp.custom_mpi, attr_p->attr.fmtp.par_width, attr_p ->attr.fmtp.par_height, attr_p->attr.fmtp.cpcf, attr_p-> attr.fmtp.bpp, attr_p->attr.fmtp.hrd) |
| 1452 | attr_p->attr.fmtp.bitrate,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1467, "sdp", "%s Parsed a=%s, payload type %u, bitrate %u, mode %u QCIF = %u, CIF = %u, MAXBR= %u, SQCIF=%u, CIF4= %u, CIF16=%u, CUSTOM=%u,%u,%u , PAR=%u:%u,CPCF=%u, BPP=%u, HRD=%u \n" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.bitrate, attr_p ->attr.fmtp.mode, attr_p->attr.fmtp.qcif, attr_p->attr .fmtp.cif, attr_p->attr.fmtp.maxbr, attr_p->attr.fmtp.sqcif , attr_p->attr.fmtp.cif4, attr_p->attr.fmtp.cif16, attr_p ->attr.fmtp.custom_x,attr_p->attr.fmtp.custom_y, attr_p ->attr.fmtp.custom_mpi, attr_p->attr.fmtp.par_width, attr_p ->attr.fmtp.par_height, attr_p->attr.fmtp.cpcf, attr_p-> attr.fmtp.bpp, attr_p->attr.fmtp.hrd) |
| 1453 | attr_p->attr.fmtp.mode,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1467, "sdp", "%s Parsed a=%s, payload type %u, bitrate %u, mode %u QCIF = %u, CIF = %u, MAXBR= %u, SQCIF=%u, CIF4= %u, CIF16=%u, CUSTOM=%u,%u,%u , PAR=%u:%u,CPCF=%u, BPP=%u, HRD=%u \n" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.bitrate, attr_p ->attr.fmtp.mode, attr_p->attr.fmtp.qcif, attr_p->attr .fmtp.cif, attr_p->attr.fmtp.maxbr, attr_p->attr.fmtp.sqcif , attr_p->attr.fmtp.cif4, attr_p->attr.fmtp.cif16, attr_p ->attr.fmtp.custom_x,attr_p->attr.fmtp.custom_y, attr_p ->attr.fmtp.custom_mpi, attr_p->attr.fmtp.par_width, attr_p ->attr.fmtp.par_height, attr_p->attr.fmtp.cpcf, attr_p-> attr.fmtp.bpp, attr_p->attr.fmtp.hrd) |
| 1454 | attr_p->attr.fmtp.qcif,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1467, "sdp", "%s Parsed a=%s, payload type %u, bitrate %u, mode %u QCIF = %u, CIF = %u, MAXBR= %u, SQCIF=%u, CIF4= %u, CIF16=%u, CUSTOM=%u,%u,%u , PAR=%u:%u,CPCF=%u, BPP=%u, HRD=%u \n" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.bitrate, attr_p ->attr.fmtp.mode, attr_p->attr.fmtp.qcif, attr_p->attr .fmtp.cif, attr_p->attr.fmtp.maxbr, attr_p->attr.fmtp.sqcif , attr_p->attr.fmtp.cif4, attr_p->attr.fmtp.cif16, attr_p ->attr.fmtp.custom_x,attr_p->attr.fmtp.custom_y, attr_p ->attr.fmtp.custom_mpi, attr_p->attr.fmtp.par_width, attr_p ->attr.fmtp.par_height, attr_p->attr.fmtp.cpcf, attr_p-> attr.fmtp.bpp, attr_p->attr.fmtp.hrd) |
| 1455 | attr_p->attr.fmtp.cif,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1467, "sdp", "%s Parsed a=%s, payload type %u, bitrate %u, mode %u QCIF = %u, CIF = %u, MAXBR= %u, SQCIF=%u, CIF4= %u, CIF16=%u, CUSTOM=%u,%u,%u , PAR=%u:%u,CPCF=%u, BPP=%u, HRD=%u \n" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.bitrate, attr_p ->attr.fmtp.mode, attr_p->attr.fmtp.qcif, attr_p->attr .fmtp.cif, attr_p->attr.fmtp.maxbr, attr_p->attr.fmtp.sqcif , attr_p->attr.fmtp.cif4, attr_p->attr.fmtp.cif16, attr_p ->attr.fmtp.custom_x,attr_p->attr.fmtp.custom_y, attr_p ->attr.fmtp.custom_mpi, attr_p->attr.fmtp.par_width, attr_p ->attr.fmtp.par_height, attr_p->attr.fmtp.cpcf, attr_p-> attr.fmtp.bpp, attr_p->attr.fmtp.hrd) |
| 1456 | attr_p->attr.fmtp.maxbr,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1467, "sdp", "%s Parsed a=%s, payload type %u, bitrate %u, mode %u QCIF = %u, CIF = %u, MAXBR= %u, SQCIF=%u, CIF4= %u, CIF16=%u, CUSTOM=%u,%u,%u , PAR=%u:%u,CPCF=%u, BPP=%u, HRD=%u \n" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.bitrate, attr_p ->attr.fmtp.mode, attr_p->attr.fmtp.qcif, attr_p->attr .fmtp.cif, attr_p->attr.fmtp.maxbr, attr_p->attr.fmtp.sqcif , attr_p->attr.fmtp.cif4, attr_p->attr.fmtp.cif16, attr_p ->attr.fmtp.custom_x,attr_p->attr.fmtp.custom_y, attr_p ->attr.fmtp.custom_mpi, attr_p->attr.fmtp.par_width, attr_p ->attr.fmtp.par_height, attr_p->attr.fmtp.cpcf, attr_p-> attr.fmtp.bpp, attr_p->attr.fmtp.hrd) |
| 1457 | attr_p->attr.fmtp.sqcif,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1467, "sdp", "%s Parsed a=%s, payload type %u, bitrate %u, mode %u QCIF = %u, CIF = %u, MAXBR= %u, SQCIF=%u, CIF4= %u, CIF16=%u, CUSTOM=%u,%u,%u , PAR=%u:%u,CPCF=%u, BPP=%u, HRD=%u \n" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.bitrate, attr_p ->attr.fmtp.mode, attr_p->attr.fmtp.qcif, attr_p->attr .fmtp.cif, attr_p->attr.fmtp.maxbr, attr_p->attr.fmtp.sqcif , attr_p->attr.fmtp.cif4, attr_p->attr.fmtp.cif16, attr_p ->attr.fmtp.custom_x,attr_p->attr.fmtp.custom_y, attr_p ->attr.fmtp.custom_mpi, attr_p->attr.fmtp.par_width, attr_p ->attr.fmtp.par_height, attr_p->attr.fmtp.cpcf, attr_p-> attr.fmtp.bpp, attr_p->attr.fmtp.hrd) |
| 1458 | attr_p->attr.fmtp.cif4,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1467, "sdp", "%s Parsed a=%s, payload type %u, bitrate %u, mode %u QCIF = %u, CIF = %u, MAXBR= %u, SQCIF=%u, CIF4= %u, CIF16=%u, CUSTOM=%u,%u,%u , PAR=%u:%u,CPCF=%u, BPP=%u, HRD=%u \n" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.bitrate, attr_p ->attr.fmtp.mode, attr_p->attr.fmtp.qcif, attr_p->attr .fmtp.cif, attr_p->attr.fmtp.maxbr, attr_p->attr.fmtp.sqcif , attr_p->attr.fmtp.cif4, attr_p->attr.fmtp.cif16, attr_p ->attr.fmtp.custom_x,attr_p->attr.fmtp.custom_y, attr_p ->attr.fmtp.custom_mpi, attr_p->attr.fmtp.par_width, attr_p ->attr.fmtp.par_height, attr_p->attr.fmtp.cpcf, attr_p-> attr.fmtp.bpp, attr_p->attr.fmtp.hrd) |
| 1459 | attr_p->attr.fmtp.cif16,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1467, "sdp", "%s Parsed a=%s, payload type %u, bitrate %u, mode %u QCIF = %u, CIF = %u, MAXBR= %u, SQCIF=%u, CIF4= %u, CIF16=%u, CUSTOM=%u,%u,%u , PAR=%u:%u,CPCF=%u, BPP=%u, HRD=%u \n" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.bitrate, attr_p ->attr.fmtp.mode, attr_p->attr.fmtp.qcif, attr_p->attr .fmtp.cif, attr_p->attr.fmtp.maxbr, attr_p->attr.fmtp.sqcif , attr_p->attr.fmtp.cif4, attr_p->attr.fmtp.cif16, attr_p ->attr.fmtp.custom_x,attr_p->attr.fmtp.custom_y, attr_p ->attr.fmtp.custom_mpi, attr_p->attr.fmtp.par_width, attr_p ->attr.fmtp.par_height, attr_p->attr.fmtp.cpcf, attr_p-> attr.fmtp.bpp, attr_p->attr.fmtp.hrd) |
| 1460 | attr_p->attr.fmtp.custom_x,attr_p->attr.fmtp.custom_y,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1467, "sdp", "%s Parsed a=%s, payload type %u, bitrate %u, mode %u QCIF = %u, CIF = %u, MAXBR= %u, SQCIF=%u, CIF4= %u, CIF16=%u, CUSTOM=%u,%u,%u , PAR=%u:%u,CPCF=%u, BPP=%u, HRD=%u \n" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.bitrate, attr_p ->attr.fmtp.mode, attr_p->attr.fmtp.qcif, attr_p->attr .fmtp.cif, attr_p->attr.fmtp.maxbr, attr_p->attr.fmtp.sqcif , attr_p->attr.fmtp.cif4, attr_p->attr.fmtp.cif16, attr_p ->attr.fmtp.custom_x,attr_p->attr.fmtp.custom_y, attr_p ->attr.fmtp.custom_mpi, attr_p->attr.fmtp.par_width, attr_p ->attr.fmtp.par_height, attr_p->attr.fmtp.cpcf, attr_p-> attr.fmtp.bpp, attr_p->attr.fmtp.hrd) |
| 1461 | attr_p->attr.fmtp.custom_mpi,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1467, "sdp", "%s Parsed a=%s, payload type %u, bitrate %u, mode %u QCIF = %u, CIF = %u, MAXBR= %u, SQCIF=%u, CIF4= %u, CIF16=%u, CUSTOM=%u,%u,%u , PAR=%u:%u,CPCF=%u, BPP=%u, HRD=%u \n" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.bitrate, attr_p ->attr.fmtp.mode, attr_p->attr.fmtp.qcif, attr_p->attr .fmtp.cif, attr_p->attr.fmtp.maxbr, attr_p->attr.fmtp.sqcif , attr_p->attr.fmtp.cif4, attr_p->attr.fmtp.cif16, attr_p ->attr.fmtp.custom_x,attr_p->attr.fmtp.custom_y, attr_p ->attr.fmtp.custom_mpi, attr_p->attr.fmtp.par_width, attr_p ->attr.fmtp.par_height, attr_p->attr.fmtp.cpcf, attr_p-> attr.fmtp.bpp, attr_p->attr.fmtp.hrd) |
| 1462 | attr_p->attr.fmtp.par_width,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1467, "sdp", "%s Parsed a=%s, payload type %u, bitrate %u, mode %u QCIF = %u, CIF = %u, MAXBR= %u, SQCIF=%u, CIF4= %u, CIF16=%u, CUSTOM=%u,%u,%u , PAR=%u:%u,CPCF=%u, BPP=%u, HRD=%u \n" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.bitrate, attr_p ->attr.fmtp.mode, attr_p->attr.fmtp.qcif, attr_p->attr .fmtp.cif, attr_p->attr.fmtp.maxbr, attr_p->attr.fmtp.sqcif , attr_p->attr.fmtp.cif4, attr_p->attr.fmtp.cif16, attr_p ->attr.fmtp.custom_x,attr_p->attr.fmtp.custom_y, attr_p ->attr.fmtp.custom_mpi, attr_p->attr.fmtp.par_width, attr_p ->attr.fmtp.par_height, attr_p->attr.fmtp.cpcf, attr_p-> attr.fmtp.bpp, attr_p->attr.fmtp.hrd) |
| 1463 | attr_p->attr.fmtp.par_height,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1467, "sdp", "%s Parsed a=%s, payload type %u, bitrate %u, mode %u QCIF = %u, CIF = %u, MAXBR= %u, SQCIF=%u, CIF4= %u, CIF16=%u, CUSTOM=%u,%u,%u , PAR=%u:%u,CPCF=%u, BPP=%u, HRD=%u \n" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.bitrate, attr_p ->attr.fmtp.mode, attr_p->attr.fmtp.qcif, attr_p->attr .fmtp.cif, attr_p->attr.fmtp.maxbr, attr_p->attr.fmtp.sqcif , attr_p->attr.fmtp.cif4, attr_p->attr.fmtp.cif16, attr_p ->attr.fmtp.custom_x,attr_p->attr.fmtp.custom_y, attr_p ->attr.fmtp.custom_mpi, attr_p->attr.fmtp.par_width, attr_p ->attr.fmtp.par_height, attr_p->attr.fmtp.cpcf, attr_p-> attr.fmtp.bpp, attr_p->attr.fmtp.hrd) |
| 1464 | attr_p->attr.fmtp.cpcf,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1467, "sdp", "%s Parsed a=%s, payload type %u, bitrate %u, mode %u QCIF = %u, CIF = %u, MAXBR= %u, SQCIF=%u, CIF4= %u, CIF16=%u, CUSTOM=%u,%u,%u , PAR=%u:%u,CPCF=%u, BPP=%u, HRD=%u \n" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.bitrate, attr_p ->attr.fmtp.mode, attr_p->attr.fmtp.qcif, attr_p->attr .fmtp.cif, attr_p->attr.fmtp.maxbr, attr_p->attr.fmtp.sqcif , attr_p->attr.fmtp.cif4, attr_p->attr.fmtp.cif16, attr_p ->attr.fmtp.custom_x,attr_p->attr.fmtp.custom_y, attr_p ->attr.fmtp.custom_mpi, attr_p->attr.fmtp.par_width, attr_p ->attr.fmtp.par_height, attr_p->attr.fmtp.cpcf, attr_p-> attr.fmtp.bpp, attr_p->attr.fmtp.hrd) |
| 1465 | attr_p->attr.fmtp.bpp,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1467, "sdp", "%s Parsed a=%s, payload type %u, bitrate %u, mode %u QCIF = %u, CIF = %u, MAXBR= %u, SQCIF=%u, CIF4= %u, CIF16=%u, CUSTOM=%u,%u,%u , PAR=%u:%u,CPCF=%u, BPP=%u, HRD=%u \n" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.bitrate, attr_p ->attr.fmtp.mode, attr_p->attr.fmtp.qcif, attr_p->attr .fmtp.cif, attr_p->attr.fmtp.maxbr, attr_p->attr.fmtp.sqcif , attr_p->attr.fmtp.cif4, attr_p->attr.fmtp.cif16, attr_p ->attr.fmtp.custom_x,attr_p->attr.fmtp.custom_y, attr_p ->attr.fmtp.custom_mpi, attr_p->attr.fmtp.par_width, attr_p ->attr.fmtp.par_height, attr_p->attr.fmtp.cpcf, attr_p-> attr.fmtp.bpp, attr_p->attr.fmtp.hrd) |
| 1466 | attr_p->attr.fmtp.hrdSDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1467, "sdp", "%s Parsed a=%s, payload type %u, bitrate %u, mode %u QCIF = %u, CIF = %u, MAXBR= %u, SQCIF=%u, CIF4= %u, CIF16=%u, CUSTOM=%u,%u,%u , PAR=%u:%u,CPCF=%u, BPP=%u, HRD=%u \n" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.bitrate, attr_p ->attr.fmtp.mode, attr_p->attr.fmtp.qcif, attr_p->attr .fmtp.cif, attr_p->attr.fmtp.maxbr, attr_p->attr.fmtp.sqcif , attr_p->attr.fmtp.cif4, attr_p->attr.fmtp.cif16, attr_p ->attr.fmtp.custom_x,attr_p->attr.fmtp.custom_y, attr_p ->attr.fmtp.custom_mpi, attr_p->attr.fmtp.par_width, attr_p ->attr.fmtp.par_height, attr_p->attr.fmtp.cpcf, attr_p-> attr.fmtp.bpp, attr_p->attr.fmtp.hrd) |
| 1467 | )SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1467, "sdp", "%s Parsed a=%s, payload type %u, bitrate %u, mode %u QCIF = %u, CIF = %u, MAXBR= %u, SQCIF=%u, CIF4= %u, CIF16=%u, CUSTOM=%u,%u,%u , PAR=%u:%u,CPCF=%u, BPP=%u, HRD=%u \n" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.bitrate, attr_p ->attr.fmtp.mode, attr_p->attr.fmtp.qcif, attr_p->attr .fmtp.cif, attr_p->attr.fmtp.maxbr, attr_p->attr.fmtp.sqcif , attr_p->attr.fmtp.cif4, attr_p->attr.fmtp.cif16, attr_p ->attr.fmtp.custom_x,attr_p->attr.fmtp.custom_y, attr_p ->attr.fmtp.custom_mpi, attr_p->attr.fmtp.par_width, attr_p ->attr.fmtp.par_height, attr_p->attr.fmtp.cpcf, attr_p-> attr.fmtp.bpp, attr_p->attr.fmtp.hrd); |
| 1468 | } |
| 1469 | |
| 1470 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 1471 | SDP_PRINT("%s Parsed a=%s, payload type %u,PROFILE=%u,LEVEL=%u, INTERLACE - %s",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1477, "sdp", "%s Parsed a=%s, payload type %u,PROFILE=%u,LEVEL=%u, INTERLACE - %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.profile, attr_p ->attr.fmtp.level, attr_p->attr.fmtp.is_interlace ? "YES" :"NO") |
| 1472 | sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1477, "sdp", "%s Parsed a=%s, payload type %u,PROFILE=%u,LEVEL=%u, INTERLACE - %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.profile, attr_p ->attr.fmtp.level, attr_p->attr.fmtp.is_interlace ? "YES" :"NO") |
| 1473 | sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1477, "sdp", "%s Parsed a=%s, payload type %u,PROFILE=%u,LEVEL=%u, INTERLACE - %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.profile, attr_p ->attr.fmtp.level, attr_p->attr.fmtp.is_interlace ? "YES" :"NO") |
| 1474 | attr_p->attr.fmtp.payload_num,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1477, "sdp", "%s Parsed a=%s, payload type %u,PROFILE=%u,LEVEL=%u, INTERLACE - %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.profile, attr_p ->attr.fmtp.level, attr_p->attr.fmtp.is_interlace ? "YES" :"NO") |
| 1475 | attr_p->attr.fmtp.profile,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1477, "sdp", "%s Parsed a=%s, payload type %u,PROFILE=%u,LEVEL=%u, INTERLACE - %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.profile, attr_p ->attr.fmtp.level, attr_p->attr.fmtp.is_interlace ? "YES" :"NO") |
| 1476 | attr_p->attr.fmtp.level,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1477, "sdp", "%s Parsed a=%s, payload type %u,PROFILE=%u,LEVEL=%u, INTERLACE - %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.profile, attr_p ->attr.fmtp.level, attr_p->attr.fmtp.is_interlace ? "YES" :"NO") |
| 1477 | attr_p->attr.fmtp.is_interlace ? "YES":"NO")SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1477, "sdp", "%s Parsed a=%s, payload type %u,PROFILE=%u,LEVEL=%u, INTERLACE - %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.fmtp.payload_num, attr_p->attr.fmtp.profile, attr_p ->attr.fmtp.level, attr_p->attr.fmtp.is_interlace ? "YES" :"NO"); |
| 1478 | } |
| 1479 | |
| 1480 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 1481 | SDP_PRINT("%s Parsed H.264 attributes: profile-level-id=%s, parameter-sets=%s, packetization-mode=%d level-asymmetry-allowed=%d interleaving-depth=%d deint-buf-req=%u max-don-diff=%u, init_buf-time=%u\n",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1491, "sdp", "%s Parsed H.264 attributes: profile-level-id=%s, parameter-sets=%s, packetization-mode=%d level-asymmetry-allowed=%d interleaving-depth=%d deint-buf-req=%u max-don-diff=%u, init_buf-time=%u\n" , sdp_p->debug_str, attr_p->attr.fmtp.profile_level_id, attr_p->attr.fmtp.parameter_sets, attr_p->attr.fmtp.packetization_mode , attr_p->attr.fmtp.level_asymmetry_allowed, attr_p->attr .fmtp.interleaving_depth, attr_p->attr.fmtp.deint_buf_req, attr_p->attr.fmtp.max_don_diff, attr_p->attr.fmtp.init_buf_time ) |
| 1482 | sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1491, "sdp", "%s Parsed H.264 attributes: profile-level-id=%s, parameter-sets=%s, packetization-mode=%d level-asymmetry-allowed=%d interleaving-depth=%d deint-buf-req=%u max-don-diff=%u, init_buf-time=%u\n" , sdp_p->debug_str, attr_p->attr.fmtp.profile_level_id, attr_p->attr.fmtp.parameter_sets, attr_p->attr.fmtp.packetization_mode , attr_p->attr.fmtp.level_asymmetry_allowed, attr_p->attr .fmtp.interleaving_depth, attr_p->attr.fmtp.deint_buf_req, attr_p->attr.fmtp.max_don_diff, attr_p->attr.fmtp.init_buf_time ) |
| 1483 | attr_p->attr.fmtp.profile_level_id,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1491, "sdp", "%s Parsed H.264 attributes: profile-level-id=%s, parameter-sets=%s, packetization-mode=%d level-asymmetry-allowed=%d interleaving-depth=%d deint-buf-req=%u max-don-diff=%u, init_buf-time=%u\n" , sdp_p->debug_str, attr_p->attr.fmtp.profile_level_id, attr_p->attr.fmtp.parameter_sets, attr_p->attr.fmtp.packetization_mode , attr_p->attr.fmtp.level_asymmetry_allowed, attr_p->attr .fmtp.interleaving_depth, attr_p->attr.fmtp.deint_buf_req, attr_p->attr.fmtp.max_don_diff, attr_p->attr.fmtp.init_buf_time ) |
| 1484 | attr_p->attr.fmtp.parameter_sets,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1491, "sdp", "%s Parsed H.264 attributes: profile-level-id=%s, parameter-sets=%s, packetization-mode=%d level-asymmetry-allowed=%d interleaving-depth=%d deint-buf-req=%u max-don-diff=%u, init_buf-time=%u\n" , sdp_p->debug_str, attr_p->attr.fmtp.profile_level_id, attr_p->attr.fmtp.parameter_sets, attr_p->attr.fmtp.packetization_mode , attr_p->attr.fmtp.level_asymmetry_allowed, attr_p->attr .fmtp.interleaving_depth, attr_p->attr.fmtp.deint_buf_req, attr_p->attr.fmtp.max_don_diff, attr_p->attr.fmtp.init_buf_time ) |
| 1485 | attr_p->attr.fmtp.packetization_mode,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1491, "sdp", "%s Parsed H.264 attributes: profile-level-id=%s, parameter-sets=%s, packetization-mode=%d level-asymmetry-allowed=%d interleaving-depth=%d deint-buf-req=%u max-don-diff=%u, init_buf-time=%u\n" , sdp_p->debug_str, attr_p->attr.fmtp.profile_level_id, attr_p->attr.fmtp.parameter_sets, attr_p->attr.fmtp.packetization_mode , attr_p->attr.fmtp.level_asymmetry_allowed, attr_p->attr .fmtp.interleaving_depth, attr_p->attr.fmtp.deint_buf_req, attr_p->attr.fmtp.max_don_diff, attr_p->attr.fmtp.init_buf_time ) |
| 1486 | attr_p->attr.fmtp.level_asymmetry_allowed,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1491, "sdp", "%s Parsed H.264 attributes: profile-level-id=%s, parameter-sets=%s, packetization-mode=%d level-asymmetry-allowed=%d interleaving-depth=%d deint-buf-req=%u max-don-diff=%u, init_buf-time=%u\n" , sdp_p->debug_str, attr_p->attr.fmtp.profile_level_id, attr_p->attr.fmtp.parameter_sets, attr_p->attr.fmtp.packetization_mode , attr_p->attr.fmtp.level_asymmetry_allowed, attr_p->attr .fmtp.interleaving_depth, attr_p->attr.fmtp.deint_buf_req, attr_p->attr.fmtp.max_don_diff, attr_p->attr.fmtp.init_buf_time ) |
| 1487 | attr_p->attr.fmtp.interleaving_depth,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1491, "sdp", "%s Parsed H.264 attributes: profile-level-id=%s, parameter-sets=%s, packetization-mode=%d level-asymmetry-allowed=%d interleaving-depth=%d deint-buf-req=%u max-don-diff=%u, init_buf-time=%u\n" , sdp_p->debug_str, attr_p->attr.fmtp.profile_level_id, attr_p->attr.fmtp.parameter_sets, attr_p->attr.fmtp.packetization_mode , attr_p->attr.fmtp.level_asymmetry_allowed, attr_p->attr .fmtp.interleaving_depth, attr_p->attr.fmtp.deint_buf_req, attr_p->attr.fmtp.max_don_diff, attr_p->attr.fmtp.init_buf_time ) |
| 1488 | attr_p->attr.fmtp.deint_buf_req,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1491, "sdp", "%s Parsed H.264 attributes: profile-level-id=%s, parameter-sets=%s, packetization-mode=%d level-asymmetry-allowed=%d interleaving-depth=%d deint-buf-req=%u max-don-diff=%u, init_buf-time=%u\n" , sdp_p->debug_str, attr_p->attr.fmtp.profile_level_id, attr_p->attr.fmtp.parameter_sets, attr_p->attr.fmtp.packetization_mode , attr_p->attr.fmtp.level_asymmetry_allowed, attr_p->attr .fmtp.interleaving_depth, attr_p->attr.fmtp.deint_buf_req, attr_p->attr.fmtp.max_don_diff, attr_p->attr.fmtp.init_buf_time ) |
| 1489 | attr_p->attr.fmtp.max_don_diff,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1491, "sdp", "%s Parsed H.264 attributes: profile-level-id=%s, parameter-sets=%s, packetization-mode=%d level-asymmetry-allowed=%d interleaving-depth=%d deint-buf-req=%u max-don-diff=%u, init_buf-time=%u\n" , sdp_p->debug_str, attr_p->attr.fmtp.profile_level_id, attr_p->attr.fmtp.parameter_sets, attr_p->attr.fmtp.packetization_mode , attr_p->attr.fmtp.level_asymmetry_allowed, attr_p->attr .fmtp.interleaving_depth, attr_p->attr.fmtp.deint_buf_req, attr_p->attr.fmtp.max_don_diff, attr_p->attr.fmtp.init_buf_time ) |
| 1490 | attr_p->attr.fmtp.init_buf_timeSDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1491, "sdp", "%s Parsed H.264 attributes: profile-level-id=%s, parameter-sets=%s, packetization-mode=%d level-asymmetry-allowed=%d interleaving-depth=%d deint-buf-req=%u max-don-diff=%u, init_buf-time=%u\n" , sdp_p->debug_str, attr_p->attr.fmtp.profile_level_id, attr_p->attr.fmtp.parameter_sets, attr_p->attr.fmtp.packetization_mode , attr_p->attr.fmtp.level_asymmetry_allowed, attr_p->attr .fmtp.interleaving_depth, attr_p->attr.fmtp.deint_buf_req, attr_p->attr.fmtp.max_don_diff, attr_p->attr.fmtp.init_buf_time ) |
| 1491 | )SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1491, "sdp", "%s Parsed H.264 attributes: profile-level-id=%s, parameter-sets=%s, packetization-mode=%d level-asymmetry-allowed=%d interleaving-depth=%d deint-buf-req=%u max-don-diff=%u, init_buf-time=%u\n" , sdp_p->debug_str, attr_p->attr.fmtp.profile_level_id, attr_p->attr.fmtp.parameter_sets, attr_p->attr.fmtp.packetization_mode , attr_p->attr.fmtp.level_asymmetry_allowed, attr_p->attr .fmtp.interleaving_depth, attr_p->attr.fmtp.deint_buf_req, attr_p->attr.fmtp.max_don_diff, attr_p->attr.fmtp.init_buf_time ); |
| 1492 | } |
| 1493 | |
| 1494 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 1495 | SDP_PRINT("\n%s Parsed H.264 opt attributes: max-mbps=%u, max-fs=%u, max-cpb=%u max-dpb=%u max-br=%u redundant-pic-cap=%d, deint-buf-cap=%u, max-rcmd-nalu-size=%u , parameter-add=%d\n",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1505, "sdp", "\n%s Parsed H.264 opt attributes: max-mbps=%u, max-fs=%u, max-cpb=%u max-dpb=%u max-br=%u redundant-pic-cap=%d, deint-buf-cap=%u, max-rcmd-nalu-size=%u , parameter-add=%d\n" , sdp_p->debug_str, attr_p->attr.fmtp.max_mbps, attr_p-> attr.fmtp.max_fs, attr_p->attr.fmtp.max_cpb, attr_p->attr .fmtp.max_dpb, attr_p->attr.fmtp.max_br, attr_p->attr.fmtp .redundant_pic_cap, attr_p->attr.fmtp.deint_buf_cap, attr_p ->attr.fmtp.max_rcmd_nalu_size, attr_p->attr.fmtp.parameter_add ) |
| 1496 | sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1505, "sdp", "\n%s Parsed H.264 opt attributes: max-mbps=%u, max-fs=%u, max-cpb=%u max-dpb=%u max-br=%u redundant-pic-cap=%d, deint-buf-cap=%u, max-rcmd-nalu-size=%u , parameter-add=%d\n" , sdp_p->debug_str, attr_p->attr.fmtp.max_mbps, attr_p-> attr.fmtp.max_fs, attr_p->attr.fmtp.max_cpb, attr_p->attr .fmtp.max_dpb, attr_p->attr.fmtp.max_br, attr_p->attr.fmtp .redundant_pic_cap, attr_p->attr.fmtp.deint_buf_cap, attr_p ->attr.fmtp.max_rcmd_nalu_size, attr_p->attr.fmtp.parameter_add ) |
| 1497 | attr_p->attr.fmtp.max_mbps,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1505, "sdp", "\n%s Parsed H.264 opt attributes: max-mbps=%u, max-fs=%u, max-cpb=%u max-dpb=%u max-br=%u redundant-pic-cap=%d, deint-buf-cap=%u, max-rcmd-nalu-size=%u , parameter-add=%d\n" , sdp_p->debug_str, attr_p->attr.fmtp.max_mbps, attr_p-> attr.fmtp.max_fs, attr_p->attr.fmtp.max_cpb, attr_p->attr .fmtp.max_dpb, attr_p->attr.fmtp.max_br, attr_p->attr.fmtp .redundant_pic_cap, attr_p->attr.fmtp.deint_buf_cap, attr_p ->attr.fmtp.max_rcmd_nalu_size, attr_p->attr.fmtp.parameter_add ) |
| 1498 | attr_p->attr.fmtp.max_fs,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1505, "sdp", "\n%s Parsed H.264 opt attributes: max-mbps=%u, max-fs=%u, max-cpb=%u max-dpb=%u max-br=%u redundant-pic-cap=%d, deint-buf-cap=%u, max-rcmd-nalu-size=%u , parameter-add=%d\n" , sdp_p->debug_str, attr_p->attr.fmtp.max_mbps, attr_p-> attr.fmtp.max_fs, attr_p->attr.fmtp.max_cpb, attr_p->attr .fmtp.max_dpb, attr_p->attr.fmtp.max_br, attr_p->attr.fmtp .redundant_pic_cap, attr_p->attr.fmtp.deint_buf_cap, attr_p ->attr.fmtp.max_rcmd_nalu_size, attr_p->attr.fmtp.parameter_add ) |
| 1499 | attr_p->attr.fmtp.max_cpb,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1505, "sdp", "\n%s Parsed H.264 opt attributes: max-mbps=%u, max-fs=%u, max-cpb=%u max-dpb=%u max-br=%u redundant-pic-cap=%d, deint-buf-cap=%u, max-rcmd-nalu-size=%u , parameter-add=%d\n" , sdp_p->debug_str, attr_p->attr.fmtp.max_mbps, attr_p-> attr.fmtp.max_fs, attr_p->attr.fmtp.max_cpb, attr_p->attr .fmtp.max_dpb, attr_p->attr.fmtp.max_br, attr_p->attr.fmtp .redundant_pic_cap, attr_p->attr.fmtp.deint_buf_cap, attr_p ->attr.fmtp.max_rcmd_nalu_size, attr_p->attr.fmtp.parameter_add ) |
| 1500 | attr_p->attr.fmtp.max_dpb,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1505, "sdp", "\n%s Parsed H.264 opt attributes: max-mbps=%u, max-fs=%u, max-cpb=%u max-dpb=%u max-br=%u redundant-pic-cap=%d, deint-buf-cap=%u, max-rcmd-nalu-size=%u , parameter-add=%d\n" , sdp_p->debug_str, attr_p->attr.fmtp.max_mbps, attr_p-> attr.fmtp.max_fs, attr_p->attr.fmtp.max_cpb, attr_p->attr .fmtp.max_dpb, attr_p->attr.fmtp.max_br, attr_p->attr.fmtp .redundant_pic_cap, attr_p->attr.fmtp.deint_buf_cap, attr_p ->attr.fmtp.max_rcmd_nalu_size, attr_p->attr.fmtp.parameter_add ) |
| 1501 | attr_p->attr.fmtp.max_br,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1505, "sdp", "\n%s Parsed H.264 opt attributes: max-mbps=%u, max-fs=%u, max-cpb=%u max-dpb=%u max-br=%u redundant-pic-cap=%d, deint-buf-cap=%u, max-rcmd-nalu-size=%u , parameter-add=%d\n" , sdp_p->debug_str, attr_p->attr.fmtp.max_mbps, attr_p-> attr.fmtp.max_fs, attr_p->attr.fmtp.max_cpb, attr_p->attr .fmtp.max_dpb, attr_p->attr.fmtp.max_br, attr_p->attr.fmtp .redundant_pic_cap, attr_p->attr.fmtp.deint_buf_cap, attr_p ->attr.fmtp.max_rcmd_nalu_size, attr_p->attr.fmtp.parameter_add ) |
| 1502 | attr_p->attr.fmtp.redundant_pic_cap,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1505, "sdp", "\n%s Parsed H.264 opt attributes: max-mbps=%u, max-fs=%u, max-cpb=%u max-dpb=%u max-br=%u redundant-pic-cap=%d, deint-buf-cap=%u, max-rcmd-nalu-size=%u , parameter-add=%d\n" , sdp_p->debug_str, attr_p->attr.fmtp.max_mbps, attr_p-> attr.fmtp.max_fs, attr_p->attr.fmtp.max_cpb, attr_p->attr .fmtp.max_dpb, attr_p->attr.fmtp.max_br, attr_p->attr.fmtp .redundant_pic_cap, attr_p->attr.fmtp.deint_buf_cap, attr_p ->attr.fmtp.max_rcmd_nalu_size, attr_p->attr.fmtp.parameter_add ) |
| 1503 | attr_p->attr.fmtp.deint_buf_cap,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1505, "sdp", "\n%s Parsed H.264 opt attributes: max-mbps=%u, max-fs=%u, max-cpb=%u max-dpb=%u max-br=%u redundant-pic-cap=%d, deint-buf-cap=%u, max-rcmd-nalu-size=%u , parameter-add=%d\n" , sdp_p->debug_str, attr_p->attr.fmtp.max_mbps, attr_p-> attr.fmtp.max_fs, attr_p->attr.fmtp.max_cpb, attr_p->attr .fmtp.max_dpb, attr_p->attr.fmtp.max_br, attr_p->attr.fmtp .redundant_pic_cap, attr_p->attr.fmtp.deint_buf_cap, attr_p ->attr.fmtp.max_rcmd_nalu_size, attr_p->attr.fmtp.parameter_add ) |
| 1504 | attr_p->attr.fmtp.max_rcmd_nalu_size,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1505, "sdp", "\n%s Parsed H.264 opt attributes: max-mbps=%u, max-fs=%u, max-cpb=%u max-dpb=%u max-br=%u redundant-pic-cap=%d, deint-buf-cap=%u, max-rcmd-nalu-size=%u , parameter-add=%d\n" , sdp_p->debug_str, attr_p->attr.fmtp.max_mbps, attr_p-> attr.fmtp.max_fs, attr_p->attr.fmtp.max_cpb, attr_p->attr .fmtp.max_dpb, attr_p->attr.fmtp.max_br, attr_p->attr.fmtp .redundant_pic_cap, attr_p->attr.fmtp.deint_buf_cap, attr_p ->attr.fmtp.max_rcmd_nalu_size, attr_p->attr.fmtp.parameter_add ) |
| 1505 | attr_p->attr.fmtp.parameter_add)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1505, "sdp", "\n%s Parsed H.264 opt attributes: max-mbps=%u, max-fs=%u, max-cpb=%u max-dpb=%u max-br=%u redundant-pic-cap=%d, deint-buf-cap=%u, max-rcmd-nalu-size=%u , parameter-add=%d\n" , sdp_p->debug_str, attr_p->attr.fmtp.max_mbps, attr_p-> attr.fmtp.max_fs, attr_p->attr.fmtp.max_cpb, attr_p->attr .fmtp.max_dpb, attr_p->attr.fmtp.max_br, attr_p->attr.fmtp .redundant_pic_cap, attr_p->attr.fmtp.deint_buf_cap, attr_p ->attr.fmtp.max_rcmd_nalu_size, attr_p->attr.fmtp.parameter_add ); |
| 1506 | |
| 1507 | } |
| 1508 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 1509 | SDP_PRINT("%s Parsed annexes are : D=%d F=%d I=%d J=%d T=%d, K=%d N=%d P=%d,%d\n",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1517, "sdp", "%s Parsed annexes are : D=%d F=%d I=%d J=%d T=%d, K=%d N=%d P=%d,%d\n" , sdp_p->debug_str, attr_p->attr.fmtp.annex_d, attr_p-> attr.fmtp.annex_f, attr_p->attr.fmtp.annex_i, attr_p->attr .fmtp.annex_j, attr_p->attr.fmtp.annex_t, attr_p->attr. fmtp.annex_k_val, attr_p->attr.fmtp.annex_n_val, attr_p-> attr.fmtp.annex_p_val_picture_resize, attr_p->attr.fmtp.annex_p_val_warp ) |
| 1510 | sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1517, "sdp", "%s Parsed annexes are : D=%d F=%d I=%d J=%d T=%d, K=%d N=%d P=%d,%d\n" , sdp_p->debug_str, attr_p->attr.fmtp.annex_d, attr_p-> attr.fmtp.annex_f, attr_p->attr.fmtp.annex_i, attr_p->attr .fmtp.annex_j, attr_p->attr.fmtp.annex_t, attr_p->attr. fmtp.annex_k_val, attr_p->attr.fmtp.annex_n_val, attr_p-> attr.fmtp.annex_p_val_picture_resize, attr_p->attr.fmtp.annex_p_val_warp ) |
| 1511 | attr_p->attr.fmtp.annex_d,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1517, "sdp", "%s Parsed annexes are : D=%d F=%d I=%d J=%d T=%d, K=%d N=%d P=%d,%d\n" , sdp_p->debug_str, attr_p->attr.fmtp.annex_d, attr_p-> attr.fmtp.annex_f, attr_p->attr.fmtp.annex_i, attr_p->attr .fmtp.annex_j, attr_p->attr.fmtp.annex_t, attr_p->attr. fmtp.annex_k_val, attr_p->attr.fmtp.annex_n_val, attr_p-> attr.fmtp.annex_p_val_picture_resize, attr_p->attr.fmtp.annex_p_val_warp ) |
| 1512 | attr_p->attr.fmtp.annex_f, attr_p->attr.fmtp.annex_i,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1517, "sdp", "%s Parsed annexes are : D=%d F=%d I=%d J=%d T=%d, K=%d N=%d P=%d,%d\n" , sdp_p->debug_str, attr_p->attr.fmtp.annex_d, attr_p-> attr.fmtp.annex_f, attr_p->attr.fmtp.annex_i, attr_p->attr .fmtp.annex_j, attr_p->attr.fmtp.annex_t, attr_p->attr. fmtp.annex_k_val, attr_p->attr.fmtp.annex_n_val, attr_p-> attr.fmtp.annex_p_val_picture_resize, attr_p->attr.fmtp.annex_p_val_warp ) |
| 1513 | attr_p->attr.fmtp.annex_j, attr_p->attr.fmtp.annex_t,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1517, "sdp", "%s Parsed annexes are : D=%d F=%d I=%d J=%d T=%d, K=%d N=%d P=%d,%d\n" , sdp_p->debug_str, attr_p->attr.fmtp.annex_d, attr_p-> attr.fmtp.annex_f, attr_p->attr.fmtp.annex_i, attr_p->attr .fmtp.annex_j, attr_p->attr.fmtp.annex_t, attr_p->attr. fmtp.annex_k_val, attr_p->attr.fmtp.annex_n_val, attr_p-> attr.fmtp.annex_p_val_picture_resize, attr_p->attr.fmtp.annex_p_val_warp ) |
| 1514 | attr_p->attr.fmtp.annex_k_val,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1517, "sdp", "%s Parsed annexes are : D=%d F=%d I=%d J=%d T=%d, K=%d N=%d P=%d,%d\n" , sdp_p->debug_str, attr_p->attr.fmtp.annex_d, attr_p-> attr.fmtp.annex_f, attr_p->attr.fmtp.annex_i, attr_p->attr .fmtp.annex_j, attr_p->attr.fmtp.annex_t, attr_p->attr. fmtp.annex_k_val, attr_p->attr.fmtp.annex_n_val, attr_p-> attr.fmtp.annex_p_val_picture_resize, attr_p->attr.fmtp.annex_p_val_warp ) |
| 1515 | attr_p->attr.fmtp.annex_n_val,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1517, "sdp", "%s Parsed annexes are : D=%d F=%d I=%d J=%d T=%d, K=%d N=%d P=%d,%d\n" , sdp_p->debug_str, attr_p->attr.fmtp.annex_d, attr_p-> attr.fmtp.annex_f, attr_p->attr.fmtp.annex_i, attr_p->attr .fmtp.annex_j, attr_p->attr.fmtp.annex_t, attr_p->attr. fmtp.annex_k_val, attr_p->attr.fmtp.annex_n_val, attr_p-> attr.fmtp.annex_p_val_picture_resize, attr_p->attr.fmtp.annex_p_val_warp ) |
| 1516 | attr_p->attr.fmtp.annex_p_val_picture_resize,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1517, "sdp", "%s Parsed annexes are : D=%d F=%d I=%d J=%d T=%d, K=%d N=%d P=%d,%d\n" , sdp_p->debug_str, attr_p->attr.fmtp.annex_d, attr_p-> attr.fmtp.annex_f, attr_p->attr.fmtp.annex_i, attr_p->attr .fmtp.annex_j, attr_p->attr.fmtp.annex_t, attr_p->attr. fmtp.annex_k_val, attr_p->attr.fmtp.annex_n_val, attr_p-> attr.fmtp.annex_p_val_picture_resize, attr_p->attr.fmtp.annex_p_val_warp ) |
| 1517 | attr_p->attr.fmtp.annex_p_val_warp)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1517, "sdp", "%s Parsed annexes are : D=%d F=%d I=%d J=%d T=%d, K=%d N=%d P=%d,%d\n" , sdp_p->debug_str, attr_p->attr.fmtp.annex_d, attr_p-> attr.fmtp.annex_f, attr_p->attr.fmtp.annex_i, attr_p->attr .fmtp.annex_j, attr_p->attr.fmtp.annex_t, attr_p->attr. fmtp.annex_k_val, attr_p->attr.fmtp.annex_n_val, attr_p-> attr.fmtp.annex_p_val_picture_resize, attr_p->attr.fmtp.annex_p_val_warp ); |
| 1518 | |
| 1519 | } |
| 1520 | SDP_FREEfree(temp_ptr); |
| 1521 | return (SDP_SUCCESS); |
| 1522 | } else { |
| 1523 | done = FALSE0; |
| 1524 | fmtp_ptr = src_ptr; |
| 1525 | tmp[0] = '\0'; |
| 1526 | } |
| 1527 | |
| 1528 | for (i=0; !done; i++) { |
| 1529 | fmtp_p->fmtp_format = SDP_FMTP_NTE; |
| 1530 | /* Look for comma separated events */ |
| 1531 | fmtp_ptr = sdp_getnextstrtok(fmtp_ptr, tmp, sizeof(tmp), ", \t", &result1); |
| 1532 | if (result1 != SDP_SUCCESS) { |
| 1533 | done = TRUE1; |
| 1534 | continue; |
| 1535 | } |
| 1536 | /* Now look for '-' separated range */ |
| 1537 | ptr2 = tmp; |
| 1538 | low_val = (uint8_t)sdp_getnextnumtok(ptr2, (const char **)&ptr2, |
| 1539 | "- \t", &result1); |
| 1540 | if (*ptr2 == '-') { |
| 1541 | high_val = (uint8_t)sdp_getnextnumtok(ptr2, (const char **)&ptr2, |
| 1542 | "- \t", &result2); |
| 1543 | } else { |
| 1544 | high_val = low_val; |
| 1545 | } |
| 1546 | |
| 1547 | if ((result1 != SDP_SUCCESS) || (result2 != SDP_SUCCESS)) { |
| 1548 | sdp_parse_error(sdp_p, |
| 1549 | "%s Warning: Invalid named events specified for fmtp attribute.", |
| 1550 | sdp_p->debug_str); |
| 1551 | sdp_p->conf_p->num_invalid_param++; |
| 1552 | SDP_FREEfree(temp_ptr); |
| 1553 | return (SDP_INVALID_PARAMETER); |
| 1554 | } |
| 1555 | |
| 1556 | for (i = low_val; i <= high_val; i++) { |
| 1557 | mapword = i/SDP_NE_BITS_PER_WORD( sizeof(uint32_t) * 8 ); |
| 1558 | bmap = ((unsigned)SDP_NE_BIT_0( 0x00000001 )) << (i%32); |
| 1559 | fmtp_p->bmap[mapword] |= bmap; |
| 1560 | } |
| 1561 | if (high_val > fmtp_p->maxval) { |
| 1562 | fmtp_p->maxval = high_val; |
| 1563 | } |
| 1564 | } |
| 1565 | |
| 1566 | if (fmtp_p->maxval == 0) { |
| 1567 | sdp_parse_error(sdp_p, |
| 1568 | "%s Warning: No named events specified for fmtp attribute.", |
| 1569 | sdp_p->debug_str); |
| 1570 | sdp_p->conf_p->num_invalid_param++; |
| 1571 | SDP_FREEfree(temp_ptr); |
| 1572 | return (SDP_INVALID_PARAMETER); |
| 1573 | } |
| 1574 | |
| 1575 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 1576 | SDP_PRINT("%s Parsed a=%s, payload type %u, ", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1578, "sdp", "%s Parsed a=%s, payload type %u, ", sdp_p-> debug_str, sdp_get_attr_name(attr_p->type), attr_p->attr .fmtp.payload_num) |
| 1577 | sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1578, "sdp", "%s Parsed a=%s, payload type %u, ", sdp_p-> debug_str, sdp_get_attr_name(attr_p->type), attr_p->attr .fmtp.payload_num) |
| 1578 | attr_p->attr.fmtp.payload_num)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1578, "sdp", "%s Parsed a=%s, payload type %u, ", sdp_p-> debug_str, sdp_get_attr_name(attr_p->type), attr_p->attr .fmtp.payload_num); |
| 1579 | } |
| 1580 | SDP_FREEfree(temp_ptr); |
| 1581 | return (SDP_SUCCESS); |
| 1582 | } |
| 1583 | |
| 1584 | sdp_result_e |
| 1585 | sdp_build_attr_fmtp_params (sdp_t *sdp_p, sdp_fmtp_t *fmtp_p, flex_string *fs) |
| 1586 | { |
| 1587 | uint16_t event_id; |
| 1588 | uint32_t mask; |
| 1589 | uint32_t mapword; |
| 1590 | uint8_t min = 0; |
| 1591 | uint8_t max = 0; |
| 1592 | tinybool range_start = FALSE0; |
| 1593 | tinybool range_end = FALSE0; |
| 1594 | tinybool semicolon = FALSE0; |
| 1595 | |
| 1596 | switch (fmtp_p->fmtp_format) { |
| 1597 | case SDP_FMTP_MODE: |
| 1598 | sdp_append_name_and_unsigned(fs, "mode", fmtp_p->mode, FALSE0); |
| 1599 | break; |
| 1600 | |
| 1601 | case SDP_FMTP_CODEC_INFO: |
| 1602 | FMTP_BUILD_UNSIGNED(fmtp_p->bitrate > 0, "bitrate", fmtp_p->bitrate)if ((fmtp_p->bitrate > 0)) { sdp_append_name_and_unsigned (fs, ("bitrate"), (fmtp_p->bitrate), semicolon); semicolon = 1; } |
| 1603 | |
| 1604 | FMTP_BUILD_STRING(fmtp_p->annexa_required,if ((fmtp_p->annexa_required)) { sdp_append_name_and_string (fs, ("annexa"), ((fmtp_p->annexa ? "yes" : "no")), semicolon ); semicolon = 1; } |
| 1605 | "annexa", (fmtp_p->annexa ? "yes" : "no"))if ((fmtp_p->annexa_required)) { sdp_append_name_and_string (fs, ("annexa"), ((fmtp_p->annexa ? "yes" : "no")), semicolon ); semicolon = 1; } |
| 1606 | |
| 1607 | FMTP_BUILD_STRING(fmtp_p->annexb_required,if ((fmtp_p->annexb_required)) { sdp_append_name_and_string (fs, ("annexb"), ((fmtp_p->annexa ? "yes" : "no")), semicolon ); semicolon = 1; } |
| 1608 | "annexb", (fmtp_p->annexa ? "yes" : "no"))if ((fmtp_p->annexb_required)) { sdp_append_name_and_string (fs, ("annexb"), ((fmtp_p->annexa ? "yes" : "no")), semicolon ); semicolon = 1; } |
| 1609 | |
| 1610 | FMTP_BUILD_UNSIGNED(fmtp_p->qcif > 0, "QCIF", fmtp_p->qcif)if ((fmtp_p->qcif > 0)) { sdp_append_name_and_unsigned( fs, ("QCIF"), (fmtp_p->qcif), semicolon); semicolon = 1; } |
| 1611 | |
| 1612 | FMTP_BUILD_UNSIGNED(fmtp_p->cif > 0, "CIF", fmtp_p->cif)if ((fmtp_p->cif > 0)) { sdp_append_name_and_unsigned(fs , ("CIF"), (fmtp_p->cif), semicolon); semicolon = 1; } |
| 1613 | |
| 1614 | FMTP_BUILD_UNSIGNED(fmtp_p->maxbr > 0, "MAXBR", fmtp_p->maxbr)if ((fmtp_p->maxbr > 0)) { sdp_append_name_and_unsigned (fs, ("MAXBR"), (fmtp_p->maxbr), semicolon); semicolon = 1 ; } |
| 1615 | |
| 1616 | FMTP_BUILD_UNSIGNED(fmtp_p->sqcif > 0, "SQCIF", fmtp_p->sqcif)if ((fmtp_p->sqcif > 0)) { sdp_append_name_and_unsigned (fs, ("SQCIF"), (fmtp_p->sqcif), semicolon); semicolon = 1 ; } |
| 1617 | |
| 1618 | FMTP_BUILD_UNSIGNED(fmtp_p->cif4 > 0, "CIF4", fmtp_p->cif4)if ((fmtp_p->cif4 > 0)) { sdp_append_name_and_unsigned( fs, ("CIF4"), (fmtp_p->cif4), semicolon); semicolon = 1; } |
| 1619 | |
| 1620 | FMTP_BUILD_UNSIGNED(fmtp_p->cif16 > 0, "CIF16", fmtp_p->cif16)if ((fmtp_p->cif16 > 0)) { sdp_append_name_and_unsigned (fs, ("CIF16"), (fmtp_p->cif16), semicolon); semicolon = 1 ; } |
| 1621 | |
| 1622 | if ((fmtp_p->custom_x > 0) && (fmtp_p->custom_y > 0) && |
| 1623 | (fmtp_p->custom_mpi > 0)) { |
| 1624 | flex_string_sprintf(fs, "%sCUSTOM=%u,%u,%u", |
| 1625 | semicolon ? ";" : "", |
| 1626 | fmtp_p->custom_x, |
| 1627 | fmtp_p->custom_y, |
| 1628 | fmtp_p->custom_mpi); |
| 1629 | |
| 1630 | semicolon = TRUE1; |
| 1631 | } |
| 1632 | |
| 1633 | if ((fmtp_p->par_height > 0) && (fmtp_p->par_width > 0)) { |
| 1634 | flex_string_sprintf(fs, "%sPAR=%u:%u", |
| 1635 | semicolon ? ";" : "", |
| 1636 | fmtp_p->par_width, |
| 1637 | fmtp_p->par_width); |
| 1638 | |
| 1639 | semicolon = TRUE1; |
| 1640 | } |
| 1641 | |
| 1642 | FMTP_BUILD_UNSIGNED(fmtp_p->cpcf > 0, "CPCF", fmtp_p->cpcf)if ((fmtp_p->cpcf > 0)) { sdp_append_name_and_unsigned( fs, ("CPCF"), (fmtp_p->cpcf), semicolon); semicolon = 1; } |
| 1643 | |
| 1644 | FMTP_BUILD_UNSIGNED(fmtp_p->bpp > 0, "BPP", fmtp_p->bpp)if ((fmtp_p->bpp > 0)) { sdp_append_name_and_unsigned(fs , ("BPP"), (fmtp_p->bpp), semicolon); semicolon = 1; } |
| 1645 | |
| 1646 | FMTP_BUILD_UNSIGNED(fmtp_p->hrd > 0, "HRD", fmtp_p->hrd)if ((fmtp_p->hrd > 0)) { sdp_append_name_and_unsigned(fs , ("HRD"), (fmtp_p->hrd), semicolon); semicolon = 1; } |
| 1647 | |
| 1648 | FMTP_BUILD_UNSIGNED(fmtp_p->profile >= 0, "PROFILE", fmtp_p->profile)if ((fmtp_p->profile >= 0)) { sdp_append_name_and_unsigned (fs, ("PROFILE"), (fmtp_p->profile), semicolon); semicolon = 1; } |
| 1649 | |
| 1650 | FMTP_BUILD_UNSIGNED(fmtp_p->level >= 0, "LEVEL", fmtp_p->level)if ((fmtp_p->level >= 0)) { sdp_append_name_and_unsigned (fs, ("LEVEL"), (fmtp_p->level), semicolon); semicolon = 1 ; } |
| 1651 | |
| 1652 | FMTP_BUILD_FLAG(fmtp_p->is_interlace, "INTERLACE")if ((fmtp_p->is_interlace)) { if (semicolon) { flex_string_append (fs, ";"); } flex_string_append(fs, "INTERLACE"); semicolon = 1; } |
| 1653 | |
| 1654 | FMTP_BUILD_FLAG(fmtp_p->annex_d, "D")if ((fmtp_p->annex_d)) { if (semicolon) { flex_string_append (fs, ";"); } flex_string_append(fs, "D"); semicolon = 1; } |
| 1655 | |
| 1656 | FMTP_BUILD_FLAG(fmtp_p->annex_f, "F")if ((fmtp_p->annex_f)) { if (semicolon) { flex_string_append (fs, ";"); } flex_string_append(fs, "F"); semicolon = 1; } |
| 1657 | |
| 1658 | FMTP_BUILD_FLAG(fmtp_p->annex_i, "I")if ((fmtp_p->annex_i)) { if (semicolon) { flex_string_append (fs, ";"); } flex_string_append(fs, "I"); semicolon = 1; } |
| 1659 | |
| 1660 | FMTP_BUILD_FLAG(fmtp_p->annex_j, "J")if ((fmtp_p->annex_j)) { if (semicolon) { flex_string_append (fs, ";"); } flex_string_append(fs, "J"); semicolon = 1; } |
| 1661 | |
| 1662 | FMTP_BUILD_FLAG(fmtp_p->annex_t, "T")if ((fmtp_p->annex_t)) { if (semicolon) { flex_string_append (fs, ";"); } flex_string_append(fs, "T"); semicolon = 1; } |
| 1663 | |
| 1664 | FMTP_BUILD_UNSIGNED(fmtp_p->annex_k_val > 0,if ((fmtp_p->annex_k_val > 0)) { sdp_append_name_and_unsigned (fs, ("K"), (fmtp_p->annex_k_val), semicolon); semicolon = 1; } |
| 1665 | "K", fmtp_p->annex_k_val)if ((fmtp_p->annex_k_val > 0)) { sdp_append_name_and_unsigned (fs, ("K"), (fmtp_p->annex_k_val), semicolon); semicolon = 1; } |
| 1666 | |
| 1667 | FMTP_BUILD_UNSIGNED(fmtp_p->annex_n_val > 0,if ((fmtp_p->annex_n_val > 0)) { sdp_append_name_and_unsigned (fs, ("N"), (fmtp_p->annex_n_val), semicolon); semicolon = 1; } |
| 1668 | "N", fmtp_p->annex_n_val)if ((fmtp_p->annex_n_val > 0)) { sdp_append_name_and_unsigned (fs, ("N"), (fmtp_p->annex_n_val), semicolon); semicolon = 1; } |
| 1669 | |
| 1670 | if ((fmtp_p->annex_p_val_picture_resize > 0) && |
| 1671 | (fmtp_p->annex_p_val_warp > 0)) { |
| 1672 | flex_string_sprintf(fs, "%sP=%d:%d", |
| 1673 | semicolon ? ";" : "", |
| 1674 | fmtp_p->annex_p_val_picture_resize, |
| 1675 | fmtp_p->annex_p_val_warp); |
| 1676 | |
| 1677 | semicolon = TRUE1; |
| 1678 | } |
| 1679 | |
| 1680 | FMTP_BUILD_STRING(strlen(fmtp_p->profile_level_id) > 0,if ((strlen(fmtp_p->profile_level_id) > 0)) { sdp_append_name_and_string (fs, ("profile-level-id"), (fmtp_p->profile_level_id), semicolon ); semicolon = 1; } |
| 1681 | "profile-level-id", fmtp_p->profile_level_id)if ((strlen(fmtp_p->profile_level_id) > 0)) { sdp_append_name_and_string (fs, ("profile-level-id"), (fmtp_p->profile_level_id), semicolon ); semicolon = 1; } |
| 1682 | |
| 1683 | FMTP_BUILD_STRING(strlen(fmtp_p->parameter_sets) > 0,if ((strlen(fmtp_p->parameter_sets) > 0)) { sdp_append_name_and_string (fs, ("sprop-parameter-sets"), (fmtp_p->parameter_sets), semicolon ); semicolon = 1; } |
| 1684 | "sprop-parameter-sets", fmtp_p->parameter_sets)if ((strlen(fmtp_p->parameter_sets) > 0)) { sdp_append_name_and_string (fs, ("sprop-parameter-sets"), (fmtp_p->parameter_sets), semicolon ); semicolon = 1; } |
| 1685 | |
| 1686 | FMTP_BUILD_UNSIGNED(if ((fmtp_p->packetization_mode < 2)) { sdp_append_name_and_unsigned (fs, ("packetization-mode"), (fmtp_p->packetization_mode), semicolon); semicolon = 1; } |
| 1687 | fmtp_p->packetization_mode < SDP_MAX_PACKETIZATION_MODE_VALUE,if ((fmtp_p->packetization_mode < 2)) { sdp_append_name_and_unsigned (fs, ("packetization-mode"), (fmtp_p->packetization_mode), semicolon); semicolon = 1; } |
| 1688 | "packetization-mode", fmtp_p->packetization_mode)if ((fmtp_p->packetization_mode < 2)) { sdp_append_name_and_unsigned (fs, ("packetization-mode"), (fmtp_p->packetization_mode), semicolon); semicolon = 1; } |
| 1689 | |
| 1690 | FMTP_BUILD_UNSIGNED(if ((fmtp_p->level_asymmetry_allowed <= 1)) { sdp_append_name_and_unsigned (fs, ("level-asymmetry-allowed"), (fmtp_p->level_asymmetry_allowed ), semicolon); semicolon = 1; } |
| 1691 | fmtp_p->level_asymmetry_allowed <=if ((fmtp_p->level_asymmetry_allowed <= 1)) { sdp_append_name_and_unsigned (fs, ("level-asymmetry-allowed"), (fmtp_p->level_asymmetry_allowed ), semicolon); semicolon = 1; } |
| 1692 | SDP_MAX_LEVEL_ASYMMETRY_ALLOWED_VALUE,if ((fmtp_p->level_asymmetry_allowed <= 1)) { sdp_append_name_and_unsigned (fs, ("level-asymmetry-allowed"), (fmtp_p->level_asymmetry_allowed ), semicolon); semicolon = 1; } |
| 1693 | "level-asymmetry-allowed", fmtp_p->level_asymmetry_allowed)if ((fmtp_p->level_asymmetry_allowed <= 1)) { sdp_append_name_and_unsigned (fs, ("level-asymmetry-allowed"), (fmtp_p->level_asymmetry_allowed ), semicolon); semicolon = 1; } |
| 1694 | |
| 1695 | FMTP_BUILD_UNSIGNED(fmtp_p->interleaving_depth > 0,if ((fmtp_p->interleaving_depth > 0)) { sdp_append_name_and_unsigned (fs, ("sprop-interleaving-depth"), (fmtp_p->interleaving_depth ), semicolon); semicolon = 1; } |
| 1696 | "sprop-interleaving-depth", fmtp_p->interleaving_depth)if ((fmtp_p->interleaving_depth > 0)) { sdp_append_name_and_unsigned (fs, ("sprop-interleaving-depth"), (fmtp_p->interleaving_depth ), semicolon); semicolon = 1; } |
| 1697 | |
| 1698 | FMTP_BUILD_UNSIGNED(fmtp_p->flag & SDP_DEINT_BUF_REQ_FLAG,if ((fmtp_p->flag & 0x1)) { sdp_append_name_and_unsigned (fs, ("sprop-deint-buf-req"), (fmtp_p->deint_buf_req), semicolon ); semicolon = 1; } |
| 1699 | "sprop-deint-buf-req", fmtp_p->deint_buf_req)if ((fmtp_p->flag & 0x1)) { sdp_append_name_and_unsigned (fs, ("sprop-deint-buf-req"), (fmtp_p->deint_buf_req), semicolon ); semicolon = 1; } |
| 1700 | |
| 1701 | FMTP_BUILD_UNSIGNED(fmtp_p->max_don_diff > 0,if ((fmtp_p->max_don_diff > 0)) { sdp_append_name_and_unsigned (fs, ("sprop-max-don-diff"), (fmtp_p->max_don_diff), semicolon ); semicolon = 1; } |
| 1702 | "sprop-max-don-diff", fmtp_p->max_don_diff)if ((fmtp_p->max_don_diff > 0)) { sdp_append_name_and_unsigned (fs, ("sprop-max-don-diff"), (fmtp_p->max_don_diff), semicolon ); semicolon = 1; } |
| 1703 | |
| 1704 | FMTP_BUILD_UNSIGNED(fmtp_p->flag & SDP_INIT_BUF_TIME_FLAG,if ((fmtp_p->flag & 0x2)) { sdp_append_name_and_unsigned (fs, ("sprop-init-buf-time"), (fmtp_p->init_buf_time), semicolon ); semicolon = 1; } |
| 1705 | "sprop-init-buf-time", fmtp_p->init_buf_time)if ((fmtp_p->flag & 0x2)) { sdp_append_name_and_unsigned (fs, ("sprop-init-buf-time"), (fmtp_p->init_buf_time), semicolon ); semicolon = 1; } |
| 1706 | |
| 1707 | FMTP_BUILD_UNSIGNED(fmtp_p->max_mbps > 0,if ((fmtp_p->max_mbps > 0)) { sdp_append_name_and_unsigned (fs, ("max-mbps"), (fmtp_p->max_mbps), semicolon); semicolon = 1; } |
| 1708 | "max-mbps", fmtp_p->max_mbps)if ((fmtp_p->max_mbps > 0)) { sdp_append_name_and_unsigned (fs, ("max-mbps"), (fmtp_p->max_mbps), semicolon); semicolon = 1; } |
| 1709 | |
| 1710 | FMTP_BUILD_UNSIGNED(fmtp_p->max_fs > 0, "max-fs", fmtp_p->max_fs)if ((fmtp_p->max_fs > 0)) { sdp_append_name_and_unsigned (fs, ("max-fs"), (fmtp_p->max_fs), semicolon); semicolon = 1; } |
| 1711 | |
| 1712 | FMTP_BUILD_UNSIGNED(fmtp_p->max_fr > 0, "max-fr", fmtp_p->max_fr)if ((fmtp_p->max_fr > 0)) { sdp_append_name_and_unsigned (fs, ("max-fr"), (fmtp_p->max_fr), semicolon); semicolon = 1; } |
| 1713 | |
| 1714 | FMTP_BUILD_UNSIGNED(fmtp_p->max_cpb > 0, "max-cpb", fmtp_p->max_cpb)if ((fmtp_p->max_cpb > 0)) { sdp_append_name_and_unsigned (fs, ("max-cpb"), (fmtp_p->max_cpb), semicolon); semicolon = 1; } |
| 1715 | |
| 1716 | FMTP_BUILD_UNSIGNED(fmtp_p->max_dpb > 0, "max-dpb", fmtp_p->max_dpb)if ((fmtp_p->max_dpb > 0)) { sdp_append_name_and_unsigned (fs, ("max-dpb"), (fmtp_p->max_dpb), semicolon); semicolon = 1; } |
| 1717 | |
| 1718 | FMTP_BUILD_UNSIGNED(fmtp_p->max_br > 0, "max-br", fmtp_p->max_br)if ((fmtp_p->max_br > 0)) { sdp_append_name_and_unsigned (fs, ("max-br"), (fmtp_p->max_br), semicolon); semicolon = 1; } |
| 1719 | |
| 1720 | FMTP_BUILD_UNSIGNED(fmtp_p->redundant_pic_cap > 0,if ((fmtp_p->redundant_pic_cap > 0)) { sdp_append_name_and_unsigned (fs, ("redundant-pic-cap"), (fmtp_p->redundant_pic_cap), semicolon ); semicolon = 1; } |
| 1721 | "redundant-pic-cap", fmtp_p->redundant_pic_cap)if ((fmtp_p->redundant_pic_cap > 0)) { sdp_append_name_and_unsigned (fs, ("redundant-pic-cap"), (fmtp_p->redundant_pic_cap), semicolon ); semicolon = 1; } |
| 1722 | |
| 1723 | FMTP_BUILD_UNSIGNED(fmtp_p->flag & SDP_DEINT_BUF_CAP_FLAG,if ((fmtp_p->flag & 0x8)) { sdp_append_name_and_unsigned (fs, ("deint-buf-cap"), (fmtp_p->deint_buf_cap), semicolon ); semicolon = 1; } |
| 1724 | "deint-buf-cap", fmtp_p->deint_buf_cap)if ((fmtp_p->flag & 0x8)) { sdp_append_name_and_unsigned (fs, ("deint-buf-cap"), (fmtp_p->deint_buf_cap), semicolon ); semicolon = 1; } |
| 1725 | |
| 1726 | FMTP_BUILD_UNSIGNED(fmtp_p->flag & SDP_MAX_RCMD_NALU_SIZE_FLAG,if ((fmtp_p->flag & 0x4)) { sdp_append_name_and_unsigned (fs, ("max-rcmd-naFMTP_BUILD_FLlu-size"), (fmtp_p->max_rcmd_nalu_size ), semicolon); semicolon = 1; } |
| 1727 | "max-rcmd-naFMTP_BUILD_FLlu-size", fmtp_p->max_rcmd_nalu_size)if ((fmtp_p->flag & 0x4)) { sdp_append_name_and_unsigned (fs, ("max-rcmd-naFMTP_BUILD_FLlu-size"), (fmtp_p->max_rcmd_nalu_size ), semicolon); semicolon = 1; } |
| 1728 | |
| 1729 | FMTP_BUILD_UNSIGNED(fmtp_p->parameter_add <= 1, "parameter-add",if ((fmtp_p->parameter_add <= 1)) { sdp_append_name_and_unsigned (fs, ("parameter-add"), (fmtp_p->parameter_add), semicolon ); semicolon = 1; } |
| 1730 | fmtp_p->parameter_add)if ((fmtp_p->parameter_add <= 1)) { sdp_append_name_and_unsigned (fs, ("parameter-add"), (fmtp_p->parameter_add), semicolon ); semicolon = 1; } |
| 1731 | |
| 1732 | FMTP_BUILD_UNSIGNED(fmtp_p->maxaveragebitrate > 0,if ((fmtp_p->maxaveragebitrate > 0)) { sdp_append_name_and_unsigned (fs, ("maxaveragebitrate"), (fmtp_p->maxaveragebitrate), semicolon ); semicolon = 1; } |
| 1733 | "maxaveragebitrate", fmtp_p->maxaveragebitrate)if ((fmtp_p->maxaveragebitrate > 0)) { sdp_append_name_and_unsigned (fs, ("maxaveragebitrate"), (fmtp_p->maxaveragebitrate), semicolon ); semicolon = 1; } |
| 1734 | |
| 1735 | FMTP_BUILD_UNSIGNED(fmtp_p->usedtx <= 1, "usedtx", fmtp_p->usedtx)if ((fmtp_p->usedtx <= 1)) { sdp_append_name_and_unsigned (fs, ("usedtx"), (fmtp_p->usedtx), semicolon); semicolon = 1; } |
| 1736 | |
| 1737 | FMTP_BUILD_UNSIGNED(fmtp_p->stereo <= 1, "stereo", fmtp_p->stereo)if ((fmtp_p->stereo <= 1)) { sdp_append_name_and_unsigned (fs, ("stereo"), (fmtp_p->stereo), semicolon); semicolon = 1; } |
| 1738 | |
| 1739 | FMTP_BUILD_UNSIGNED(fmtp_p->useinbandfec <= 1,if ((fmtp_p->useinbandfec <= 1)) { sdp_append_name_and_unsigned (fs, ("useinbandfec"), (fmtp_p->useinbandfec), semicolon); semicolon = 1; } |
| 1740 | "useinbandfec", fmtp_p->useinbandfec)if ((fmtp_p->useinbandfec <= 1)) { sdp_append_name_and_unsigned (fs, ("useinbandfec"), (fmtp_p->useinbandfec), semicolon); semicolon = 1; } |
| 1741 | |
| 1742 | FMTP_BUILD_STRING(strlen(fmtp_p->maxcodedaudiobandwidth) > 0,if ((strlen(fmtp_p->maxcodedaudiobandwidth) > 0)) { sdp_append_name_and_string (fs, ("maxcodedaudiobandwidth"), (fmtp_p->maxcodedaudiobandwidth ), semicolon); semicolon = 1; } |
| 1743 | "maxcodedaudiobandwidth", fmtp_p->maxcodedaudiobandwidth)if ((strlen(fmtp_p->maxcodedaudiobandwidth) > 0)) { sdp_append_name_and_string (fs, ("maxcodedaudiobandwidth"), (fmtp_p->maxcodedaudiobandwidth ), semicolon); semicolon = 1; } |
| 1744 | |
| 1745 | FMTP_BUILD_UNSIGNED(fmtp_p->cbr <= 1, "cbr", fmtp_p->cbr)if ((fmtp_p->cbr <= 1)) { sdp_append_name_and_unsigned( fs, ("cbr"), (fmtp_p->cbr), semicolon); semicolon = 1; } |
| 1746 | |
| 1747 | break; |
| 1748 | |
| 1749 | case SDP_FMTP_NTE: |
| 1750 | default: |
| 1751 | break; |
| 1752 | } |
| 1753 | |
| 1754 | for(event_id = 0, mapword = 0, mask = SDP_NE_BIT_0( 0x00000001 ); |
| 1755 | event_id <= fmtp_p->maxval; |
| 1756 | event_id++, mapword = event_id/SDP_NE_BITS_PER_WORD( sizeof(uint32_t) * 8 ) ) { |
| 1757 | |
| 1758 | if (event_id % SDP_NE_BITS_PER_WORD( sizeof(uint32_t) * 8 )) { |
| 1759 | mask <<= 1; |
| 1760 | } else { |
| 1761 | /* crossed a bitmap word boundary */ |
| 1762 | mask = SDP_NE_BIT_0( 0x00000001 ); |
| 1763 | if (!range_start && !range_end && !fmtp_p->bmap[mapword]) { |
| 1764 | /* no events in this word, skip to the last event id |
| 1765 | * in this bitmap word. */ |
| 1766 | event_id += SDP_NE_BITS_PER_WORD( sizeof(uint32_t) * 8 ) - 1; |
| 1767 | continue; |
| 1768 | } |
| 1769 | } |
| 1770 | |
| 1771 | if (fmtp_p->bmap[mapword] & mask) { |
| 1772 | if (!range_start) { |
| 1773 | range_start = TRUE1; |
| 1774 | min = max = (uint8_t)event_id; |
| 1775 | } else { |
| 1776 | max = (uint8_t)event_id; |
| 1777 | } |
| 1778 | range_end = (max == fmtp_p->maxval); |
| 1779 | } else { |
| 1780 | /* If we were in the middle of a range, then we've hit the |
| 1781 | * end. If we weren't, there is no end to hit. */ |
| 1782 | range_end = range_start; |
| 1783 | } |
| 1784 | |
| 1785 | /* If this is the end of the range, print it to the string. */ |
| 1786 | if (range_end) { |
| 1787 | range_start = range_end = FALSE0; |
| 1788 | |
| 1789 | flex_string_sprintf(fs, "%u", min); |
| 1790 | |
| 1791 | if (min != max) { |
| 1792 | flex_string_sprintf(fs, "-%u", max); |
| 1793 | } |
| 1794 | |
| 1795 | if (max != fmtp_p->maxval) { |
| 1796 | flex_string_append(fs, ","); |
| 1797 | } |
| 1798 | } |
| 1799 | } |
| 1800 | return SDP_SUCCESS; |
| 1801 | } |
| 1802 | |
| 1803 | sdp_result_e sdp_build_attr_fmtp (sdp_t *sdp_p, sdp_attr_t *attr_p, flex_string *fs) |
| 1804 | { |
| 1805 | sdp_fmtp_t *fmtp_p; |
| 1806 | sdp_result_e result; |
| 1807 | |
| 1808 | flex_string_sprintf(fs, "a=%s:%u ", |
| 1809 | sdp_attr[attr_p->type].name, |
| 1810 | attr_p->attr.fmtp.payload_num); |
| 1811 | |
| 1812 | fmtp_p = &(attr_p->attr.fmtp); |
| 1813 | |
| 1814 | result = sdp_build_attr_fmtp_params(sdp_p, fmtp_p, fs); |
| 1815 | |
| 1816 | if (result != SDP_SUCCESS) { |
| 1817 | return result; |
| 1818 | } |
| 1819 | |
| 1820 | flex_string_append(fs, "\r\n"); |
| 1821 | |
| 1822 | return SDP_SUCCESS; |
| 1823 | } |
| 1824 | |
| 1825 | sdp_result_e sdp_parse_attr_sctpmap(sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 1826 | const char *ptr) |
| 1827 | { |
| 1828 | sdp_result_e result = SDP_SUCCESS; |
| 1829 | char tmp[SDP_MAX_STRING_LEN256]; |
| 1830 | uint32_t streams; |
| 1831 | |
| 1832 | /* Find the payload type number. */ |
| 1833 | attr_p->attr.sctpmap.port = (uint16_t)sdp_getnextnumtok(ptr, &ptr, |
| 1834 | " \t", &result); |
| 1835 | if (result != SDP_SUCCESS) { |
| 1836 | sdp_parse_error(sdp_p, |
| 1837 | "%s Warning: no sctpmap port number", |
| 1838 | sdp_p->debug_str); |
| 1839 | return SDP_INVALID_PARAMETER; |
| 1840 | } |
| 1841 | |
| 1842 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 1843 | if (result != SDP_SUCCESS) { |
| 1844 | sdp_parse_error(sdp_p, |
| 1845 | "%s Warning: No sctpmap protocol specified.", |
| 1846 | sdp_p->debug_str); |
| 1847 | sdp_p->conf_p->num_invalid_param++; |
| 1848 | return SDP_INVALID_PARAMETER; |
| 1849 | } |
| 1850 | sstrncpy(attr_p->attr.sctpmap.protocol, tmp, |
| 1851 | sizeof (attr_p->attr.sctpmap.protocol)); |
| 1852 | |
| 1853 | streams = sdp_getnextnumtok(ptr, &ptr, " \t", &result); |
| 1854 | if (result != SDP_SUCCESS) { |
| 1855 | sdp_parse_error(sdp_p, |
| 1856 | "%s Warning: No sctpmap streams specified.", |
| 1857 | sdp_p->debug_str); |
| 1858 | sdp_p->conf_p->num_invalid_param++; |
| 1859 | return SDP_INVALID_PARAMETER; |
| 1860 | } |
| 1861 | |
| 1862 | attr_p->attr.sctpmap.streams = streams; |
| 1863 | |
| 1864 | return SDP_SUCCESS; |
| 1865 | } |
| 1866 | |
| 1867 | sdp_result_e sdp_build_attr_sctpmap(sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 1868 | flex_string *fs) |
| 1869 | { |
| 1870 | flex_string_sprintf(fs, "a=%s:%u %s %u\r\n", |
| 1871 | sdp_attr[attr_p->type].name, |
| 1872 | attr_p->attr.sctpmap.port, |
| 1873 | attr_p->attr.sctpmap.protocol, |
| 1874 | attr_p->attr.sctpmap.streams); |
| 1875 | |
| 1876 | return SDP_SUCCESS; |
| 1877 | } |
| 1878 | |
| 1879 | sdp_result_e sdp_parse_attr_direction (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 1880 | const char *ptr) |
| 1881 | { |
| 1882 | /* No parameters to parse. */ |
| 1883 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 1884 | SDP_PRINT("%s Parsed a=%s", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1885, "sdp", "%s Parsed a=%s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type)) |
| 1885 | sdp_get_attr_name(attr_p->type))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1885, "sdp", "%s Parsed a=%s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type)); |
| 1886 | } |
| 1887 | |
| 1888 | return (SDP_SUCCESS); |
| 1889 | } |
| 1890 | |
| 1891 | sdp_result_e sdp_build_attr_direction (sdp_t *sdp_p, sdp_attr_t *attr_p, flex_string *fs) |
| 1892 | { |
| 1893 | flex_string_sprintf(fs, "a=%s\r\n", sdp_get_attr_name(attr_p->type)); |
| 1894 | |
| 1895 | return SDP_SUCCESS; |
| 1896 | } |
| 1897 | |
| 1898 | sdp_result_e sdp_parse_attr_qos (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 1899 | const char *ptr) |
| 1900 | { |
| 1901 | int i; |
| 1902 | sdp_result_e result; |
| 1903 | char tmp[SDP_MAX_STRING_LEN256]; |
| 1904 | |
| 1905 | /* Find the strength tag. */ |
| 1906 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 1907 | if (result != SDP_SUCCESS) { |
| 1908 | sdp_parse_error(sdp_p, |
| 1909 | "%s Warning: No qos strength tag specified.", |
| 1910 | sdp_p->debug_str); |
| 1911 | sdp_p->conf_p->num_invalid_param++; |
| 1912 | return (SDP_INVALID_PARAMETER); |
| 1913 | } |
| 1914 | attr_p->attr.qos.strength = SDP_QOS_STRENGTH_UNKNOWN; |
| 1915 | for (i=0; i < SDP_MAX_QOS_STRENGTH; i++) { |
| 1916 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_qos_strength[i].name, |
| 1917 | sdp_qos_strength[i].strlen) == 0) { |
| 1918 | attr_p->attr.qos.strength = (sdp_qos_strength_e)i; |
| 1919 | } |
| 1920 | } |
| 1921 | if (attr_p->attr.qos.strength == SDP_QOS_STRENGTH_UNKNOWN) { |
| 1922 | sdp_parse_error(sdp_p, |
| 1923 | "%s Warning: QOS strength tag unrecognized (%s)", |
| 1924 | sdp_p->debug_str, tmp); |
| 1925 | sdp_p->conf_p->num_invalid_param++; |
| 1926 | return (SDP_INVALID_PARAMETER); |
| 1927 | } |
| 1928 | |
| 1929 | /* Find the qos direction. */ |
| 1930 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 1931 | if (result != SDP_SUCCESS) { |
| 1932 | sdp_parse_error(sdp_p, |
| 1933 | "%s Warning: No qos direction specified.", |
| 1934 | sdp_p->debug_str); |
| 1935 | sdp_p->conf_p->num_invalid_param++; |
| 1936 | return (SDP_INVALID_PARAMETER); |
| 1937 | } |
| 1938 | attr_p->attr.qos.direction = SDP_QOS_DIR_UNKNOWN; |
| 1939 | for (i=0; i < SDP_MAX_QOS_DIR; i++) { |
| 1940 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_qos_direction[i].name, |
| 1941 | sdp_qos_direction[i].strlen) == 0) { |
| 1942 | attr_p->attr.qos.direction = (sdp_qos_dir_e)i; |
| 1943 | } |
| 1944 | } |
| 1945 | if (attr_p->attr.qos.direction == SDP_QOS_DIR_UNKNOWN) { |
| 1946 | sdp_parse_error(sdp_p, |
| 1947 | "%s Warning: QOS direction unrecognized (%s)", |
| 1948 | sdp_p->debug_str, tmp); |
| 1949 | sdp_p->conf_p->num_invalid_param++; |
| 1950 | return (SDP_INVALID_PARAMETER); |
| 1951 | } |
| 1952 | |
| 1953 | /* See if confirm was specified. Defaults to FALSE. */ |
| 1954 | attr_p->attr.qos.confirm = FALSE0; |
| 1955 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 1956 | if (result == SDP_SUCCESS) { |
| 1957 | if (cpr_strncasecmpstrncasecmp(tmp, "confirm", sizeof("confirm")) == 0) { |
| 1958 | attr_p->attr.qos.confirm = TRUE1; |
| 1959 | } |
| 1960 | if (attr_p->attr.qos.confirm == FALSE0) { |
| 1961 | sdp_parse_error(sdp_p, |
| 1962 | "%s Warning: QOS confirm parameter invalid (%s)", |
| 1963 | sdp_p->debug_str, tmp); |
| 1964 | sdp_p->conf_p->num_invalid_param++; |
| 1965 | return (SDP_INVALID_PARAMETER); |
| 1966 | } |
| 1967 | } |
| 1968 | |
| 1969 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 1970 | SDP_PRINT("%s Parsed a=%s, strength %s, direction %s, confirm %s",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1974, "sdp", "%s Parsed a=%s, strength %s, direction %s, confirm %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_qos_strength_name (attr_p->attr.qos.strength), sdp_get_qos_direction_name(attr_p ->attr.qos.direction), (attr_p->attr.qos.confirm ? "set" : "not set")) |
| 1971 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1974, "sdp", "%s Parsed a=%s, strength %s, direction %s, confirm %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_qos_strength_name (attr_p->attr.qos.strength), sdp_get_qos_direction_name(attr_p ->attr.qos.direction), (attr_p->attr.qos.confirm ? "set" : "not set")) |
| 1972 | sdp_get_qos_strength_name(attr_p->attr.qos.strength),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1974, "sdp", "%s Parsed a=%s, strength %s, direction %s, confirm %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_qos_strength_name (attr_p->attr.qos.strength), sdp_get_qos_direction_name(attr_p ->attr.qos.direction), (attr_p->attr.qos.confirm ? "set" : "not set")) |
| 1973 | sdp_get_qos_direction_name(attr_p->attr.qos.direction),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1974, "sdp", "%s Parsed a=%s, strength %s, direction %s, confirm %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_qos_strength_name (attr_p->attr.qos.strength), sdp_get_qos_direction_name(attr_p ->attr.qos.direction), (attr_p->attr.qos.confirm ? "set" : "not set")) |
| 1974 | (attr_p->attr.qos.confirm ? "set" : "not set"))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 1974, "sdp", "%s Parsed a=%s, strength %s, direction %s, confirm %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_qos_strength_name (attr_p->attr.qos.strength), sdp_get_qos_direction_name(attr_p ->attr.qos.direction), (attr_p->attr.qos.confirm ? "set" : "not set")); |
| 1975 | } |
| 1976 | |
| 1977 | return (SDP_SUCCESS); |
| 1978 | } |
| 1979 | |
| 1980 | sdp_result_e sdp_build_attr_qos (sdp_t *sdp_p, sdp_attr_t *attr_p, flex_string *fs) |
| 1981 | { |
| 1982 | flex_string_sprintf(fs, "a=%s:%s %s%s\r\n", sdp_attr[attr_p->type].name, |
| 1983 | sdp_get_qos_strength_name(attr_p->attr.qos.strength), |
| 1984 | sdp_get_qos_direction_name(attr_p->attr.qos.direction), |
| 1985 | attr_p->attr.qos.confirm ? " confirm" : ""); |
| 1986 | |
| 1987 | return SDP_SUCCESS; |
| 1988 | } |
| 1989 | |
| 1990 | sdp_result_e sdp_parse_attr_curr (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 1991 | const char *ptr) |
| 1992 | { |
| 1993 | int i; |
| 1994 | sdp_result_e result; |
| 1995 | char tmp[SDP_MAX_STRING_LEN256]; |
| 1996 | |
| 1997 | /* Find the curr type tag. */ |
| 1998 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 1999 | if (result != SDP_SUCCESS) { |
| 2000 | sdp_parse_error(sdp_p, |
| 2001 | "%s Warning: No curr attr type specified.", |
| 2002 | sdp_p->debug_str); |
| 2003 | sdp_p->conf_p->num_invalid_param++; |
| 2004 | return (SDP_INVALID_PARAMETER); |
| 2005 | } |
| 2006 | attr_p->attr.curr.type = SDP_CURR_UNKNOWN_TYPE; |
| 2007 | for (i=0; i < SDP_MAX_CURR_TYPES; i++) { |
| 2008 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_curr_type[i].name, |
| 2009 | sdp_curr_type[i].strlen) == 0) { |
| 2010 | attr_p->attr.curr.type = (sdp_curr_type_e)i; |
| 2011 | } |
| 2012 | } |
| 2013 | |
| 2014 | if (attr_p->attr.curr.type != SDP_CURR_QOS_TYPE) { |
| 2015 | sdp_parse_error(sdp_p, |
| 2016 | "%s Warning: Unknown curr type.", |
| 2017 | sdp_p->debug_str); |
| 2018 | sdp_p->conf_p->num_invalid_param++; |
| 2019 | return (SDP_INVALID_PARAMETER); |
| 2020 | } |
| 2021 | |
| 2022 | /* Check qos status type */ |
| 2023 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 2024 | if (result != SDP_SUCCESS) { |
| 2025 | sdp_parse_error(sdp_p, |
| 2026 | "%s Warning: No curr attr type specified.", |
| 2027 | sdp_p->debug_str); |
| 2028 | sdp_p->conf_p->num_invalid_param++; |
| 2029 | return (SDP_INVALID_PARAMETER); |
| 2030 | } |
| 2031 | attr_p->attr.curr.status_type = SDP_QOS_STATUS_TYPE_UNKNOWN; |
| 2032 | for (i=0; i < SDP_MAX_QOS_STATUS_TYPES; i++) { |
| 2033 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_qos_status_type[i].name, |
| 2034 | sdp_qos_status_type[i].strlen) == 0) { |
| 2035 | attr_p->attr.curr.status_type = (sdp_qos_status_types_e)i; |
| 2036 | } |
| 2037 | } |
| 2038 | |
| 2039 | |
| 2040 | /* Find the qos direction. */ |
| 2041 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 2042 | if (result != SDP_SUCCESS) { |
| 2043 | sdp_parse_error(sdp_p, |
| 2044 | "%s Warning: No qos direction specified.", |
| 2045 | sdp_p->debug_str); |
| 2046 | sdp_p->conf_p->num_invalid_param++; |
| 2047 | return (SDP_INVALID_PARAMETER); |
| 2048 | } |
| 2049 | attr_p->attr.curr.direction = SDP_QOS_DIR_UNKNOWN; |
| 2050 | for (i=0; i < SDP_MAX_QOS_DIR; i++) { |
| 2051 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_qos_direction[i].name, |
| 2052 | sdp_qos_direction[i].strlen) == 0) { |
| 2053 | attr_p->attr.curr.direction = (sdp_qos_dir_e)i; |
| 2054 | } |
| 2055 | } |
| 2056 | if (attr_p->attr.curr.direction == SDP_QOS_DIR_UNKNOWN) { |
| 2057 | sdp_parse_error(sdp_p, |
| 2058 | "%s Warning: QOS direction unrecognized (%s)", |
| 2059 | sdp_p->debug_str, tmp); |
| 2060 | sdp_p->conf_p->num_invalid_param++; |
| 2061 | return (SDP_INVALID_PARAMETER); |
| 2062 | } |
| 2063 | |
| 2064 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 2065 | SDP_PRINT("%s Parsed a=%s, type %s status type %s, direction %s",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2069, "sdp", "%s Parsed a=%s, type %s status type %s, direction %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_curr_type_name (attr_p->attr.curr.type), sdp_get_qos_status_type_name(attr_p ->attr.curr.status_type), sdp_get_qos_direction_name(attr_p ->attr.curr.direction)) |
| 2066 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2069, "sdp", "%s Parsed a=%s, type %s status type %s, direction %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_curr_type_name (attr_p->attr.curr.type), sdp_get_qos_status_type_name(attr_p ->attr.curr.status_type), sdp_get_qos_direction_name(attr_p ->attr.curr.direction)) |
| 2067 | sdp_get_curr_type_name(attr_p->attr.curr.type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2069, "sdp", "%s Parsed a=%s, type %s status type %s, direction %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_curr_type_name (attr_p->attr.curr.type), sdp_get_qos_status_type_name(attr_p ->attr.curr.status_type), sdp_get_qos_direction_name(attr_p ->attr.curr.direction)) |
| 2068 | sdp_get_qos_status_type_name(attr_p->attr.curr.status_type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2069, "sdp", "%s Parsed a=%s, type %s status type %s, direction %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_curr_type_name (attr_p->attr.curr.type), sdp_get_qos_status_type_name(attr_p ->attr.curr.status_type), sdp_get_qos_direction_name(attr_p ->attr.curr.direction)) |
| 2069 | sdp_get_qos_direction_name(attr_p->attr.curr.direction))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2069, "sdp", "%s Parsed a=%s, type %s status type %s, direction %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_curr_type_name (attr_p->attr.curr.type), sdp_get_qos_status_type_name(attr_p ->attr.curr.status_type), sdp_get_qos_direction_name(attr_p ->attr.curr.direction)); |
| 2070 | } |
| 2071 | |
| 2072 | return (SDP_SUCCESS); |
| 2073 | } |
| 2074 | |
| 2075 | sdp_result_e sdp_build_attr_curr (sdp_t *sdp_p, sdp_attr_t *attr_p, flex_string *fs) |
| 2076 | { |
| 2077 | flex_string_sprintf(fs, "a=%s:%s %s %s\r\n", |
| 2078 | sdp_attr[attr_p->type].name, |
| 2079 | sdp_get_curr_type_name(attr_p->attr.curr.type), |
| 2080 | sdp_get_qos_status_type_name(attr_p->attr.curr.status_type), |
| 2081 | sdp_get_qos_direction_name(attr_p->attr.curr.direction)); |
| 2082 | |
| 2083 | return SDP_SUCCESS; |
| 2084 | } |
| 2085 | |
| 2086 | sdp_result_e sdp_parse_attr_des (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 2087 | const char *ptr) |
| 2088 | { |
| 2089 | int i; |
| 2090 | sdp_result_e result; |
| 2091 | char tmp[SDP_MAX_STRING_LEN256]; |
| 2092 | |
| 2093 | /* Find the curr type tag. */ |
| 2094 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 2095 | if (result != SDP_SUCCESS) { |
| 2096 | sdp_parse_error(sdp_p, |
| 2097 | "%s Warning: No des attr type specified.", |
| 2098 | sdp_p->debug_str); |
| 2099 | sdp_p->conf_p->num_invalid_param++; |
| 2100 | return (SDP_INVALID_PARAMETER); |
| 2101 | } |
| 2102 | attr_p->attr.des.type = SDP_DES_UNKNOWN_TYPE; |
| 2103 | for (i=0; i < SDP_MAX_CURR_TYPES; i++) { |
| 2104 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_des_type[i].name, |
| 2105 | sdp_des_type[i].strlen) == 0) { |
| 2106 | attr_p->attr.des.type = (sdp_des_type_e)i; |
| 2107 | } |
| 2108 | } |
| 2109 | |
| 2110 | if (attr_p->attr.des.type != SDP_DES_QOS_TYPE) { |
| 2111 | sdp_parse_error(sdp_p, |
| 2112 | "%s Warning: Unknown conf type.", |
| 2113 | sdp_p->debug_str); |
| 2114 | sdp_p->conf_p->num_invalid_param++; |
| 2115 | return (SDP_INVALID_PARAMETER); |
| 2116 | } |
| 2117 | |
| 2118 | /* Find the strength tag. */ |
| 2119 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 2120 | if (result != SDP_SUCCESS) { |
| 2121 | sdp_parse_error(sdp_p, |
| 2122 | "%s Warning: No qos strength tag specified.", |
| 2123 | sdp_p->debug_str); |
| 2124 | sdp_p->conf_p->num_invalid_param++; |
| 2125 | return (SDP_INVALID_PARAMETER); |
| 2126 | } |
| 2127 | attr_p->attr.des.strength = SDP_QOS_STRENGTH_UNKNOWN; |
| 2128 | for (i=0; i < SDP_MAX_QOS_STRENGTH; i++) { |
| 2129 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_qos_strength[i].name, |
| 2130 | sdp_qos_strength[i].strlen) == 0) { |
| 2131 | attr_p->attr.des.strength = (sdp_qos_strength_e)i; |
| 2132 | } |
| 2133 | } |
| 2134 | if (attr_p->attr.des.strength == SDP_QOS_STRENGTH_UNKNOWN) { |
| 2135 | sdp_parse_error(sdp_p, |
| 2136 | "%s Warning: QOS strength tag unrecognized (%s)", |
| 2137 | sdp_p->debug_str, tmp); |
| 2138 | sdp_p->conf_p->num_invalid_param++; |
| 2139 | return (SDP_INVALID_PARAMETER); |
| 2140 | } |
| 2141 | |
| 2142 | /* Check qos status type */ |
| 2143 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 2144 | if (result != SDP_SUCCESS) { |
| 2145 | sdp_parse_error(sdp_p, |
| 2146 | "%s Warning: No des attr type specified.", |
| 2147 | sdp_p->debug_str); |
| 2148 | sdp_p->conf_p->num_invalid_param++; |
| 2149 | return (SDP_INVALID_PARAMETER); |
| 2150 | } |
| 2151 | attr_p->attr.des.status_type = SDP_QOS_STATUS_TYPE_UNKNOWN; |
| 2152 | for (i=0; i < SDP_MAX_QOS_STATUS_TYPES; i++) { |
| 2153 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_qos_status_type[i].name, |
| 2154 | sdp_qos_status_type[i].strlen) == 0) { |
| 2155 | attr_p->attr.des.status_type = (sdp_qos_status_types_e)i; |
| 2156 | } |
| 2157 | } |
| 2158 | |
| 2159 | |
| 2160 | /* Find the qos direction. */ |
| 2161 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 2162 | if (result != SDP_SUCCESS) { |
| 2163 | sdp_parse_error(sdp_p, |
| 2164 | "%s Warning: No qos direction specified.", |
| 2165 | sdp_p->debug_str); |
| 2166 | sdp_p->conf_p->num_invalid_param++; |
| 2167 | return (SDP_INVALID_PARAMETER); |
| 2168 | } |
| 2169 | attr_p->attr.des.direction = SDP_QOS_DIR_UNKNOWN; |
| 2170 | for (i=0; i < SDP_MAX_QOS_DIR; i++) { |
| 2171 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_qos_direction[i].name, |
| 2172 | sdp_qos_direction[i].strlen) == 0) { |
| 2173 | attr_p->attr.des.direction = (sdp_qos_dir_e)i; |
| 2174 | } |
| 2175 | } |
| 2176 | if (attr_p->attr.des.direction == SDP_QOS_DIR_UNKNOWN) { |
| 2177 | sdp_parse_error(sdp_p, |
| 2178 | "%s Warning: QOS direction unrecognized (%s)", |
| 2179 | sdp_p->debug_str, tmp); |
| 2180 | sdp_p->conf_p->num_invalid_param++; |
| 2181 | return (SDP_INVALID_PARAMETER); |
| 2182 | } |
| 2183 | |
| 2184 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 2185 | SDP_PRINT("%s Parsed a=%s, type %s strength %s status type %s, direction %s",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2190, "sdp", "%s Parsed a=%s, type %s strength %s status type %s, direction %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_des_type_name (attr_p->attr.des.type), sdp_get_qos_strength_name(attr_p-> attr.qos.strength), sdp_get_qos_status_type_name(attr_p->attr .des.status_type), sdp_get_qos_direction_name(attr_p->attr .des.direction)) |
| 2186 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2190, "sdp", "%s Parsed a=%s, type %s strength %s status type %s, direction %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_des_type_name (attr_p->attr.des.type), sdp_get_qos_strength_name(attr_p-> attr.qos.strength), sdp_get_qos_status_type_name(attr_p->attr .des.status_type), sdp_get_qos_direction_name(attr_p->attr .des.direction)) |
| 2187 | sdp_get_des_type_name(attr_p->attr.des.type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2190, "sdp", "%s Parsed a=%s, type %s strength %s status type %s, direction %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_des_type_name (attr_p->attr.des.type), sdp_get_qos_strength_name(attr_p-> attr.qos.strength), sdp_get_qos_status_type_name(attr_p->attr .des.status_type), sdp_get_qos_direction_name(attr_p->attr .des.direction)) |
| 2188 | sdp_get_qos_strength_name(attr_p->attr.qos.strength),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2190, "sdp", "%s Parsed a=%s, type %s strength %s status type %s, direction %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_des_type_name (attr_p->attr.des.type), sdp_get_qos_strength_name(attr_p-> attr.qos.strength), sdp_get_qos_status_type_name(attr_p->attr .des.status_type), sdp_get_qos_direction_name(attr_p->attr .des.direction)) |
| 2189 | sdp_get_qos_status_type_name(attr_p->attr.des.status_type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2190, "sdp", "%s Parsed a=%s, type %s strength %s status type %s, direction %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_des_type_name (attr_p->attr.des.type), sdp_get_qos_strength_name(attr_p-> attr.qos.strength), sdp_get_qos_status_type_name(attr_p->attr .des.status_type), sdp_get_qos_direction_name(attr_p->attr .des.direction)) |
| 2190 | sdp_get_qos_direction_name(attr_p->attr.des.direction))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2190, "sdp", "%s Parsed a=%s, type %s strength %s status type %s, direction %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_des_type_name (attr_p->attr.des.type), sdp_get_qos_strength_name(attr_p-> attr.qos.strength), sdp_get_qos_status_type_name(attr_p->attr .des.status_type), sdp_get_qos_direction_name(attr_p->attr .des.direction)); |
| 2191 | } |
| 2192 | |
| 2193 | return (SDP_SUCCESS); |
| 2194 | } |
| 2195 | |
| 2196 | |
| 2197 | sdp_result_e sdp_build_attr_des (sdp_t *sdp_p, sdp_attr_t *attr_p, flex_string *fs) |
| 2198 | { |
| 2199 | flex_string_sprintf(fs, "a=%s:%s %s %s %s\r\n", |
| 2200 | sdp_attr[attr_p->type].name, |
| 2201 | sdp_get_curr_type_name((sdp_curr_type_e)attr_p->attr.des.type), |
| 2202 | sdp_get_qos_strength_name(attr_p->attr.des.strength), |
| 2203 | sdp_get_qos_status_type_name(attr_p->attr.des.status_type), |
| 2204 | sdp_get_qos_direction_name(attr_p->attr.des.direction)); |
| 2205 | |
| 2206 | return SDP_SUCCESS; |
| 2207 | } |
| 2208 | |
| 2209 | sdp_result_e sdp_parse_attr_conf (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 2210 | const char *ptr) |
| 2211 | { |
| 2212 | int i; |
| 2213 | sdp_result_e result; |
| 2214 | char tmp[SDP_MAX_STRING_LEN256]; |
| 2215 | |
| 2216 | /* Find the curr type tag. */ |
| 2217 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 2218 | if (result != SDP_SUCCESS) { |
| 2219 | sdp_parse_error(sdp_p, |
| 2220 | "%s Warning: No conf attr type specified.", |
| 2221 | sdp_p->debug_str); |
| 2222 | sdp_p->conf_p->num_invalid_param++; |
| 2223 | return (SDP_INVALID_PARAMETER); |
| 2224 | } |
| 2225 | attr_p->attr.conf.type = SDP_CONF_UNKNOWN_TYPE; |
| 2226 | for (i=0; i < SDP_MAX_CURR_TYPES; i++) { |
| 2227 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_conf_type[i].name, |
| 2228 | sdp_conf_type[i].strlen) == 0) { |
| 2229 | attr_p->attr.conf.type = (sdp_conf_type_e)i; |
| 2230 | } |
| 2231 | } |
| 2232 | |
| 2233 | if (attr_p->attr.conf.type != SDP_CONF_QOS_TYPE) { |
| 2234 | sdp_parse_error(sdp_p, |
| 2235 | "%s Warning: Unknown conf type.", |
| 2236 | sdp_p->debug_str); |
| 2237 | sdp_p->conf_p->num_invalid_param++; |
| 2238 | return (SDP_INVALID_PARAMETER); |
| 2239 | } |
| 2240 | |
| 2241 | /* Check qos status type */ |
| 2242 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 2243 | if (result != SDP_SUCCESS) { |
| 2244 | sdp_parse_error(sdp_p, |
| 2245 | "%s Warning: No conf attr type specified.", |
| 2246 | sdp_p->debug_str); |
| 2247 | sdp_p->conf_p->num_invalid_param++; |
| 2248 | return (SDP_INVALID_PARAMETER); |
| 2249 | } |
| 2250 | attr_p->attr.conf.status_type = SDP_QOS_STATUS_TYPE_UNKNOWN; |
| 2251 | for (i=0; i < SDP_MAX_QOS_STATUS_TYPES; i++) { |
| 2252 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_qos_status_type[i].name, |
| 2253 | sdp_qos_status_type[i].strlen) == 0) { |
| 2254 | attr_p->attr.conf.status_type = (sdp_qos_status_types_e)i; |
| 2255 | } |
| 2256 | } |
| 2257 | |
| 2258 | |
| 2259 | /* Find the qos direction. */ |
| 2260 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 2261 | if (result != SDP_SUCCESS) { |
| 2262 | sdp_parse_error(sdp_p, |
| 2263 | "%s Warning: No qos direction specified.", |
| 2264 | sdp_p->debug_str); |
| 2265 | sdp_p->conf_p->num_invalid_param++; |
| 2266 | return (SDP_INVALID_PARAMETER); |
| 2267 | } |
| 2268 | attr_p->attr.conf.direction = SDP_QOS_DIR_UNKNOWN; |
| 2269 | for (i=0; i < SDP_MAX_QOS_DIR; i++) { |
| 2270 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_qos_direction[i].name, |
| 2271 | sdp_qos_direction[i].strlen) == 0) { |
| 2272 | attr_p->attr.conf.direction = (sdp_qos_dir_e)i; |
| 2273 | } |
| 2274 | } |
| 2275 | if (attr_p->attr.conf.direction == SDP_QOS_DIR_UNKNOWN) { |
| 2276 | sdp_parse_error(sdp_p, |
| 2277 | "%s Warning: QOS direction unrecognized (%s)", |
| 2278 | sdp_p->debug_str, tmp); |
| 2279 | sdp_p->conf_p->num_invalid_param++; |
| 2280 | return (SDP_INVALID_PARAMETER); |
| 2281 | } |
| 2282 | |
| 2283 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 2284 | SDP_PRINT("%s Parsed a=%s, type %s status type %s, direction %s",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2288, "sdp", "%s Parsed a=%s, type %s status type %s, direction %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_conf_type_name (attr_p->attr.conf.type), sdp_get_qos_status_type_name(attr_p ->attr.conf.status_type), sdp_get_qos_direction_name(attr_p ->attr.conf.direction)) |
| 2285 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2288, "sdp", "%s Parsed a=%s, type %s status type %s, direction %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_conf_type_name (attr_p->attr.conf.type), sdp_get_qos_status_type_name(attr_p ->attr.conf.status_type), sdp_get_qos_direction_name(attr_p ->attr.conf.direction)) |
| 2286 | sdp_get_conf_type_name(attr_p->attr.conf.type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2288, "sdp", "%s Parsed a=%s, type %s status type %s, direction %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_conf_type_name (attr_p->attr.conf.type), sdp_get_qos_status_type_name(attr_p ->attr.conf.status_type), sdp_get_qos_direction_name(attr_p ->attr.conf.direction)) |
| 2287 | sdp_get_qos_status_type_name(attr_p->attr.conf.status_type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2288, "sdp", "%s Parsed a=%s, type %s status type %s, direction %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_conf_type_name (attr_p->attr.conf.type), sdp_get_qos_status_type_name(attr_p ->attr.conf.status_type), sdp_get_qos_direction_name(attr_p ->attr.conf.direction)) |
| 2288 | sdp_get_qos_direction_name(attr_p->attr.conf.direction))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2288, "sdp", "%s Parsed a=%s, type %s status type %s, direction %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_conf_type_name (attr_p->attr.conf.type), sdp_get_qos_status_type_name(attr_p ->attr.conf.status_type), sdp_get_qos_direction_name(attr_p ->attr.conf.direction)); |
| 2289 | } |
| 2290 | |
| 2291 | return (SDP_SUCCESS); |
| 2292 | } |
| 2293 | |
| 2294 | sdp_result_e sdp_build_attr_conf (sdp_t *sdp_p, sdp_attr_t *attr_p, flex_string *fs) |
| 2295 | { |
| 2296 | flex_string_sprintf(fs, "a=%s:%s %s %s\r\n", |
| 2297 | sdp_attr[attr_p->type].name, |
| 2298 | sdp_get_conf_type_name(attr_p->attr.conf.type), |
| 2299 | sdp_get_qos_status_type_name(attr_p->attr.conf.status_type), |
| 2300 | sdp_get_qos_direction_name(attr_p->attr.conf.direction)); |
| 2301 | |
| 2302 | return SDP_SUCCESS; |
| 2303 | } |
| 2304 | |
| 2305 | /* |
| 2306 | * Parse a rtpmap or a sprtmap. Both formats use the same structure |
| 2307 | * the only difference being the keyword "rtpmap" vs "sprtmap". The |
| 2308 | * rtpmap field in the sdp_attr_t is used to store both mappings. |
| 2309 | */ |
| 2310 | sdp_result_e sdp_parse_attr_transport_map (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 2311 | const char *ptr) |
| 2312 | { |
| 2313 | sdp_result_e result; |
| 2314 | |
| 2315 | attr_p->attr.transport_map.payload_num = 0; |
| 2316 | attr_p->attr.transport_map.encname[0] = '\0'; |
| 2317 | attr_p->attr.transport_map.clockrate = 0; |
| 2318 | attr_p->attr.transport_map.num_chan = 1; |
| 2319 | |
| 2320 | /* Find the payload type number. */ |
| 2321 | attr_p->attr.transport_map.payload_num = |
| 2322 | (uint16_t)sdp_getnextnumtok(ptr, &ptr, " \t", &result); |
| 2323 | if (result != SDP_SUCCESS) { |
| 2324 | sdp_parse_error(sdp_p, |
| 2325 | "%s Warning: Invalid payload type specified for %s attribute.", |
| 2326 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type)); |
| 2327 | sdp_p->conf_p->num_invalid_param++; |
| 2328 | return (SDP_INVALID_PARAMETER); |
| 2329 | } |
| 2330 | |
| 2331 | /* Find the encoding name. */ |
| 2332 | ptr = sdp_getnextstrtok(ptr, attr_p->attr.transport_map.encname, |
| 2333 | sizeof(attr_p->attr.transport_map.encname), "/ \t", &result); |
| 2334 | if (result != SDP_SUCCESS) { |
| 2335 | sdp_parse_error(sdp_p, |
| 2336 | "%s Warning: No encoding name specified in %s attribute.", |
| 2337 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type)); |
| 2338 | sdp_p->conf_p->num_invalid_param++; |
| 2339 | return (SDP_INVALID_PARAMETER); |
| 2340 | } |
| 2341 | |
| 2342 | /* Find the clockrate. */ |
| 2343 | attr_p->attr.transport_map.clockrate = |
| 2344 | sdp_getnextnumtok(ptr, &ptr, "/ \t", &result); |
| 2345 | if (result != SDP_SUCCESS) { |
| 2346 | sdp_parse_error(sdp_p, |
| 2347 | "%s Warning: No clockrate specified for " |
| 2348 | "%s attribute, set to default of 8000.", |
| 2349 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type)); |
| 2350 | attr_p->attr.transport_map.clockrate = 8000; |
| 2351 | } |
| 2352 | |
| 2353 | /* Find the number of channels, if specified. This is optional. */ |
| 2354 | if (*ptr == '/') { |
| 2355 | /* If a '/' exists, expect something valid beyond it. */ |
| 2356 | attr_p->attr.transport_map.num_chan = |
| 2357 | (uint16_t)sdp_getnextnumtok(ptr, &ptr, "/ \t", &result); |
| 2358 | if (result != SDP_SUCCESS) { |
| 2359 | sdp_parse_error(sdp_p, |
| 2360 | "%s Warning: Invalid number of channels parameter" |
| 2361 | " for rtpmap attribute.", sdp_p->debug_str); |
| 2362 | sdp_p->conf_p->num_invalid_param++; |
| 2363 | return (SDP_INVALID_PARAMETER); |
| 2364 | } |
| 2365 | } |
| 2366 | |
| 2367 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 2368 | SDP_PRINT("%s Parsed a=%s, payload type %u, encoding name %s, "SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2373, "sdp", "%s Parsed a=%s, payload type %u, encoding name %s, " "clockrate %u", sdp_p->debug_str, sdp_get_attr_name(attr_p ->type), attr_p->attr.transport_map.payload_num, attr_p ->attr.transport_map.encname, attr_p->attr.transport_map .clockrate) |
| 2369 | "clockrate %u", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2373, "sdp", "%s Parsed a=%s, payload type %u, encoding name %s, " "clockrate %u", sdp_p->debug_str, sdp_get_attr_name(attr_p ->type), attr_p->attr.transport_map.payload_num, attr_p ->attr.transport_map.encname, attr_p->attr.transport_map .clockrate) |
| 2370 | sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2373, "sdp", "%s Parsed a=%s, payload type %u, encoding name %s, " "clockrate %u", sdp_p->debug_str, sdp_get_attr_name(attr_p ->type), attr_p->attr.transport_map.payload_num, attr_p ->attr.transport_map.encname, attr_p->attr.transport_map .clockrate) |
| 2371 | attr_p->attr.transport_map.payload_num,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2373, "sdp", "%s Parsed a=%s, payload type %u, encoding name %s, " "clockrate %u", sdp_p->debug_str, sdp_get_attr_name(attr_p ->type), attr_p->attr.transport_map.payload_num, attr_p ->attr.transport_map.encname, attr_p->attr.transport_map .clockrate) |
| 2372 | attr_p->attr.transport_map.encname,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2373, "sdp", "%s Parsed a=%s, payload type %u, encoding name %s, " "clockrate %u", sdp_p->debug_str, sdp_get_attr_name(attr_p ->type), attr_p->attr.transport_map.payload_num, attr_p ->attr.transport_map.encname, attr_p->attr.transport_map .clockrate) |
| 2373 | attr_p->attr.transport_map.clockrate)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2373, "sdp", "%s Parsed a=%s, payload type %u, encoding name %s, " "clockrate %u", sdp_p->debug_str, sdp_get_attr_name(attr_p ->type), attr_p->attr.transport_map.payload_num, attr_p ->attr.transport_map.encname, attr_p->attr.transport_map .clockrate); |
| 2374 | if (attr_p->attr.transport_map.num_chan != 1) { |
| 2375 | SDP_PRINT("/%u", attr_p->attr.transport_map.num_chan)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2375, "sdp", "/%u", attr_p->attr.transport_map.num_chan); |
| 2376 | } |
| 2377 | } |
| 2378 | |
| 2379 | return (SDP_SUCCESS); |
| 2380 | } |
| 2381 | |
| 2382 | /* |
| 2383 | * Build a rtpmap or a sprtmap. Both formats use the same structure |
| 2384 | * the only difference being the keyword "rtpmap" vs "sprtmap". The |
| 2385 | * rtpmap field in the sdp_attr_t is used for both mappings. |
| 2386 | */ |
| 2387 | sdp_result_e sdp_build_attr_transport_map (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 2388 | flex_string *fs) |
| 2389 | { |
| 2390 | if (attr_p->attr.transport_map.num_chan == 1) { |
| 2391 | flex_string_sprintf(fs, "a=%s:%u %s/%u\r\n", |
| 2392 | sdp_attr[attr_p->type].name, |
| 2393 | attr_p->attr.transport_map.payload_num, |
| 2394 | attr_p->attr.transport_map.encname, |
| 2395 | attr_p->attr.transport_map.clockrate); |
| 2396 | } else { |
| 2397 | flex_string_sprintf(fs, "a=%s:%u %s/%u/%u\r\n", |
| 2398 | sdp_attr[attr_p->type].name, |
| 2399 | attr_p->attr.transport_map.payload_num, |
| 2400 | attr_p->attr.transport_map.encname, |
| 2401 | attr_p->attr.transport_map.clockrate, |
| 2402 | attr_p->attr.transport_map.num_chan); |
| 2403 | } |
| 2404 | |
| 2405 | return SDP_SUCCESS; |
| 2406 | } |
| 2407 | |
| 2408 | sdp_result_e sdp_parse_attr_subnet (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 2409 | const char *ptr) |
| 2410 | { |
| 2411 | int i; |
| 2412 | char *slash_ptr; |
| 2413 | sdp_result_e result; |
| 2414 | tinybool type_found = FALSE0; |
| 2415 | char tmp[SDP_MAX_STRING_LEN256]; |
| 2416 | |
| 2417 | /* Find the subnet network type. */ |
| 2418 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 2419 | if (result != SDP_SUCCESS) { |
| 2420 | sdp_parse_error(sdp_p, |
| 2421 | "%s Warning: No network type specified in subnet attribute.", |
| 2422 | sdp_p->debug_str); |
| 2423 | sdp_p->conf_p->num_invalid_param++; |
| 2424 | return (SDP_INVALID_PARAMETER); |
| 2425 | } |
| 2426 | attr_p->attr.subnet.nettype = SDP_NT_UNSUPPORTED; |
| 2427 | for (i=0; i < SDP_MAX_NETWORK_TYPES; i++) { |
| 2428 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_nettype[i].name, |
| 2429 | sdp_nettype[i].strlen) == 0) { |
| 2430 | type_found = TRUE1; |
| 2431 | } |
| 2432 | if (type_found == TRUE1) { |
| 2433 | if (sdp_p->conf_p->nettype_supported[i] == TRUE1) { |
| 2434 | attr_p->attr.subnet.nettype = (sdp_nettype_e)i; |
| 2435 | } |
| 2436 | type_found = FALSE0; |
| 2437 | } |
| 2438 | } |
| 2439 | if (attr_p->attr.subnet.nettype == SDP_NT_UNSUPPORTED) { |
| 2440 | sdp_parse_error(sdp_p, |
| 2441 | "%s Warning: Subnet network type unsupported (%s).", |
| 2442 | sdp_p->debug_str, tmp); |
| 2443 | sdp_p->conf_p->num_invalid_param++; |
| 2444 | return (SDP_INVALID_PARAMETER); |
| 2445 | } |
| 2446 | |
| 2447 | /* Find the subnet address type. */ |
| 2448 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 2449 | if (result != SDP_SUCCESS) { |
| 2450 | sdp_parse_error(sdp_p, |
| 2451 | "%s Warning: No address type specified in subnet attribute.", |
| 2452 | sdp_p->debug_str); |
| 2453 | sdp_p->conf_p->num_invalid_param++; |
| 2454 | return (SDP_INVALID_PARAMETER); |
| 2455 | } |
| 2456 | attr_p->attr.subnet.addrtype = SDP_AT_UNSUPPORTED; |
| 2457 | for (i=0; i < SDP_MAX_ADDR_TYPES; i++) { |
| 2458 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_addrtype[i].name, |
| 2459 | sdp_addrtype[i].strlen) == 0) { |
| 2460 | type_found = TRUE1; |
| 2461 | } |
| 2462 | if (type_found == TRUE1) { |
| 2463 | if (sdp_p->conf_p->addrtype_supported[i] == TRUE1) { |
| 2464 | attr_p->attr.subnet.addrtype = (sdp_addrtype_e)i; |
| 2465 | } |
| 2466 | type_found = FALSE0; |
| 2467 | } |
| 2468 | } |
| 2469 | if (attr_p->attr.subnet.addrtype == SDP_AT_UNSUPPORTED) { |
| 2470 | sdp_parse_error(sdp_p, |
| 2471 | "%s Warning: Subnet address type unsupported (%s).", |
| 2472 | sdp_p->debug_str, tmp); |
| 2473 | sdp_p->conf_p->num_invalid_param++; |
| 2474 | return (SDP_INVALID_PARAMETER); |
| 2475 | } |
| 2476 | |
| 2477 | /* Find the subnet address. */ |
| 2478 | ptr = sdp_getnextstrtok(ptr, attr_p->attr.subnet.addr, |
| 2479 | sizeof(attr_p->attr.subnet.addr), " \t", &result); |
| 2480 | if (result != SDP_SUCCESS) { |
| 2481 | sdp_parse_error(sdp_p, |
| 2482 | "%s Warning: No subnet address specified in " |
| 2483 | "subnet attribute.", sdp_p->debug_str); |
| 2484 | sdp_p->conf_p->num_invalid_param++; |
| 2485 | return (SDP_INVALID_PARAMETER); |
| 2486 | } |
| 2487 | slash_ptr = sdp_findchar(attr_p->attr.subnet.addr, "/"); |
| 2488 | if (*slash_ptr == '/') { |
| 2489 | *slash_ptr++ = '\0'; |
| 2490 | /* If the '/' exists, expect a valid prefix to follow. */ |
| 2491 | attr_p->attr.subnet.prefix = sdp_getnextnumtok(slash_ptr, |
| 2492 | (const char **)&slash_ptr, |
| 2493 | " \t", &result); |
| 2494 | if (result != SDP_SUCCESS) { |
| 2495 | sdp_parse_error(sdp_p, |
| 2496 | "%s Warning: Invalid subnet prefix specified in " |
| 2497 | "subnet attribute.", sdp_p->debug_str); |
| 2498 | sdp_p->conf_p->num_invalid_param++; |
| 2499 | return (SDP_INVALID_PARAMETER); |
| 2500 | } |
| 2501 | } else { |
| 2502 | attr_p->attr.subnet.prefix = SDP_INVALID_VALUE(-2); |
| 2503 | } |
| 2504 | |
| 2505 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 2506 | SDP_PRINT("%s Parsed a=%s, network %s, addr type %s, address %s ",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2510, "sdp", "%s Parsed a=%s, network %s, addr type %s, address %s " , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_network_name (attr_p->attr.subnet.nettype), sdp_get_address_name(attr_p ->attr.subnet.addrtype), attr_p->attr.subnet.addr) |
| 2507 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2510, "sdp", "%s Parsed a=%s, network %s, addr type %s, address %s " , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_network_name (attr_p->attr.subnet.nettype), sdp_get_address_name(attr_p ->attr.subnet.addrtype), attr_p->attr.subnet.addr) |
| 2508 | sdp_get_network_name(attr_p->attr.subnet.nettype),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2510, "sdp", "%s Parsed a=%s, network %s, addr type %s, address %s " , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_network_name (attr_p->attr.subnet.nettype), sdp_get_address_name(attr_p ->attr.subnet.addrtype), attr_p->attr.subnet.addr) |
| 2509 | sdp_get_address_name(attr_p->attr.subnet.addrtype),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2510, "sdp", "%s Parsed a=%s, network %s, addr type %s, address %s " , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_network_name (attr_p->attr.subnet.nettype), sdp_get_address_name(attr_p ->attr.subnet.addrtype), attr_p->attr.subnet.addr) |
| 2510 | attr_p->attr.subnet.addr)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2510, "sdp", "%s Parsed a=%s, network %s, addr type %s, address %s " , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_network_name (attr_p->attr.subnet.nettype), sdp_get_address_name(attr_p ->attr.subnet.addrtype), attr_p->attr.subnet.addr); |
| 2511 | if (attr_p->attr.subnet.prefix != SDP_INVALID_VALUE(-2)) { |
| 2512 | SDP_PRINT("/%u", (ushort)attr_p->attr.subnet.prefix)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2512, "sdp", "/%u", (ushort)attr_p->attr.subnet.prefix); |
| 2513 | } |
| 2514 | } |
| 2515 | |
| 2516 | return (SDP_SUCCESS); |
| 2517 | } |
| 2518 | |
| 2519 | sdp_result_e sdp_build_attr_subnet (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 2520 | flex_string *fs) |
| 2521 | { |
| 2522 | if (attr_p->attr.subnet.prefix == SDP_INVALID_VALUE(-2)) { |
| 2523 | flex_string_sprintf(fs, "a=%s:%s %s %s\r\n", |
| 2524 | sdp_attr[attr_p->type].name, |
| 2525 | sdp_get_network_name(attr_p->attr.subnet.nettype), |
| 2526 | sdp_get_address_name(attr_p->attr.subnet.addrtype), |
| 2527 | attr_p->attr.subnet.addr); |
| 2528 | } else { |
| 2529 | flex_string_sprintf(fs, "a=%s:%s %s %s/%u\r\n", |
| 2530 | sdp_attr[attr_p->type].name, |
| 2531 | sdp_get_network_name(attr_p->attr.subnet.nettype), |
| 2532 | sdp_get_address_name(attr_p->attr.subnet.addrtype), |
| 2533 | attr_p->attr.subnet.addr, |
| 2534 | (ushort)attr_p->attr.subnet.prefix); |
| 2535 | } |
| 2536 | |
| 2537 | return SDP_SUCCESS; |
| 2538 | } |
| 2539 | |
| 2540 | sdp_result_e sdp_parse_attr_t38_ratemgmt (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 2541 | const char *ptr) |
| 2542 | { |
| 2543 | int i; |
| 2544 | sdp_result_e result; |
| 2545 | char tmp[SDP_MAX_STRING_LEN256]; |
| 2546 | |
| 2547 | /* Find the rate mgmt. */ |
| 2548 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 2549 | if (result != SDP_SUCCESS) { |
| 2550 | sdp_parse_error(sdp_p, |
| 2551 | "%s Warning: No t38 rate management specified.", |
| 2552 | sdp_p->debug_str); |
| 2553 | sdp_p->conf_p->num_invalid_param++; |
| 2554 | return (SDP_INVALID_PARAMETER); |
| 2555 | } |
| 2556 | attr_p->attr.t38ratemgmt = SDP_T38_UNKNOWN_RATE; |
| 2557 | for (i=0; i < SDP_T38_MAX_RATES; i++) { |
| 2558 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_t38_rate[i].name, |
| 2559 | sdp_t38_rate[i].strlen) == 0) { |
| 2560 | attr_p->attr.t38ratemgmt = (sdp_t38_ratemgmt_e)i; |
| 2561 | } |
| 2562 | } |
| 2563 | |
| 2564 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 2565 | SDP_PRINT("%s Parsed a=%s, rate %s", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2567, "sdp", "%s Parsed a=%s, rate %s", sdp_p->debug_str , sdp_get_attr_name(attr_p->type), sdp_get_t38_ratemgmt_name (attr_p->attr.t38ratemgmt)) |
| 2566 | sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2567, "sdp", "%s Parsed a=%s, rate %s", sdp_p->debug_str , sdp_get_attr_name(attr_p->type), sdp_get_t38_ratemgmt_name (attr_p->attr.t38ratemgmt)) |
| 2567 | sdp_get_t38_ratemgmt_name(attr_p->attr.t38ratemgmt))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2567, "sdp", "%s Parsed a=%s, rate %s", sdp_p->debug_str , sdp_get_attr_name(attr_p->type), sdp_get_t38_ratemgmt_name (attr_p->attr.t38ratemgmt)); |
| 2568 | } |
| 2569 | |
| 2570 | return (SDP_SUCCESS); |
| 2571 | } |
| 2572 | |
| 2573 | sdp_result_e sdp_build_attr_t38_ratemgmt (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 2574 | flex_string *fs) |
| 2575 | { |
| 2576 | flex_string_sprintf(fs, "a=%s:%s\r\n", |
| 2577 | sdp_attr[attr_p->type].name, |
| 2578 | sdp_get_t38_ratemgmt_name(attr_p->attr.t38ratemgmt)); |
| 2579 | |
| 2580 | return SDP_SUCCESS; |
| 2581 | } |
| 2582 | |
| 2583 | sdp_result_e sdp_parse_attr_t38_udpec (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 2584 | const char *ptr) |
| 2585 | { |
| 2586 | int i; |
| 2587 | sdp_result_e result; |
| 2588 | char tmp[SDP_MAX_STRING_LEN256]; |
| 2589 | |
| 2590 | /* Find the udpec. */ |
| 2591 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 2592 | if (result != SDP_SUCCESS) { |
| 2593 | sdp_parse_error(sdp_p, |
| 2594 | "%s Warning: No t38 udpEC specified.", |
| 2595 | sdp_p->debug_str); |
| 2596 | sdp_p->conf_p->num_invalid_param++; |
| 2597 | return (SDP_INVALID_PARAMETER); |
| 2598 | } |
| 2599 | attr_p->attr.t38udpec = SDP_T38_UDPEC_UNKNOWN; |
| 2600 | for (i=0; i < SDP_T38_MAX_UDPEC; i++) { |
| 2601 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_t38_udpec[i].name, |
| 2602 | sdp_t38_udpec[i].strlen) == 0) { |
| 2603 | attr_p->attr.t38udpec = (sdp_t38_udpec_e)i; |
| 2604 | } |
| 2605 | } |
| 2606 | |
| 2607 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 2608 | SDP_PRINT("%s Parsed a=%s, udpec %s", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2610, "sdp", "%s Parsed a=%s, udpec %s", sdp_p->debug_str , sdp_get_attr_name(attr_p->type), sdp_get_t38_udpec_name( attr_p->attr.t38udpec)) |
| 2609 | sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2610, "sdp", "%s Parsed a=%s, udpec %s", sdp_p->debug_str , sdp_get_attr_name(attr_p->type), sdp_get_t38_udpec_name( attr_p->attr.t38udpec)) |
| 2610 | sdp_get_t38_udpec_name(attr_p->attr.t38udpec))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2610, "sdp", "%s Parsed a=%s, udpec %s", sdp_p->debug_str , sdp_get_attr_name(attr_p->type), sdp_get_t38_udpec_name( attr_p->attr.t38udpec)); |
| 2611 | } |
| 2612 | |
| 2613 | return (SDP_SUCCESS); |
| 2614 | } |
| 2615 | |
| 2616 | sdp_result_e sdp_build_attr_t38_udpec (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 2617 | flex_string *fs) |
| 2618 | { |
| 2619 | flex_string_sprintf(fs, "a=%s:%s\r\n", |
| 2620 | sdp_attr[attr_p->type].name, |
| 2621 | sdp_get_t38_udpec_name(attr_p->attr.t38udpec)); |
| 2622 | |
| 2623 | return SDP_SUCCESS; |
| 2624 | } |
| 2625 | |
| 2626 | sdp_result_e sdp_parse_attr_pc_codec (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 2627 | const char *ptr) |
| 2628 | { |
| 2629 | uint16_t i; |
| 2630 | sdp_result_e result; |
| 2631 | |
| 2632 | for (i=0; i < SDP_MAX_PAYLOAD_TYPES30; i++) { |
| 2633 | attr_p->attr.pccodec.payload_type[i] = (ushort)sdp_getnextnumtok(ptr, &ptr, |
| 2634 | " \t", &result); |
| 2635 | if (result != SDP_SUCCESS) { |
| 2636 | break; |
| 2637 | } |
| 2638 | attr_p->attr.pccodec.num_payloads++; |
| 2639 | } |
| 2640 | |
| 2641 | if (attr_p->attr.pccodec.num_payloads == 0) { |
| 2642 | sdp_parse_error(sdp_p, |
| 2643 | "%s Warning: No payloads specified for %s attr.", |
| 2644 | sdp_p->debug_str, sdp_attr[attr_p->type].name); |
| 2645 | sdp_p->conf_p->num_invalid_param++; |
| 2646 | return (SDP_INVALID_PARAMETER); |
| 2647 | } |
| 2648 | |
| 2649 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 2650 | SDP_PRINT("%s Parsed a=%s, num payloads %u, payloads: ",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2652, "sdp", "%s Parsed a=%s, num payloads %u, payloads: ", sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.pccodec.num_payloads) |
| 2651 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2652, "sdp", "%s Parsed a=%s, num payloads %u, payloads: ", sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.pccodec.num_payloads) |
| 2652 | attr_p->attr.pccodec.num_payloads)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2652, "sdp", "%s Parsed a=%s, num payloads %u, payloads: ", sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.pccodec.num_payloads); |
| 2653 | for (i=0; i < attr_p->attr.pccodec.num_payloads; i++) { |
| 2654 | SDP_PRINT("%u ", attr_p->attr.pccodec.payload_type[i])SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2654, "sdp", "%u ", attr_p->attr.pccodec.payload_type[i] ); |
| 2655 | } |
| 2656 | } |
| 2657 | |
| 2658 | return (SDP_SUCCESS); |
| 2659 | } |
| 2660 | |
| 2661 | sdp_result_e sdp_build_attr_pc_codec (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 2662 | flex_string *fs) |
| 2663 | { |
| 2664 | int i; |
| 2665 | |
| 2666 | flex_string_sprintf(fs, "a=%s: ", sdp_attr[attr_p->type].name); |
| 2667 | |
| 2668 | for (i=0; i < attr_p->attr.pccodec.num_payloads; i++) { |
| 2669 | flex_string_sprintf(fs, "%u ", attr_p->attr.pccodec.payload_type[i]); |
| 2670 | } |
| 2671 | |
| 2672 | flex_string_append(fs, "\r\n"); |
| 2673 | |
| 2674 | return SDP_SUCCESS; |
| 2675 | } |
| 2676 | |
| 2677 | |
| 2678 | sdp_result_e sdp_parse_attr_cap (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 2679 | const char *ptr) |
| 2680 | { |
| 2681 | uint16_t i; |
| 2682 | sdp_result_e result; |
| 2683 | sdp_mca_t *cap_p; |
| 2684 | char tmp[SDP_MAX_STRING_LEN256]; |
| 2685 | |
| 2686 | /* Set the capability pointer to NULL for now in case we encounter |
| 2687 | * an error in parsing. |
| 2688 | */ |
| 2689 | attr_p->attr.cap_p = NULL((void*)0); |
| 2690 | /* Set the capability valid flag to FALSE in case we encounter an |
| 2691 | * error. If we do, we don't want to process any X-cpar/cpar attributes |
| 2692 | * from this point until we process the next valid X-cap/cdsc attr. */ |
| 2693 | sdp_p->cap_valid = FALSE0; |
| 2694 | |
| 2695 | /* Allocate resource for new capability. Note that the capability |
| 2696 | * uses the same structure used for media lines. |
| 2697 | */ |
| 2698 | cap_p = sdp_alloc_mca(sdp_p->parse_line); |
| 2699 | if (cap_p == NULL((void*)0)) { |
| 2700 | sdp_p->conf_p->num_no_resource++; |
| 2701 | return (SDP_NO_RESOURCE); |
| 2702 | } |
| 2703 | |
| 2704 | /* Find the capability number. We don't need to store this since we |
| 2705 | * calculate it for ourselves as we need to. But it must be specified. */ |
| 2706 | (void)sdp_getnextnumtok(ptr, &ptr, "/ \t", &result); |
| 2707 | if (result != SDP_SUCCESS) { |
| 2708 | sdp_parse_error(sdp_p, |
| 2709 | "%s Warning: Capability not specified for %s, " |
| 2710 | "unable to parse.", sdp_p->debug_str, |
| 2711 | sdp_get_attr_name(attr_p->type)); |
| 2712 | SDP_FREEfree(cap_p); |
| 2713 | sdp_p->conf_p->num_invalid_param++; |
| 2714 | return (SDP_INVALID_PARAMETER); |
| 2715 | } |
| 2716 | |
| 2717 | /* Find the media type. */ |
| 2718 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 2719 | if (result != SDP_SUCCESS) { |
| 2720 | sdp_parse_error(sdp_p, |
| 2721 | "%s No media type specified for %s attribute, " |
| 2722 | "unable to parse.", |
| 2723 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type)); |
| 2724 | SDP_FREEfree(cap_p); |
| 2725 | sdp_p->conf_p->num_invalid_param++; |
| 2726 | return (SDP_INVALID_PARAMETER); |
| 2727 | } |
| 2728 | cap_p->media = SDP_MEDIA_UNSUPPORTED; |
| 2729 | for (i=0; i < SDP_MAX_MEDIA_TYPES; i++) { |
| 2730 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_media[i].name, sdp_media[i].strlen) == 0) { |
| 2731 | cap_p->media = (sdp_media_e)i; |
| 2732 | break; |
| 2733 | } |
| 2734 | } |
| 2735 | if (cap_p->media == SDP_MEDIA_UNSUPPORTED) { |
| 2736 | sdp_parse_error(sdp_p, |
| 2737 | "%s Warning: Media type unsupported (%s).", |
| 2738 | sdp_p->debug_str, tmp); |
| 2739 | SDP_FREEfree(cap_p); |
| 2740 | sdp_p->conf_p->num_invalid_param++; |
| 2741 | return (SDP_INVALID_PARAMETER); |
| 2742 | } |
| 2743 | |
| 2744 | /* Find the transport protocol type. */ |
| 2745 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 2746 | if (result != SDP_SUCCESS) { |
| 2747 | sdp_parse_error(sdp_p, |
| 2748 | "%s No transport protocol type specified, " |
| 2749 | "unable to parse.", sdp_p->debug_str); |
| 2750 | SDP_FREEfree(cap_p); |
| 2751 | sdp_p->conf_p->num_invalid_param++; |
| 2752 | return (SDP_INVALID_PARAMETER); |
| 2753 | } |
| 2754 | cap_p->transport = SDP_TRANSPORT_UNSUPPORTED; |
| 2755 | for (i=0; i < SDP_MAX_TRANSPORT_TYPES; i++) { |
| 2756 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_transport[i].name, |
| 2757 | sdp_transport[i].strlen) == 0) { |
| 2758 | cap_p->transport = (sdp_transport_e)i; |
| 2759 | break; |
| 2760 | } |
| 2761 | } |
| 2762 | if (cap_p->transport == SDP_TRANSPORT_UNSUPPORTED) { |
| 2763 | sdp_parse_error(sdp_p, |
| 2764 | "%s Warning: Transport protocol type unsupported (%s).", |
| 2765 | sdp_p->debug_str, tmp); |
| 2766 | SDP_FREEfree(cap_p); |
| 2767 | sdp_p->conf_p->num_invalid_param++; |
| 2768 | return (SDP_INVALID_PARAMETER); |
| 2769 | } |
| 2770 | |
| 2771 | /* Find payload formats. AAL2 X-cap lines allow multiple |
| 2772 | * transport/profile types per line, so these are handled differently. |
| 2773 | */ |
| 2774 | if ((cap_p->transport == SDP_TRANSPORT_AAL2_ITU) || |
| 2775 | (cap_p->transport == SDP_TRANSPORT_AAL2_ATMF) || |
| 2776 | (cap_p->transport == SDP_TRANSPORT_AAL2_CUSTOM)) { |
| 2777 | /* Capability processing is not currently defined for AAL2 types |
| 2778 | * with multiple profiles. We don't process. */ |
| 2779 | sdp_parse_error(sdp_p, |
| 2780 | "%s Warning: AAL2 profiles unsupported with " |
| 2781 | "%s attributes.", sdp_p->debug_str, |
| 2782 | sdp_get_attr_name(attr_p->type)); |
| 2783 | SDP_FREEfree(cap_p); |
| 2784 | sdp_p->conf_p->num_invalid_param++; |
| 2785 | return (SDP_INVALID_PARAMETER); |
| 2786 | } else { |
| 2787 | /* Transport is a non-AAL2 type. Parse payloads normally. */ |
| 2788 | sdp_parse_payload_types(sdp_p, cap_p, ptr); |
| 2789 | if (cap_p->num_payloads == 0) { |
| 2790 | SDP_FREEfree(cap_p); |
| 2791 | sdp_p->conf_p->num_invalid_param++; |
| 2792 | return (SDP_INVALID_PARAMETER); |
| 2793 | } |
| 2794 | } |
| 2795 | |
| 2796 | attr_p->attr.cap_p = cap_p; |
| 2797 | /* |
| 2798 | * This capability attr is valid. We can now handle X-cpar or |
| 2799 | * cpar attrs. |
| 2800 | */ |
| 2801 | sdp_p->cap_valid = TRUE1; |
| 2802 | sdp_p->last_cap_inst++; |
| 2803 | |
| 2804 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 2805 | SDP_PRINT("%s Parsed %s media type %s, Transport %s, "SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2810, "sdp", "%s Parsed %s media type %s, Transport %s, " "Num payloads %u" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_media_name (cap_p->media), sdp_get_transport_name(cap_p->transport ), cap_p->num_payloads) |
| 2806 | "Num payloads %u", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2810, "sdp", "%s Parsed %s media type %s, Transport %s, " "Num payloads %u" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_media_name (cap_p->media), sdp_get_transport_name(cap_p->transport ), cap_p->num_payloads) |
| 2807 | sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2810, "sdp", "%s Parsed %s media type %s, Transport %s, " "Num payloads %u" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_media_name (cap_p->media), sdp_get_transport_name(cap_p->transport ), cap_p->num_payloads) |
| 2808 | sdp_get_media_name(cap_p->media),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2810, "sdp", "%s Parsed %s media type %s, Transport %s, " "Num payloads %u" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_media_name (cap_p->media), sdp_get_transport_name(cap_p->transport ), cap_p->num_payloads) |
| 2809 | sdp_get_transport_name(cap_p->transport),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2810, "sdp", "%s Parsed %s media type %s, Transport %s, " "Num payloads %u" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_media_name (cap_p->media), sdp_get_transport_name(cap_p->transport ), cap_p->num_payloads) |
| 2810 | cap_p->num_payloads)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2810, "sdp", "%s Parsed %s media type %s, Transport %s, " "Num payloads %u" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), sdp_get_media_name (cap_p->media), sdp_get_transport_name(cap_p->transport ), cap_p->num_payloads); |
| 2811 | } |
| 2812 | return (SDP_SUCCESS); |
| 2813 | } |
| 2814 | |
| 2815 | sdp_result_e sdp_build_attr_cap (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 2816 | flex_string *fs) |
| 2817 | { |
| 2818 | uint16_t i, j; |
| 2819 | sdp_mca_t *cap_p; |
| 2820 | sdp_media_profiles_t *profile_p; |
| 2821 | |
| 2822 | /* Get a pointer to the capability structure. */ |
| 2823 | cap_p = attr_p->attr.cap_p; |
| 2824 | |
| 2825 | if (cap_p == NULL((void*)0)) { |
| 2826 | SDPLogError(logTag, "%s Invalid %s attribute, unable to build.",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2827, logTag, "%s Invalid %s attribute, unable to build.", sdp_p ->debug_str, sdp_get_attr_name(attr_p->type)) |
| 2827 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2827, logTag, "%s Invalid %s attribute, unable to build.", sdp_p ->debug_str, sdp_get_attr_name(attr_p->type)); |
| 2828 | sdp_p->conf_p->num_invalid_param++; |
| 2829 | /* Return success so build won't fail. */ |
| 2830 | return (SDP_SUCCESS); |
| 2831 | } |
| 2832 | |
| 2833 | /* Validate params for this capability line */ |
| 2834 | if ((cap_p->media >= SDP_MAX_MEDIA_TYPES) || |
| 2835 | (cap_p->transport >= SDP_MAX_TRANSPORT_TYPES)) { |
| 2836 | SDPLogDebug(logTag, logTag, "%s Media or transport type invalid for %s "SDPLog(SDP_LOG_DEBUG, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2838, logTag, logTag, "%s Media or transport type invalid for %s " "attribute, unable to build.", sdp_p->debug_str, sdp_get_attr_name (attr_p->type)) |
| 2837 | "attribute, unable to build.", sdp_p->debug_str,SDPLog(SDP_LOG_DEBUG, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2838, logTag, logTag, "%s Media or transport type invalid for %s " "attribute, unable to build.", sdp_p->debug_str, sdp_get_attr_name (attr_p->type)) |
| 2838 | sdp_get_attr_name(attr_p->type))SDPLog(SDP_LOG_DEBUG, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2838, logTag, logTag, "%s Media or transport type invalid for %s " "attribute, unable to build.", sdp_p->debug_str, sdp_get_attr_name (attr_p->type)); |
| 2839 | sdp_p->conf_p->num_invalid_param++; |
| 2840 | /* Return success so build won't fail. */ |
| 2841 | return (SDP_SUCCESS); |
| 2842 | } |
| 2843 | |
| 2844 | flex_string_sprintf(fs, "a=%s: %u %s ", sdp_attr[attr_p->type].name, |
| 2845 | sdp_p->cur_cap_num, sdp_get_media_name(cap_p->media)); |
| 2846 | |
| 2847 | /* If the X-cap line has AAL2 profiles, build them differently. */ |
| 2848 | if ((cap_p->transport == SDP_TRANSPORT_AAL2_ITU) || |
| 2849 | (cap_p->transport == SDP_TRANSPORT_AAL2_ATMF) || |
| 2850 | (cap_p->transport == SDP_TRANSPORT_AAL2_CUSTOM)) { |
| 2851 | profile_p = cap_p->media_profiles_p; |
| 2852 | for (i=0; i < profile_p->num_profiles; i++) { |
| 2853 | flex_string_sprintf(fs, "%s", |
| 2854 | sdp_get_transport_name(profile_p->profile[i])); |
| 2855 | |
| 2856 | for (j=0; j < profile_p->num_payloads[i]; j++) { |
| 2857 | flex_string_sprintf(fs, " %u", |
| 2858 | profile_p->payload_type[i][j]); |
| 2859 | } |
| 2860 | flex_string_append(fs, " "); |
| 2861 | } |
| 2862 | |
| 2863 | flex_string_append(fs, "\r\n"); |
| 2864 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 2865 | SDP_PRINT("%s Built m= media line", sdp_p->debug_str)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 2865, "sdp", "%s Built m= media line", sdp_p->debug_str); |
| 2866 | } |
| 2867 | return SDP_SUCCESS; |
| 2868 | } |
| 2869 | |
| 2870 | /* Build the transport name */ |
| 2871 | flex_string_sprintf(fs, "%s", sdp_get_transport_name(cap_p->transport)); |
| 2872 | |
| 2873 | /* Build the format lists */ |
| 2874 | for (i=0; i < cap_p->num_payloads; i++) { |
| 2875 | if (cap_p->payload_indicator[i] == SDP_PAYLOAD_ENUM) { |
| 2876 | flex_string_sprintf(fs, " %s", |
| 2877 | sdp_get_payload_name((sdp_payload_e)cap_p->payload_type[i])); |
| 2878 | } else { |
| 2879 | flex_string_sprintf(fs, " %u", cap_p->payload_type[i]); |
| 2880 | } |
| 2881 | } |
| 2882 | |
| 2883 | flex_string_append(fs, "\r\n"); |
| 2884 | |
| 2885 | /* Increment the current capability number for the next X-cap/cdsc attr. */ |
| 2886 | sdp_p->cur_cap_num += cap_p->num_payloads; |
| 2887 | sdp_p->last_cap_type = attr_p->type; |
| 2888 | |
| 2889 | /* Build any X-cpar/cpar attributes associated with this X-cap/cdsc line. */ |
| 2890 | return sdp_build_attr_cpar(sdp_p, cap_p->media_attrs_p, fs); |
| 2891 | } |
| 2892 | |
| 2893 | |
| 2894 | sdp_result_e sdp_parse_attr_cpar (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 2895 | const char *ptr) |
| 2896 | { |
| 2897 | uint16_t i; |
| 2898 | sdp_result_e result; |
| 2899 | sdp_mca_t *cap_p; |
| 2900 | sdp_attr_t *cap_attr_p = NULL((void*)0); |
| 2901 | sdp_attr_t *prev_attr_p; |
| 2902 | char tmp[SDP_MAX_STRING_LEN256] = {0}; |
| 2903 | |
| 2904 | /* Make sure we've processed a valid X-cap/cdsc attr prior to this and |
| 2905 | * if so, get the cap pointer. */ |
| 2906 | if (sdp_p->cap_valid == TRUE1) { |
| 2907 | sdp_attr_e cap_type; |
| 2908 | |
| 2909 | if (attr_p->type == SDP_ATTR_CPAR) { |
| 2910 | cap_type = SDP_ATTR_CDSC; |
| 2911 | } else { |
| 2912 | /* Default to X-CAP for everything else */ |
| 2913 | cap_type = SDP_ATTR_X_CAP; |
| 2914 | } |
| 2915 | |
| 2916 | if (sdp_p->mca_count == 0) { |
| 2917 | cap_attr_p = sdp_find_attr(sdp_p, SDP_SESSION_LEVEL0xFFFF, 0, |
| 2918 | cap_type, sdp_p->last_cap_inst); |
| 2919 | } else { |
| 2920 | cap_attr_p = sdp_find_attr(sdp_p, sdp_p->mca_count, 0, |
| 2921 | cap_type, sdp_p->last_cap_inst); |
| 2922 | } |
| 2923 | } |
| 2924 | if ((cap_attr_p == NULL((void*)0)) || (cap_attr_p->attr.cap_p == NULL((void*)0))) { |
| 2925 | sdp_parse_error(sdp_p, |
| 2926 | "%s Warning: %s attribute specified with no " |
| 2927 | "prior %s attribute", sdp_p->debug_str, |
| 2928 | sdp_get_attr_name(attr_p->type), |
| 2929 | (attr_p->type == SDP_ATTR_CPAR)? |
| 2930 | (sdp_get_attr_name(SDP_ATTR_CDSC)) : |
| 2931 | (sdp_get_attr_name(SDP_ATTR_X_CAP)) ); |
| 2932 | sdp_p->conf_p->num_invalid_param++; |
| 2933 | return (SDP_INVALID_PARAMETER); |
| 2934 | } |
| 2935 | |
| 2936 | /* |
| 2937 | * Ensure there is no mixed syntax like CDSC followed by X-CPAR |
| 2938 | * or X-CAP followed by CPAR. |
| 2939 | */ |
| 2940 | if (((cap_attr_p->type == SDP_ATTR_CDSC) && |
| 2941 | (attr_p->type == SDP_ATTR_X_CPAR)) || |
| 2942 | ( (cap_attr_p->type == SDP_ATTR_X_CAP) && |
| 2943 | (attr_p->type == SDP_ATTR_CPAR)) ) { |
| 2944 | sdp_parse_error(sdp_p, |
| 2945 | "%s Warning: %s attribute inconsistent with " |
| 2946 | "prior %s attribute", sdp_p->debug_str, |
| 2947 | sdp_get_attr_name(attr_p->type), |
| 2948 | sdp_get_attr_name(cap_attr_p->type)); |
| 2949 | sdp_p->conf_p->num_invalid_param++; |
| 2950 | return (SDP_INVALID_PARAMETER); |
| 2951 | } |
| 2952 | cap_p = cap_attr_p->attr.cap_p; |
| 2953 | |
| 2954 | /* a= is the only token we handle in an X-cpar/cpar attribute. */ |
| 2955 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), "= \t", &result); |
| 2956 | |
| 2957 | if ((result != SDP_SUCCESS) || (tmp[0] != 'a') || (tmp[1] != '\0')) { |
| 2958 | sdp_parse_error(sdp_p, |
| 2959 | "%s Warning: Invalid token type in %s " |
| 2960 | "attribute, unable to parse", sdp_p->debug_str, |
| 2961 | sdp_get_attr_name(attr_p->type)); |
| 2962 | sdp_p->conf_p->num_invalid_param++; |
| 2963 | return (SDP_INVALID_PARAMETER); |
| 2964 | } |
| 2965 | /*sa_ignore NO_NULL_CHK |
| 2966 | *{ptr is valid since the pointer was checked earlier and the |
| 2967 | * function would have exited if NULL.} |
| 2968 | */ |
| 2969 | if (*ptr == '=') { |
| 2970 | ptr++; |
| 2971 | } |
| 2972 | |
| 2973 | /* Find the attribute type. */ |
| 2974 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), ": \t", &result); |
| 2975 | /*sa_ignore NO_NULL_CHK |
| 2976 | *{ptr is valid since the pointer was checked earlier and the |
| 2977 | * function would have exited if NULL.} |
| 2978 | */ |
| 2979 | if (ptr[0] == ':') { |
| 2980 | /* Skip the ':' char for parsing attribute parameters. */ |
| 2981 | ptr++; |
| 2982 | } |
| 2983 | if (result != SDP_SUCCESS) { |
| 2984 | sdp_parse_error(sdp_p, |
| 2985 | "%s No attribute type specified for %s attribute, unable to parse.", |
| 2986 | sdp_p->debug_str, |
| 2987 | sdp_get_attr_name(attr_p->type)); |
| 2988 | sdp_p->conf_p->num_invalid_param++; |
| 2989 | return (SDP_INVALID_PARAMETER); |
| 2990 | } |
| 2991 | |
| 2992 | /* Reset the type of the attribute from X-cpar/cpar to whatever the |
| 2993 | * specified type is. */ |
| 2994 | attr_p->type = SDP_ATTR_INVALID; |
| 2995 | attr_p->next_p = NULL((void*)0); |
| 2996 | for (i=0; i < SDP_MAX_ATTR_TYPES; i++) { |
| 2997 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_attr[i].name, sdp_attr[i].strlen) == 0) { |
| 2998 | attr_p->type = (sdp_attr_e)i; |
| 2999 | } |
| 3000 | } |
| 3001 | if (attr_p->type == SDP_ATTR_INVALID) { |
| 3002 | sdp_parse_error(sdp_p, |
| 3003 | "%s Warning: Unrecognized attribute (%s) for %s attribute, unable to parse.", |
| 3004 | sdp_p->debug_str, tmp, |
| 3005 | sdp_get_attr_name(attr_p->type)); |
| 3006 | sdp_p->conf_p->num_invalid_param++; |
| 3007 | return (SDP_INVALID_PARAMETER); |
| 3008 | } |
| 3009 | |
| 3010 | /* We don't allow recursion with the capability attributes. */ |
| 3011 | if ((attr_p->type == SDP_ATTR_X_SQN) || |
| 3012 | (attr_p->type == SDP_ATTR_X_CAP) || |
| 3013 | (attr_p->type == SDP_ATTR_X_CPAR) || |
| 3014 | (attr_p->type == SDP_ATTR_SQN) || |
| 3015 | (attr_p->type == SDP_ATTR_CDSC) || |
| 3016 | (attr_p->type == SDP_ATTR_CPAR)) { |
| 3017 | sdp_parse_error(sdp_p, |
| 3018 | "%s Warning: Invalid attribute (%s) for %s" |
| 3019 | " attribute, unable to parse.", sdp_p->debug_str, tmp, |
| 3020 | sdp_get_attr_name(attr_p->type)); |
| 3021 | sdp_p->conf_p->num_invalid_param++; |
| 3022 | return (SDP_INVALID_PARAMETER); |
| 3023 | } |
| 3024 | |
| 3025 | /* Parse the attribute. */ |
| 3026 | result = sdp_attr[attr_p->type].parse_func(sdp_p, attr_p, ptr); |
| 3027 | if (result != SDP_SUCCESS) { |
| 3028 | return (result); |
| 3029 | } |
| 3030 | |
| 3031 | /* Hook the attribute into the capability structure. */ |
| 3032 | if (cap_p->media_attrs_p == NULL((void*)0)) { |
| 3033 | cap_p->media_attrs_p = attr_p; |
| 3034 | } else { |
| 3035 | for (prev_attr_p = cap_p->media_attrs_p; |
| 3036 | prev_attr_p->next_p != NULL((void*)0); |
| 3037 | prev_attr_p = prev_attr_p->next_p) { |
| 3038 | ; /* Empty for */ |
| 3039 | } |
| 3040 | prev_attr_p->next_p = attr_p; |
| 3041 | } |
| 3042 | |
| 3043 | return (SDP_SUCCESS); |
| 3044 | } |
| 3045 | |
| 3046 | sdp_result_e sdp_build_attr_cpar (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 3047 | flex_string *fs) |
| 3048 | { |
| 3049 | sdp_result_e result; |
| 3050 | const char *cpar_name; |
| 3051 | |
| 3052 | /* Determine whether to use cpar or X-cpar */ |
| 3053 | if (sdp_p->last_cap_type == SDP_ATTR_CDSC) { |
| 3054 | cpar_name = sdp_get_attr_name(SDP_ATTR_CPAR); |
| 3055 | } else { |
| 3056 | /* |
| 3057 | * Default to X-CPAR if anything else. This is the backward |
| 3058 | * compatible value. |
| 3059 | */ |
| 3060 | cpar_name = sdp_get_attr_name(SDP_ATTR_X_CPAR); |
| 3061 | } |
| 3062 | |
| 3063 | while (attr_p != NULL((void*)0)) { |
| 3064 | if (attr_p->type >= SDP_MAX_ATTR_TYPES) { |
| 3065 | SDPLogDebug(logTag, "%s Invalid attribute type to build (%u)",SDPLog(SDP_LOG_DEBUG, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3066, logTag, "%s Invalid attribute type to build (%u)", sdp_p ->debug_str, (unsigned)attr_p->type) |
| 3066 | sdp_p->debug_str, (unsigned)attr_p->type)SDPLog(SDP_LOG_DEBUG, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3066, logTag, "%s Invalid attribute type to build (%u)", sdp_p ->debug_str, (unsigned)attr_p->type); |
| 3067 | } else { |
| 3068 | flex_string_sprintf(fs, "a=%s: ", cpar_name); |
| 3069 | |
| 3070 | result = sdp_attr[attr_p->type].build_func(sdp_p, attr_p, fs); |
| 3071 | |
| 3072 | if (result == SDP_SUCCESS) { |
| 3073 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 3074 | SDP_PRINT("%s Built %s a=%s attribute line",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3076, "sdp", "%s Built %s a=%s attribute line", sdp_p->debug_str , cpar_name, sdp_get_attr_name(attr_p->type)) |
| 3075 | sdp_p->debug_str, cpar_name,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3076, "sdp", "%s Built %s a=%s attribute line", sdp_p->debug_str , cpar_name, sdp_get_attr_name(attr_p->type)) |
| 3076 | sdp_get_attr_name(attr_p->type))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3076, "sdp", "%s Built %s a=%s attribute line", sdp_p->debug_str , cpar_name, sdp_get_attr_name(attr_p->type)); |
| 3077 | } |
| 3078 | } |
| 3079 | } |
| 3080 | attr_p = attr_p->next_p; |
| 3081 | } |
| 3082 | |
| 3083 | return (SDP_SUCCESS); |
| 3084 | } |
| 3085 | |
| 3086 | sdp_result_e sdp_parse_attr_rtcp (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 3087 | const char *ptr) |
| 3088 | { |
| 3089 | sdp_result_e result; |
| 3090 | char nettype[SDP_MAX_STRING_LEN256]; |
| 3091 | sdp_rtcp_t *rtcp_p = &(attr_p->attr.rtcp); |
| 3092 | int enum_raw; |
| 3093 | |
| 3094 | memset(rtcp_p, 0, sizeof(sdp_rtcp_t)); |
| 3095 | |
| 3096 | rtcp_p->port = (uint16_t)sdp_getnextnumtok(ptr, &ptr, " \t", &result); |
| 3097 | if (result != SDP_SUCCESS) { |
| 3098 | sdp_parse_error(sdp_p, |
| 3099 | "%s Warning: could not parse port for rtcp attribute", |
| 3100 | sdp_p->debug_str); |
| 3101 | sdp_p->conf_p->num_invalid_param++; |
| 3102 | |
| 3103 | return SDP_INVALID_PARAMETER; |
| 3104 | } |
| 3105 | |
| 3106 | /* The rest is optional, although it is all-or-nothing */ |
| 3107 | (void)sdp_getnextstrtok(ptr, nettype, sizeof(nettype), " \t", &result); |
| 3108 | if (result == SDP_EMPTY_TOKEN) { |
| 3109 | /* Nothing after the port */ |
| 3110 | return SDP_SUCCESS; |
| 3111 | } |
| 3112 | |
| 3113 | enum_raw = find_token_enum("Nettype", sdp_p, &ptr, sdp_nettype, |
| 3114 | SDP_MAX_NETWORK_TYPES, SDP_NT_UNSUPPORTED); |
| 3115 | if (enum_raw == -1) { |
| 3116 | return SDP_INVALID_PARAMETER; |
| 3117 | } |
| 3118 | rtcp_p->nettype = (sdp_nettype_e)enum_raw; |
| 3119 | |
| 3120 | enum_raw = find_token_enum("Addrtype", sdp_p, &ptr, sdp_addrtype, |
| 3121 | SDP_MAX_ADDR_TYPES, SDP_AT_UNSUPPORTED); |
| 3122 | if (enum_raw == -1) { |
| 3123 | return SDP_INVALID_PARAMETER; |
| 3124 | } |
| 3125 | rtcp_p->addrtype = (sdp_addrtype_e)enum_raw; |
| 3126 | |
| 3127 | ptr = sdp_getnextstrtok(ptr, rtcp_p->addr, sizeof(rtcp_p->addr), " \t", |
| 3128 | &result); |
| 3129 | if (result != SDP_SUCCESS) { |
| 3130 | sdp_parse_error(sdp_p, |
| 3131 | "%s Warning: could not parse addr for rtcp attribute", |
| 3132 | sdp_p->debug_str); |
| 3133 | sdp_p->conf_p->num_invalid_param++; |
| 3134 | |
| 3135 | return SDP_INVALID_PARAMETER; |
| 3136 | } |
| 3137 | |
| 3138 | return SDP_SUCCESS; |
| 3139 | } |
| 3140 | |
| 3141 | sdp_result_e sdp_build_attr_rtcp (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 3142 | flex_string *fs) |
| 3143 | { |
| 3144 | /* We should not be serializing SDP anyway, but we need this function until |
| 3145 | * Bug 1112737 is resolved. */ |
| 3146 | return SDP_FAILURE; |
| 3147 | } |
| 3148 | |
| 3149 | sdp_result_e sdp_parse_attr_rtr (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 3150 | const char *ptr) |
| 3151 | { |
| 3152 | sdp_result_e result; |
| 3153 | char tmp[SDP_MAX_STRING_LEN256]; |
| 3154 | |
| 3155 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 3156 | SDP_PRINT("%s Parsing a=%s", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3157, "sdp", "%s Parsing a=%s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type)) |
| 3157 | sdp_get_attr_name(attr_p->type))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3157, "sdp", "%s Parsing a=%s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type)); |
| 3158 | } |
| 3159 | /*Default confirm to FALSE. */ |
| 3160 | attr_p->attr.rtr.confirm = FALSE0; |
| 3161 | |
| 3162 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 3163 | if (result != SDP_SUCCESS){ // No confirm tag specified is not an error |
| 3164 | return (SDP_SUCCESS); |
| 3165 | } else { |
| 3166 | /* See if confirm was specified. Defaults to FALSE. */ |
| 3167 | if (cpr_strncasecmpstrncasecmp(tmp, "confirm", sizeof("confirm")) == 0) { |
| 3168 | attr_p->attr.rtr.confirm = TRUE1; |
| 3169 | } |
| 3170 | if (attr_p->attr.rtr.confirm == FALSE0) { |
| 3171 | sdp_parse_error(sdp_p, |
| 3172 | "%s Warning: RTR confirm parameter invalid (%s)", |
| 3173 | sdp_p->debug_str, tmp); |
| 3174 | sdp_p->conf_p->num_invalid_param++; |
| 3175 | return (SDP_INVALID_PARAMETER); |
| 3176 | } |
| 3177 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 3178 | SDP_PRINT("%s Parsed a=%s, %s", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3180, "sdp", "%s Parsed a=%s, %s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), tmp) |
| 3179 | sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3180, "sdp", "%s Parsed a=%s, %s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), tmp) |
| 3180 | tmp)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3180, "sdp", "%s Parsed a=%s, %s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), tmp); |
| 3181 | } |
| 3182 | return (SDP_SUCCESS); |
| 3183 | } |
| 3184 | } |
| 3185 | |
| 3186 | sdp_result_e sdp_build_attr_rtr (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 3187 | flex_string *fs) |
| 3188 | { |
| 3189 | flex_string_sprintf(fs, "a=%s%s\r\n", |
| 3190 | sdp_attr[attr_p->type].name, |
| 3191 | attr_p->attr.rtr.confirm ? ":confirm" : ""); |
| 3192 | |
| 3193 | return SDP_SUCCESS; |
| 3194 | } |
| 3195 | |
| 3196 | sdp_result_e sdp_parse_attr_comediadir (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 3197 | const char *ptr) |
| 3198 | { |
| 3199 | int i; |
| 3200 | sdp_result_e result; |
| 3201 | tinybool type_found = FALSE0; |
| 3202 | char tmp[SDP_MAX_STRING_LEN256]; |
| 3203 | |
| 3204 | attr_p->attr.comediadir.role = SDP_MEDIADIR_ROLE_PASSIVE; |
| 3205 | attr_p->attr.comediadir.conn_info_present = FALSE0; |
| 3206 | attr_p->attr.comediadir.conn_info.nettype = SDP_NT_INVALID; |
| 3207 | attr_p->attr.comediadir.src_port = 0; |
| 3208 | |
| 3209 | /* Find the media direction role. */ |
| 3210 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), ": \t", &result); |
| 3211 | |
| 3212 | if (result != SDP_SUCCESS) { |
| 3213 | sdp_parse_error(sdp_p, |
| 3214 | "%s Warning: No role parameter specified for " |
| 3215 | "comediadir attribute.", sdp_p->debug_str); |
| 3216 | sdp_p->conf_p->num_invalid_param++; |
| 3217 | return (SDP_INVALID_PARAMETER); |
| 3218 | } |
| 3219 | attr_p->attr.comediadir.role = SDP_MEDIADIR_ROLE_UNSUPPORTED; |
| 3220 | for (i=0; i < SDP_MAX_MEDIADIR_ROLES; i++) { |
| 3221 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_mediadir_role[i].name, |
| 3222 | sdp_mediadir_role[i].strlen) == 0) { |
| 3223 | type_found = TRUE1; |
| 3224 | attr_p->attr.comediadir.role = (sdp_mediadir_role_e)i; |
| 3225 | break; |
| 3226 | } |
| 3227 | } |
| 3228 | if (attr_p->attr.comediadir.role == SDP_MEDIADIR_ROLE_UNSUPPORTED) { |
| 3229 | sdp_parse_error(sdp_p, |
| 3230 | "%s Warning: Invalid role type specified for " |
| 3231 | "comediadir attribute (%s).", sdp_p->debug_str, tmp); |
| 3232 | sdp_p->conf_p->num_invalid_param++; |
| 3233 | return (SDP_INVALID_PARAMETER); |
| 3234 | } |
| 3235 | |
| 3236 | /* If the role is passive, we don't expect any more params. */ |
| 3237 | if (attr_p->attr.comediadir.role == SDP_MEDIADIR_ROLE_PASSIVE) { |
| 3238 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 3239 | SDP_PRINT("%s Parsed a=%s, passive",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3240, "sdp", "%s Parsed a=%s, passive", sdp_p->debug_str , sdp_get_attr_name(attr_p->type)) |
| 3240 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3240, "sdp", "%s Parsed a=%s, passive", sdp_p->debug_str , sdp_get_attr_name(attr_p->type)); |
| 3241 | } |
| 3242 | return (SDP_SUCCESS); |
| 3243 | } |
| 3244 | |
| 3245 | /* Find the connection information if present */ |
| 3246 | /* parse to get the nettype */ |
| 3247 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 3248 | if (result != SDP_SUCCESS) { |
| 3249 | sdp_parse_error(sdp_p, |
| 3250 | "%s Warning: No network type specified in comediadir " |
| 3251 | "attribute.", sdp_p->debug_str); |
| 3252 | sdp_p->conf_p->num_invalid_param++; |
| 3253 | return (SDP_SUCCESS); /* as the optional parameters are not there */ |
| 3254 | } |
| 3255 | attr_p->attr.comediadir.conn_info.nettype = SDP_NT_UNSUPPORTED; |
| 3256 | for (i=0; i < SDP_MAX_NETWORK_TYPES; i++) { |
| 3257 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_nettype[i].name, |
| 3258 | sdp_nettype[i].strlen) == 0) { |
| 3259 | type_found = TRUE1; |
| 3260 | } |
| 3261 | if (type_found == TRUE1) { |
| 3262 | if (sdp_p->conf_p->nettype_supported[i] == TRUE1) { |
| 3263 | attr_p->attr.comediadir.conn_info.nettype = (sdp_nettype_e)i; |
| 3264 | } |
| 3265 | type_found = FALSE0; |
| 3266 | } |
| 3267 | } |
| 3268 | if (attr_p->attr.comediadir.conn_info.nettype == SDP_NT_UNSUPPORTED) { |
| 3269 | sdp_parse_error(sdp_p, |
| 3270 | "%s Warning: ConnInfo in Comediadir: network type " |
| 3271 | "unsupported (%s).", sdp_p->debug_str, tmp); |
| 3272 | sdp_p->conf_p->num_invalid_param++; |
| 3273 | } |
| 3274 | |
| 3275 | /* Find the comedia address type. */ |
| 3276 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 3277 | if (result != SDP_SUCCESS) { |
| 3278 | sdp_parse_error(sdp_p, |
| 3279 | "%s Warning: No address type specified in comediadir" |
| 3280 | " attribute.", sdp_p->debug_str); |
| 3281 | sdp_p->conf_p->num_invalid_param++; |
| 3282 | } |
| 3283 | attr_p->attr.comediadir.conn_info.addrtype = SDP_AT_UNSUPPORTED; |
| 3284 | for (i=0; i < SDP_MAX_ADDR_TYPES; i++) { |
| 3285 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_addrtype[i].name, |
| 3286 | sdp_addrtype[i].strlen) == 0) { |
| 3287 | type_found = TRUE1; |
| 3288 | } |
| 3289 | if (type_found == TRUE1) { |
| 3290 | if (sdp_p->conf_p->addrtype_supported[i] == TRUE1) { |
| 3291 | attr_p->attr.comediadir.conn_info.addrtype = (sdp_addrtype_e)i; |
| 3292 | } |
| 3293 | type_found = FALSE0; |
| 3294 | } |
| 3295 | } |
| 3296 | if (attr_p->attr.comediadir.conn_info.addrtype == SDP_AT_UNSUPPORTED) { |
| 3297 | sdp_parse_error(sdp_p, |
| 3298 | "%s Warning: Conninfo address type unsupported " |
| 3299 | "(%s).", sdp_p->debug_str, tmp); |
| 3300 | sdp_p->conf_p->num_invalid_param++; |
| 3301 | } |
| 3302 | |
| 3303 | /* Find the conninfo address. */ |
| 3304 | ptr = sdp_getnextstrtok(ptr, attr_p->attr.comediadir.conn_info.conn_addr, |
| 3305 | sizeof(attr_p->attr.comediadir.conn_info.conn_addr), " \t", &result); |
| 3306 | if (result != SDP_SUCCESS) { |
| 3307 | sdp_parse_error(sdp_p, |
| 3308 | "%s Warning: No conninfo address specified in " |
| 3309 | "comediadir attribute.", sdp_p->debug_str); |
| 3310 | sdp_p->conf_p->num_invalid_param++; |
| 3311 | } |
| 3312 | |
| 3313 | /* Find the src port info , if any */ |
| 3314 | attr_p->attr.comediadir.src_port = sdp_getnextnumtok(ptr, &ptr, " \t", |
| 3315 | &result); |
| 3316 | if (result != SDP_SUCCESS) { |
| 3317 | sdp_parse_error(sdp_p, |
| 3318 | "%s Warning: No src port specified in " |
| 3319 | "comediadir attribute.", sdp_p->debug_str); |
| 3320 | sdp_p->conf_p->num_invalid_param++; |
| 3321 | } |
| 3322 | |
| 3323 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 3324 | SDP_PRINT("%s Parsed a=%s, network %s, addr type %s, address %s "SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3330, "sdp", "%s Parsed a=%s, network %s, addr type %s, address %s " "srcport %u ", sdp_p->debug_str, sdp_get_attr_name(attr_p ->type), sdp_get_network_name(attr_p->attr.comediadir.conn_info .nettype), sdp_get_address_name(attr_p->attr.comediadir.conn_info .addrtype), attr_p->attr.comediadir.conn_info.conn_addr, ( unsigned int)attr_p->attr.comediadir.src_port) |
| 3325 | "srcport %u ",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3330, "sdp", "%s Parsed a=%s, network %s, addr type %s, address %s " "srcport %u ", sdp_p->debug_str, sdp_get_attr_name(attr_p ->type), sdp_get_network_name(attr_p->attr.comediadir.conn_info .nettype), sdp_get_address_name(attr_p->attr.comediadir.conn_info .addrtype), attr_p->attr.comediadir.conn_info.conn_addr, ( unsigned int)attr_p->attr.comediadir.src_port) |
| 3326 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3330, "sdp", "%s Parsed a=%s, network %s, addr type %s, address %s " "srcport %u ", sdp_p->debug_str, sdp_get_attr_name(attr_p ->type), sdp_get_network_name(attr_p->attr.comediadir.conn_info .nettype), sdp_get_address_name(attr_p->attr.comediadir.conn_info .addrtype), attr_p->attr.comediadir.conn_info.conn_addr, ( unsigned int)attr_p->attr.comediadir.src_port) |
| 3327 | sdp_get_network_name(attr_p->attr.comediadir.conn_info.nettype),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3330, "sdp", "%s Parsed a=%s, network %s, addr type %s, address %s " "srcport %u ", sdp_p->debug_str, sdp_get_attr_name(attr_p ->type), sdp_get_network_name(attr_p->attr.comediadir.conn_info .nettype), sdp_get_address_name(attr_p->attr.comediadir.conn_info .addrtype), attr_p->attr.comediadir.conn_info.conn_addr, ( unsigned int)attr_p->attr.comediadir.src_port) |
| 3328 | sdp_get_address_name(attr_p->attr.comediadir.conn_info.addrtype),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3330, "sdp", "%s Parsed a=%s, network %s, addr type %s, address %s " "srcport %u ", sdp_p->debug_str, sdp_get_attr_name(attr_p ->type), sdp_get_network_name(attr_p->attr.comediadir.conn_info .nettype), sdp_get_address_name(attr_p->attr.comediadir.conn_info .addrtype), attr_p->attr.comediadir.conn_info.conn_addr, ( unsigned int)attr_p->attr.comediadir.src_port) |
| 3329 | attr_p->attr.comediadir.conn_info.conn_addr,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3330, "sdp", "%s Parsed a=%s, network %s, addr type %s, address %s " "srcport %u ", sdp_p->debug_str, sdp_get_attr_name(attr_p ->type), sdp_get_network_name(attr_p->attr.comediadir.conn_info .nettype), sdp_get_address_name(attr_p->attr.comediadir.conn_info .addrtype), attr_p->attr.comediadir.conn_info.conn_addr, ( unsigned int)attr_p->attr.comediadir.src_port) |
| 3330 | (unsigned int)attr_p->attr.comediadir.src_port)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3330, "sdp", "%s Parsed a=%s, network %s, addr type %s, address %s " "srcport %u ", sdp_p->debug_str, sdp_get_attr_name(attr_p ->type), sdp_get_network_name(attr_p->attr.comediadir.conn_info .nettype), sdp_get_address_name(attr_p->attr.comediadir.conn_info .addrtype), attr_p->attr.comediadir.conn_info.conn_addr, ( unsigned int)attr_p->attr.comediadir.src_port); |
| 3331 | } |
| 3332 | |
| 3333 | if (sdp_p->conf_p->num_invalid_param > 0) { |
| 3334 | return (SDP_INVALID_PARAMETER); |
| 3335 | } |
| 3336 | return (SDP_SUCCESS); |
| 3337 | } |
| 3338 | |
| 3339 | sdp_result_e |
| 3340 | sdp_build_attr_comediadir (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 3341 | flex_string *fs) |
| 3342 | { |
| 3343 | flex_string_sprintf(fs, "a=%s:%s\r\n", |
| 3344 | sdp_attr[attr_p->type].name, |
| 3345 | sdp_get_mediadir_role_name(attr_p->attr.comediadir.role)); |
| 3346 | |
| 3347 | return SDP_SUCCESS; |
| 3348 | } |
| 3349 | |
| 3350 | sdp_result_e sdp_parse_attr_silencesupp (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 3351 | const char *ptr) |
| 3352 | { |
| 3353 | int i; |
| 3354 | sdp_result_e result; |
| 3355 | char tmp[SDP_MAX_STRING_LEN256]; |
| 3356 | |
| 3357 | /* Find silenceSuppEnable */ |
| 3358 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 3359 | |
| 3360 | if (result != SDP_SUCCESS) { |
| 3361 | sdp_parse_error(sdp_p, |
| 3362 | "%s No silenceSupp enable value specified, parse failed.", |
| 3363 | sdp_p->debug_str); |
| 3364 | sdp_p->conf_p->num_invalid_param++; |
| 3365 | return (SDP_INVALID_PARAMETER); |
| 3366 | } |
| 3367 | |
| 3368 | if (cpr_strncasecmpstrncasecmp(tmp, "on", sizeof("on")) == 0) { |
| 3369 | attr_p->attr.silencesupp.enabled = TRUE1; |
| 3370 | } else if (cpr_strncasecmpstrncasecmp(tmp, "off", sizeof("off")) == 0) { |
| 3371 | attr_p->attr.silencesupp.enabled = FALSE0; |
| 3372 | } else if (cpr_strncasecmpstrncasecmp(tmp, "-", sizeof("-")) == 0) { |
| 3373 | attr_p->attr.silencesupp.enabled = FALSE0; |
| 3374 | } else { |
| 3375 | sdp_parse_error(sdp_p, |
| 3376 | "%s Warning: silenceSuppEnable parameter invalid (%s)", |
| 3377 | sdp_p->debug_str, tmp); |
| 3378 | sdp_p->conf_p->num_invalid_param++; |
| 3379 | return (SDP_INVALID_PARAMETER); |
| 3380 | } |
| 3381 | |
| 3382 | /* Find silenceTimer -- uint16_t or "-" */ |
| 3383 | |
| 3384 | attr_p->attr.silencesupp.timer = |
| 3385 | (uint16_t)sdp_getnextnumtok_or_null(ptr, &ptr, " \t", |
| 3386 | &attr_p->attr.silencesupp.timer_null, |
| 3387 | &result); |
| 3388 | if (result != SDP_SUCCESS) { |
| 3389 | sdp_parse_error(sdp_p, |
| 3390 | "%s Warning: Invalid timer value specified for " |
| 3391 | "silenceSupp attribute.", sdp_p->debug_str); |
| 3392 | sdp_p->conf_p->num_invalid_param++; |
| 3393 | return (SDP_INVALID_PARAMETER); |
| 3394 | } |
| 3395 | |
| 3396 | /* Find suppPref */ |
| 3397 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 3398 | if (result != SDP_SUCCESS) { |
| 3399 | sdp_parse_error(sdp_p, |
| 3400 | "%s Warning: No silenceSupp pref specified.", |
| 3401 | sdp_p->debug_str); |
| 3402 | sdp_p->conf_p->num_invalid_param++; |
| 3403 | return (SDP_INVALID_PARAMETER); |
| 3404 | } |
| 3405 | attr_p->attr.silencesupp.pref = SDP_SILENCESUPP_PREF_UNKNOWN; |
| 3406 | for (i=0; i < SDP_MAX_SILENCESUPP_PREF; i++) { |
| 3407 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_silencesupp_pref[i].name, |
| 3408 | sdp_silencesupp_pref[i].strlen) == 0) { |
| 3409 | attr_p->attr.silencesupp.pref = (sdp_silencesupp_pref_e)i; |
| 3410 | } |
| 3411 | } |
| 3412 | if (attr_p->attr.silencesupp.pref == SDP_SILENCESUPP_PREF_UNKNOWN) { |
| 3413 | sdp_parse_error(sdp_p, |
| 3414 | "%s Warning: silenceSupp pref unrecognized (%s)", |
| 3415 | sdp_p->debug_str, tmp); |
| 3416 | sdp_p->conf_p->num_invalid_param++; |
| 3417 | return (SDP_INVALID_PARAMETER); |
| 3418 | } |
| 3419 | |
| 3420 | /* Find sidUse */ |
| 3421 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 3422 | if (result != SDP_SUCCESS) { |
| 3423 | sdp_parse_error(sdp_p, |
| 3424 | "%s Warning: No silenceSupp sidUse specified.", |
| 3425 | sdp_p->debug_str); |
| 3426 | sdp_p->conf_p->num_invalid_param++; |
| 3427 | return (SDP_INVALID_PARAMETER); |
| 3428 | } |
| 3429 | attr_p->attr.silencesupp.siduse = SDP_SILENCESUPP_SIDUSE_UNKNOWN; |
| 3430 | for (i=0; i < SDP_MAX_SILENCESUPP_SIDUSE; i++) { |
| 3431 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_silencesupp_siduse[i].name, |
| 3432 | sdp_silencesupp_siduse[i].strlen) == 0) { |
| 3433 | attr_p->attr.silencesupp.siduse = (sdp_silencesupp_siduse_e)i; |
| 3434 | } |
| 3435 | } |
| 3436 | if (attr_p->attr.silencesupp.siduse == SDP_SILENCESUPP_SIDUSE_UNKNOWN) { |
| 3437 | sdp_parse_error(sdp_p, |
| 3438 | "%s Warning: silenceSupp sidUse unrecognized (%s)", |
| 3439 | sdp_p->debug_str, tmp); |
| 3440 | sdp_p->conf_p->num_invalid_param++; |
| 3441 | return (SDP_INVALID_PARAMETER); |
| 3442 | } |
| 3443 | |
| 3444 | /* Find fxnslevel -- uint8_t or "-" */ |
| 3445 | attr_p->attr.silencesupp.fxnslevel = |
| 3446 | (uint8_t)sdp_getnextnumtok_or_null(ptr, &ptr, " \t", |
| 3447 | &attr_p->attr.silencesupp.fxnslevel_null, |
| 3448 | &result); |
| 3449 | |
| 3450 | if (result != SDP_SUCCESS) { |
| 3451 | sdp_parse_error(sdp_p, |
| 3452 | "%s Warning: Invalid fxnslevel value specified for " |
| 3453 | "silenceSupp attribute.", sdp_p->debug_str); |
| 3454 | sdp_p->conf_p->num_invalid_param++; |
| 3455 | return (SDP_INVALID_PARAMETER); |
| 3456 | } |
| 3457 | |
| 3458 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 3459 | SDP_PRINT("%s Parsed a=%s, enabled %s",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3461, "sdp", "%s Parsed a=%s, enabled %s", sdp_p->debug_str , sdp_get_attr_name(attr_p->type), (attr_p->attr.silencesupp .enabled ? "on" : "off")) |
| 3460 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3461, "sdp", "%s Parsed a=%s, enabled %s", sdp_p->debug_str , sdp_get_attr_name(attr_p->type), (attr_p->attr.silencesupp .enabled ? "on" : "off")) |
| 3461 | (attr_p->attr.silencesupp.enabled ? "on" : "off"))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3461, "sdp", "%s Parsed a=%s, enabled %s", sdp_p->debug_str , sdp_get_attr_name(attr_p->type), (attr_p->attr.silencesupp .enabled ? "on" : "off")); |
| 3462 | if (attr_p->attr.silencesupp.timer_null) { |
| 3463 | SDP_PRINT(" timer=-")SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3463, "sdp", " timer=-"); |
| 3464 | } else { |
| 3465 | SDP_PRINT(" timer=%u,", attr_p->attr.silencesupp.timer)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3465, "sdp", " timer=%u,", attr_p->attr.silencesupp.timer ); |
| 3466 | } |
| 3467 | SDP_PRINT(" pref=%s, siduse=%s,",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3470, "sdp", " pref=%s, siduse=%s,", sdp_get_silencesupp_pref_name (attr_p->attr.silencesupp.pref), sdp_get_silencesupp_siduse_name ( attr_p->attr.silencesupp.siduse)) |
| 3468 | sdp_get_silencesupp_pref_name(attr_p->attr.silencesupp.pref),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3470, "sdp", " pref=%s, siduse=%s,", sdp_get_silencesupp_pref_name (attr_p->attr.silencesupp.pref), sdp_get_silencesupp_siduse_name ( attr_p->attr.silencesupp.siduse)) |
| 3469 | sdp_get_silencesupp_siduse_name(SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3470, "sdp", " pref=%s, siduse=%s,", sdp_get_silencesupp_pref_name (attr_p->attr.silencesupp.pref), sdp_get_silencesupp_siduse_name ( attr_p->attr.silencesupp.siduse)) |
| 3470 | attr_p->attr.silencesupp.siduse))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3470, "sdp", " pref=%s, siduse=%s,", sdp_get_silencesupp_pref_name (attr_p->attr.silencesupp.pref), sdp_get_silencesupp_siduse_name ( attr_p->attr.silencesupp.siduse)); |
| 3471 | if (attr_p->attr.silencesupp.fxnslevel_null) { |
| 3472 | SDP_PRINT(" fxnslevel=-")SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3472, "sdp", " fxnslevel=-"); |
| 3473 | } else { |
| 3474 | SDP_PRINT(" fxnslevel=%u,", attr_p->attr.silencesupp.fxnslevel)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3474, "sdp", " fxnslevel=%u,", attr_p->attr.silencesupp. fxnslevel); |
| 3475 | } |
| 3476 | } |
| 3477 | |
| 3478 | return (SDP_SUCCESS); |
| 3479 | } |
| 3480 | |
| 3481 | sdp_result_e sdp_build_attr_silencesupp (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 3482 | flex_string *fs) |
| 3483 | { |
| 3484 | char temp_timer_string[11]; |
| 3485 | char temp_fxnslevel_string[11]; |
| 3486 | |
| 3487 | if (attr_p->attr.silencesupp.timer_null) { |
| 3488 | snprintf(temp_timer_string, sizeof(temp_timer_string), "-"); |
| 3489 | } else { |
| 3490 | snprintf(temp_timer_string, sizeof(temp_timer_string), "%u", attr_p->attr.silencesupp.timer); |
| 3491 | } |
| 3492 | |
| 3493 | if (attr_p->attr.silencesupp.fxnslevel_null) { |
| 3494 | snprintf(temp_fxnslevel_string, sizeof(temp_fxnslevel_string), "-"); |
| 3495 | } else { |
| 3496 | snprintf(temp_fxnslevel_string, sizeof(temp_fxnslevel_string), "%u", attr_p->attr.silencesupp.fxnslevel); |
| 3497 | } |
| 3498 | |
| 3499 | flex_string_sprintf(fs, "a=%s:%s %s %s %s %s\r\n", |
| 3500 | sdp_attr[attr_p->type].name, |
| 3501 | (attr_p->attr.silencesupp.enabled ? "on" : "off"), |
| 3502 | temp_timer_string, |
| 3503 | sdp_get_silencesupp_pref_name(attr_p->attr.silencesupp.pref), |
| 3504 | sdp_get_silencesupp_siduse_name(attr_p->attr.silencesupp.siduse), |
| 3505 | temp_fxnslevel_string); |
| 3506 | |
| 3507 | return SDP_SUCCESS; |
| 3508 | } |
| 3509 | |
| 3510 | /* |
| 3511 | * sdp_parse_context_crypto_suite |
| 3512 | * |
| 3513 | * This routine parses the crypto suite pointed to by str, stores the crypto suite value into the |
| 3514 | * srtp context suite component of the LocalConnectionOptions pointed to by lco_node_ptr and stores |
| 3515 | * pointer to the next crypto parameter in tmp_ptr |
| 3516 | */ |
| 3517 | tinybool sdp_parse_context_crypto_suite(char * str, sdp_attr_t *attr_p, sdp_t *sdp_p) { |
| 3518 | /* |
| 3519 | * Three crypto_suites are defined: (Notice no SPACE between "crypto:" and the <crypto-suite> |
| 3520 | * AES_CM_128_HMAC_SHA1_80 |
| 3521 | * AES_CM_128_HMAC_SHA1_32 |
| 3522 | * F8_128_HMAC_SHA1_80 |
| 3523 | */ |
| 3524 | |
| 3525 | int i; |
| 3526 | |
| 3527 | /* Check crypto suites */ |
| 3528 | for(i=0; i<SDP_SRTP_MAX_NUM_CRYPTO_SUITES; i++) { |
| 3529 | if (!cpr_strcasecmpstrcasecmp(sdp_srtp_crypto_suite_array[i].crypto_suite_str, str)) { |
| 3530 | attr_p->attr.srtp_context.suite = sdp_srtp_crypto_suite_array[i].crypto_suite_val; |
| 3531 | attr_p->attr.srtp_context.master_key_size_bytes = |
| 3532 | sdp_srtp_crypto_suite_array[i].key_size_bytes; |
| 3533 | attr_p->attr.srtp_context.master_salt_size_bytes = |
| 3534 | sdp_srtp_crypto_suite_array[i].salt_size_bytes; |
| 3535 | return TRUE1; /* There is a succesful match so exit */ |
| 3536 | } |
| 3537 | } |
| 3538 | /* couldn't find a matching crypto suite */ |
| 3539 | sdp_parse_error(sdp_p, |
| 3540 | "%s No Matching crypto suite for SRTP Context(%s)-'X-crypto:v1' expected", |
| 3541 | sdp_p->debug_str, str); |
| 3542 | |
| 3543 | return FALSE0; |
| 3544 | } |
| 3545 | |
| 3546 | |
| 3547 | sdp_result_e sdp_build_attr_srtpcontext (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 3548 | flex_string *fs) |
| 3549 | { |
| 3550 | #define MAX_BASE64_ENCODE_SIZE_BYTES60 60 |
| 3551 | int output_len = MAX_BASE64_ENCODE_SIZE_BYTES60; |
| 3552 | int key_size = attr_p->attr.srtp_context.master_key_size_bytes; |
| 3553 | int salt_size = attr_p->attr.srtp_context.master_salt_size_bytes; |
| 3554 | unsigned char base64_encoded_data[MAX_BASE64_ENCODE_SIZE_BYTES60]; |
| 3555 | unsigned char base64_encoded_input[MAX_BASE64_ENCODE_SIZE_BYTES60]; |
| 3556 | base64_result_t status; |
| 3557 | |
| 3558 | output_len = MAX_BASE64_ENCODE_SIZE_BYTES60; |
| 3559 | |
| 3560 | /* Append master and salt keys */ |
| 3561 | memcpy(base64_encoded_input, |
| 3562 | attr_p->attr.srtp_context.master_key, |
| 3563 | key_size ); |
| 3564 | memcpy(base64_encoded_input + key_size, |
| 3565 | attr_p->attr.srtp_context.master_salt, |
| 3566 | salt_size ); |
| 3567 | |
| 3568 | if ((status = base64_encode(base64_encoded_input, key_size + salt_size, |
| 3569 | base64_encoded_data, &output_len)) != BASE64_SUCCESS) { |
| 3570 | if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) { |
| 3571 | SDPLogError(logTag, "%s Error: Failure to Base64 Encoded data (%s) ",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3572, logTag, "%s Error: Failure to Base64 Encoded data (%s) " , sdp_p->debug_str, (((status)>=0 && (status)< BASE64_RESULT_MAX)?(base64_result_table[status]):("UNKNOWN Result Code" ))) |
| 3572 | sdp_p->debug_str, BASE64_RESULT_TO_STRING(status))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3572, logTag, "%s Error: Failure to Base64 Encoded data (%s) " , sdp_p->debug_str, (((status)>=0 && (status)< BASE64_RESULT_MAX)?(base64_result_table[status]):("UNKNOWN Result Code" ))); |
| 3573 | } |
| 3574 | return (SDP_INVALID_PARAMETER); |
| 3575 | } |
| 3576 | |
| 3577 | *(base64_encoded_data + output_len) = '\0'; |
| 3578 | |
| 3579 | flex_string_sprintf(fs, "a=%s:%s inline:%s||\r\n", |
| 3580 | sdp_attr[attr_p->type].name, |
| 3581 | sdp_srtp_context_crypto_suite[attr_p->attr.srtp_context.suite].name, |
| 3582 | base64_encoded_data); |
| 3583 | |
| 3584 | return SDP_SUCCESS; |
| 3585 | } |
| 3586 | |
| 3587 | /* |
| 3588 | * sdp_parse_attr_mptime |
| 3589 | * This function parses the a=mptime sdp line. This parameter consists of |
| 3590 | * one or more numbers or hyphens ("-"). The first parameter must be a |
| 3591 | * number. The number of parameters must match the number of formats specified |
| 3592 | * on the m= line. This function is liberal in that it does not match against |
| 3593 | * the m= line or require a number for the first parameter. |
| 3594 | */ |
| 3595 | sdp_result_e sdp_parse_attr_mptime ( |
| 3596 | sdp_t *sdp_p, |
| 3597 | sdp_attr_t *attr_p, |
| 3598 | const char *ptr) |
| 3599 | { |
| 3600 | uint16_t i; /* loop counter for parameters */ |
| 3601 | sdp_result_e result; /* value returned by this function */ |
| 3602 | tinybool null_ind; /* true if a parameter is "-" */ |
| 3603 | |
| 3604 | /* |
| 3605 | * Scan the input line up to the maximum number of parameters supported. |
| 3606 | * Look for numbers or hyphens and store the resulting values. Hyphens |
| 3607 | * are stored as zeros. |
| 3608 | */ |
| 3609 | for (i=0; i<SDP_MAX_PAYLOAD_TYPES30; i++) { |
| 3610 | attr_p->attr.mptime.intervals[i] = |
| 3611 | (ushort)sdp_getnextnumtok_or_null(ptr,&ptr," \t",&null_ind,&result); |
| 3612 | if (result != SDP_SUCCESS) { |
| 3613 | break; |
| 3614 | } |
| 3615 | attr_p->attr.mptime.num_intervals++; |
| 3616 | } |
| 3617 | |
| 3618 | /* |
| 3619 | * At least one parameter must be supplied. If not, return an error |
| 3620 | * and optionally log the failure. |
| 3621 | */ |
| 3622 | if (attr_p->attr.mptime.num_intervals == 0) { |
| 3623 | sdp_parse_error(sdp_p, |
| 3624 | "%s Warning: No intervals specified for %s attr.", |
| 3625 | sdp_p->debug_str, sdp_attr[attr_p->type].name); |
| 3626 | sdp_p->conf_p->num_invalid_param++; |
| 3627 | return (SDP_INVALID_PARAMETER); |
| 3628 | } |
| 3629 | |
| 3630 | /* |
| 3631 | * Here is some debugging code that helps us track what data |
| 3632 | * is received and parsed. |
| 3633 | */ |
| 3634 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 3635 | SDP_PRINT("%s Parsed a=%s, num intervals %u, intervals: ",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3637, "sdp", "%s Parsed a=%s, num intervals %u, intervals: " , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.mptime.num_intervals) |
| 3636 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3637, "sdp", "%s Parsed a=%s, num intervals %u, intervals: " , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.mptime.num_intervals) |
| 3637 | attr_p->attr.mptime.num_intervals)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3637, "sdp", "%s Parsed a=%s, num intervals %u, intervals: " , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.mptime.num_intervals); |
| 3638 | for (i=0; i < attr_p->attr.mptime.num_intervals; i++) { |
| 3639 | SDP_PRINT("%u ", attr_p->attr.mptime.intervals[i])SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3639, "sdp", "%u ", attr_p->attr.mptime.intervals[i]); |
| 3640 | } |
| 3641 | } |
| 3642 | |
| 3643 | return SDP_SUCCESS; |
| 3644 | } |
| 3645 | |
| 3646 | /* |
| 3647 | * sdp_build_attr_mptime |
| 3648 | * This function builds the a=mptime sdp line. It reads the selected attribute |
| 3649 | * from the sdp structure. Parameters with a value of zero are replaced by |
| 3650 | * hyphens. |
| 3651 | */ |
| 3652 | sdp_result_e sdp_build_attr_mptime ( |
| 3653 | sdp_t *sdp_p, |
| 3654 | sdp_attr_t *attr_p, |
| 3655 | flex_string *fs) |
| 3656 | { |
| 3657 | int i; |
| 3658 | |
| 3659 | flex_string_sprintf(fs, "a=%s:", sdp_attr[attr_p->type].name); |
| 3660 | |
| 3661 | /* |
| 3662 | * Run the list of mptime parameter values and write each one |
| 3663 | * to the sdp line. Replace zeros with hyphens. |
| 3664 | */ |
| 3665 | for (i=0; i < attr_p->attr.mptime.num_intervals; i++) { |
| 3666 | if (i > 0) { |
| 3667 | flex_string_append(fs, " "); |
| 3668 | } |
| 3669 | |
| 3670 | if (attr_p->attr.mptime.intervals[i] == 0) { |
| 3671 | flex_string_append(fs, "-"); |
| 3672 | } else { |
| 3673 | flex_string_sprintf(fs, "%u", attr_p->attr.mptime.intervals[i]); |
| 3674 | } |
| 3675 | } |
| 3676 | |
| 3677 | flex_string_append(fs, "\r\n"); |
| 3678 | |
| 3679 | return SDP_SUCCESS; |
| 3680 | } |
| 3681 | |
| 3682 | |
| 3683 | |
| 3684 | sdp_result_e sdp_parse_attr_x_sidin (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 3685 | const char *ptr) |
| 3686 | { |
| 3687 | sdp_result_e result; |
| 3688 | attr_p->attr.stream_data.x_sidin[0] = '\0'; |
| 3689 | |
| 3690 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 3691 | SDP_PRINT("%s Parsing a=%s", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3692, "sdp", "%s Parsing a=%s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type)) |
| 3692 | sdp_get_attr_name(attr_p->type))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3692, "sdp", "%s Parsing a=%s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type)); |
| 3693 | } |
| 3694 | |
| 3695 | /* Find the X-sidin value */ |
| 3696 | ptr = sdp_getnextstrtok(ptr, attr_p->attr.stream_data.x_sidin, |
| 3697 | sizeof(attr_p->attr.stream_data.x_sidin), " \t", &result); |
| 3698 | if (result != SDP_SUCCESS) { |
| 3699 | sdp_parse_error(sdp_p, |
| 3700 | "%s Warning: No Stream Id incoming specified for X-sidin attribute.", |
| 3701 | sdp_p->debug_str); |
| 3702 | sdp_p->conf_p->num_invalid_param++; |
| 3703 | return (SDP_INVALID_PARAMETER); |
| 3704 | } |
| 3705 | |
| 3706 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 3707 | SDP_PRINT("%s Parsed a=%s, %s", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3709, "sdp", "%s Parsed a=%s, %s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), attr_p->attr.stream_data.x_sidin) |
| 3708 | sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3709, "sdp", "%s Parsed a=%s, %s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), attr_p->attr.stream_data.x_sidin) |
| 3709 | attr_p->attr.stream_data.x_sidin)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3709, "sdp", "%s Parsed a=%s, %s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), attr_p->attr.stream_data.x_sidin); |
| 3710 | } |
| 3711 | return (SDP_SUCCESS); |
| 3712 | } |
| 3713 | |
| 3714 | sdp_result_e sdp_build_attr_x_sidin (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 3715 | flex_string *fs) |
| 3716 | { |
| 3717 | flex_string_sprintf(fs, "a=%s:%s\r\n", |
| 3718 | sdp_attr[attr_p->type].name, |
| 3719 | attr_p->attr.stream_data.x_sidin); |
| 3720 | |
| 3721 | return SDP_SUCCESS; |
| 3722 | } |
| 3723 | |
| 3724 | sdp_result_e sdp_parse_attr_x_sidout (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 3725 | const char *ptr) |
| 3726 | { |
| 3727 | sdp_result_e result; |
| 3728 | attr_p->attr.stream_data.x_sidout[0] = '\0'; |
| 3729 | |
| 3730 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 3731 | SDP_PRINT("%s Parsing a=%s", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3732, "sdp", "%s Parsing a=%s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type)) |
| 3732 | sdp_get_attr_name(attr_p->type))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3732, "sdp", "%s Parsing a=%s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type)); |
| 3733 | } |
| 3734 | |
| 3735 | /* Find the X-sidout value */ |
| 3736 | ptr = sdp_getnextstrtok(ptr, attr_p->attr.stream_data.x_sidout, |
| 3737 | sizeof(attr_p->attr.stream_data.x_sidout), " \t", &result); |
| 3738 | if (result != SDP_SUCCESS) { |
| 3739 | sdp_parse_error(sdp_p, |
| 3740 | "%s Warning: No Stream Id outgoing specified for X-sidout attribute.", |
| 3741 | sdp_p->debug_str); |
| 3742 | sdp_p->conf_p->num_invalid_param++; |
| 3743 | return (SDP_INVALID_PARAMETER); |
| 3744 | } |
| 3745 | |
| 3746 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 3747 | SDP_PRINT("%s Parsed a=%s, %s", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3749, "sdp", "%s Parsed a=%s, %s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), attr_p->attr.stream_data.x_sidout) |
| 3748 | sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3749, "sdp", "%s Parsed a=%s, %s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), attr_p->attr.stream_data.x_sidout) |
| 3749 | attr_p->attr.stream_data.x_sidout)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3749, "sdp", "%s Parsed a=%s, %s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), attr_p->attr.stream_data.x_sidout); |
| 3750 | } |
| 3751 | return (SDP_SUCCESS); |
| 3752 | } |
| 3753 | |
| 3754 | sdp_result_e sdp_build_attr_x_sidout (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 3755 | flex_string *fs) |
| 3756 | { |
| 3757 | flex_string_sprintf(fs, "a=%s:%s\r\n", |
| 3758 | sdp_attr[attr_p->type].name, |
| 3759 | attr_p->attr.stream_data.x_sidout); |
| 3760 | |
| 3761 | return SDP_SUCCESS; |
| 3762 | } |
| 3763 | |
| 3764 | |
| 3765 | sdp_result_e sdp_parse_attr_x_confid (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 3766 | const char *ptr) |
| 3767 | { |
| 3768 | sdp_result_e result; |
| 3769 | attr_p->attr.stream_data.x_confid[0] = '\0'; |
| 3770 | |
| 3771 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 3772 | SDP_PRINT("%s Parsing a=%s", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3773, "sdp", "%s Parsing a=%s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type)) |
| 3773 | sdp_get_attr_name(attr_p->type))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3773, "sdp", "%s Parsing a=%s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type)); |
| 3774 | } |
| 3775 | |
| 3776 | /* Find the X-confid value */ |
| 3777 | ptr = sdp_getnextstrtok(ptr, attr_p->attr.stream_data.x_confid, |
| 3778 | sizeof(attr_p->attr.stream_data.x_confid), " \t", &result); |
| 3779 | if (result != SDP_SUCCESS) { |
| 3780 | sdp_parse_error(sdp_p, |
| 3781 | "%s Warning: No Conf Id incoming specified for " |
| 3782 | "X-confid attribute.", sdp_p->debug_str); |
| 3783 | sdp_p->conf_p->num_invalid_param++; |
| 3784 | return (SDP_INVALID_PARAMETER); |
| 3785 | } |
| 3786 | |
| 3787 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 3788 | SDP_PRINT("%s Parsed a=%s, %s", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3790, "sdp", "%s Parsed a=%s, %s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), attr_p->attr.stream_data.x_confid) |
| 3789 | sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3790, "sdp", "%s Parsed a=%s, %s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), attr_p->attr.stream_data.x_confid) |
| 3790 | attr_p->attr.stream_data.x_confid)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3790, "sdp", "%s Parsed a=%s, %s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), attr_p->attr.stream_data.x_confid); |
| 3791 | } |
| 3792 | return (SDP_SUCCESS); |
| 3793 | } |
| 3794 | |
| 3795 | sdp_result_e sdp_build_attr_x_confid (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 3796 | flex_string *fs) |
| 3797 | { |
| 3798 | if (strlen(attr_p->attr.stream_data.x_confid) <= 0) { |
| 3799 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 3800 | SDP_PRINT("%s X-confid value is not set. Cannot build a=X-confid line\n",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3801, "sdp", "%s X-confid value is not set. Cannot build a=X-confid line\n" , sdp_p->debug_str) |
| 3801 | sdp_p->debug_str)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3801, "sdp", "%s X-confid value is not set. Cannot build a=X-confid line\n" , sdp_p->debug_str); |
| 3802 | } |
| 3803 | |
| 3804 | return SDP_INVALID_PARAMETER; |
| 3805 | } |
| 3806 | |
| 3807 | flex_string_sprintf(fs, "a=%s:%s\r\n", |
| 3808 | sdp_attr[attr_p->type].name, |
| 3809 | attr_p->attr.stream_data.x_confid); |
| 3810 | |
| 3811 | return SDP_SUCCESS; |
| 3812 | } |
| 3813 | |
| 3814 | sdp_result_e sdp_parse_attr_group (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 3815 | const char *ptr) |
| 3816 | { |
| 3817 | sdp_result_e result; |
| 3818 | char tmp[64]; |
| 3819 | int i=0; |
| 3820 | |
| 3821 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 3822 | SDP_PRINT("%s Parsing a=%s", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3823, "sdp", "%s Parsing a=%s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type)) |
| 3823 | sdp_get_attr_name(attr_p->type))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3823, "sdp", "%s Parsing a=%s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type)); |
| 3824 | } |
| 3825 | |
| 3826 | /* Find the a=group:<attrib> <id1> < id2> ... values */ |
| 3827 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 3828 | if (result != SDP_SUCCESS) { |
| 3829 | sdp_parse_error(sdp_p, |
| 3830 | "%s Warning: No group attribute value specified for " |
| 3831 | "a=group line", sdp_p->debug_str); |
| 3832 | sdp_p->conf_p->num_invalid_param++; |
| 3833 | return (SDP_INVALID_PARAMETER); |
| 3834 | } |
| 3835 | |
| 3836 | attr_p->attr.stream_data.group_attr = SDP_GROUP_ATTR_UNSUPPORTED; |
| 3837 | for (i=0; i < SDP_MAX_GROUP_ATTR_VAL; i++) { |
| 3838 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_group_attr_val[i].name, |
| 3839 | sdp_group_attr_val[i].strlen) == 0) { |
| 3840 | attr_p->attr.stream_data.group_attr = (sdp_group_attr_e)i; |
| 3841 | break; |
| 3842 | } |
| 3843 | } |
| 3844 | |
| 3845 | if (attr_p->attr.stream_data.group_attr == SDP_GROUP_ATTR_UNSUPPORTED) { |
| 3846 | sdp_parse_error(sdp_p, |
| 3847 | "%s Warning: Group attribute type unsupported (%s).", |
| 3848 | sdp_p->debug_str, tmp); |
| 3849 | } |
| 3850 | |
| 3851 | |
| 3852 | /* |
| 3853 | * Scan the input line up after group:<attr> to the maximum number |
| 3854 | * of id available. |
| 3855 | */ |
| 3856 | attr_p->attr.stream_data.num_group_id =0; |
| 3857 | |
| 3858 | for (i=0; i<SDP_MAX_MEDIA_STREAMS128; i++) { |
| 3859 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 3860 | |
| 3861 | if (result != SDP_SUCCESS) { |
| 3862 | break; |
| 3863 | } |
| 3864 | attr_p->attr.stream_data.group_ids[i] = cpr_strdup(tmp); |
| 3865 | if (!attr_p->attr.stream_data.group_ids[i]) { |
| 3866 | break; |
| 3867 | } |
| 3868 | |
| 3869 | attr_p->attr.stream_data.num_group_id++; |
| 3870 | } |
| 3871 | |
| 3872 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 3873 | SDP_PRINT("%s Parsed a=%s:%s\n", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3875, "sdp", "%s Parsed a=%s:%s\n", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), sdp_get_group_attr_name (attr_p->attr.stream_data .group_attr)) |
| 3874 | sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3875, "sdp", "%s Parsed a=%s:%s\n", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), sdp_get_group_attr_name (attr_p->attr.stream_data .group_attr)) |
| 3875 | sdp_get_group_attr_name (attr_p->attr.stream_data.group_attr))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3875, "sdp", "%s Parsed a=%s:%s\n", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), sdp_get_group_attr_name (attr_p->attr.stream_data .group_attr)); |
| 3876 | for (i=0; i < attr_p->attr.stream_data.num_group_id; i++) { |
| 3877 | SDP_PRINT("%s Parsed group line id : %s\n", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3878, "sdp", "%s Parsed group line id : %s\n", sdp_p->debug_str , attr_p->attr.stream_data.group_ids[i]) |
| 3878 | attr_p->attr.stream_data.group_ids[i])SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 3878, "sdp", "%s Parsed group line id : %s\n", sdp_p->debug_str , attr_p->attr.stream_data.group_ids[i]); |
| 3879 | } |
| 3880 | } |
| 3881 | return (SDP_SUCCESS); |
| 3882 | } |
| 3883 | |
| 3884 | sdp_result_e sdp_build_attr_group (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 3885 | flex_string *fs) |
| 3886 | { |
| 3887 | int i; |
| 3888 | |
| 3889 | flex_string_sprintf(fs, "a=%s:%s", |
| 3890 | sdp_attr[attr_p->type].name, |
| 3891 | sdp_get_group_attr_name(attr_p->attr.stream_data.group_attr)); |
| 3892 | |
| 3893 | for (i=0; i < attr_p->attr.stream_data.num_group_id; i++) { |
| 3894 | if (attr_p->attr.stream_data.group_ids[i]) { |
| 3895 | flex_string_sprintf(fs, " %s", |
| 3896 | attr_p->attr.stream_data.group_ids[i]); |
| 3897 | } |
| 3898 | } |
| 3899 | |
| 3900 | flex_string_append(fs, "\r\n"); |
| 3901 | |
| 3902 | return SDP_SUCCESS; |
| 3903 | } |
| 3904 | |
| 3905 | /* Parse the source-filter attribute |
| 3906 | * "a=source-filter:<filter-mode><filter-spec>" |
| 3907 | * <filter-spec> = <nettype><addrtype><dest-addr><src_addr><src_addr>... |
| 3908 | */ |
| 3909 | sdp_result_e sdp_parse_attr_source_filter (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 3910 | const char *ptr) |
| 3911 | { |
| 3912 | int i; |
| 3913 | sdp_result_e result; |
| 3914 | char tmp[SDP_MAX_STRING_LEN256]; |
| 3915 | |
| 3916 | attr_p->attr.source_filter.mode = SDP_FILTER_MODE_NOT_PRESENT; |
| 3917 | attr_p->attr.source_filter.nettype = SDP_NT_UNSUPPORTED; |
| 3918 | attr_p->attr.source_filter.addrtype = SDP_AT_UNSUPPORTED; |
| 3919 | attr_p->attr.source_filter.dest_addr[0] = '\0'; |
| 3920 | attr_p->attr.source_filter.num_src_addr = 0; |
| 3921 | |
| 3922 | /* Find the filter mode */ |
| 3923 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 3924 | if (result != SDP_SUCCESS) { |
| 3925 | sdp_parse_error(sdp_p, |
| 3926 | "%s Warning: No src filter attribute value specified for " |
| 3927 | "a=source-filter line", sdp_p->debug_str); |
| 3928 | sdp_p->conf_p->num_invalid_param++; |
| 3929 | return (SDP_INVALID_PARAMETER); |
| 3930 | } |
| 3931 | for (i = 0; i < SDP_MAX_FILTER_MODE; i++) { |
| 3932 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_src_filter_mode_val[i].name, |
| 3933 | sdp_src_filter_mode_val[i].strlen) == 0) { |
| 3934 | attr_p->attr.source_filter.mode = (sdp_src_filter_mode_e)i; |
| 3935 | break; |
| 3936 | } |
| 3937 | } |
| 3938 | if (attr_p->attr.source_filter.mode == SDP_FILTER_MODE_NOT_PRESENT) { |
| 3939 | /* No point continuing */ |
| 3940 | sdp_parse_error(sdp_p, |
| 3941 | "%s Warning: Invalid src filter mode for a=source-filter " |
| 3942 | "line", sdp_p->debug_str); |
| 3943 | sdp_p->conf_p->num_invalid_param++; |
| 3944 | return (SDP_INVALID_PARAMETER); |
| 3945 | } |
| 3946 | |
| 3947 | /* Find the network type */ |
| 3948 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 3949 | if (result != SDP_SUCCESS) { |
| 3950 | sdp_p->conf_p->num_invalid_param++; |
| 3951 | return (SDP_INVALID_PARAMETER); |
| 3952 | } |
| 3953 | for (i = 0; i < SDP_MAX_NETWORK_TYPES; i++) { |
| 3954 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_nettype[i].name, |
| 3955 | sdp_nettype[i].strlen) == 0) { |
| 3956 | if (sdp_p->conf_p->nettype_supported[i] == TRUE1) { |
| 3957 | attr_p->attr.source_filter.nettype = (sdp_nettype_e)i; |
| 3958 | } |
| 3959 | } |
| 3960 | } |
| 3961 | if (attr_p->attr.source_filter.nettype == SDP_NT_UNSUPPORTED) { |
| 3962 | sdp_parse_error(sdp_p, |
| 3963 | "%s Warning: Network type unsupported " |
| 3964 | "(%s) for a=source-filter", sdp_p->debug_str, tmp); |
| 3965 | sdp_p->conf_p->num_invalid_param++; |
| 3966 | return (SDP_INVALID_PARAMETER); |
| 3967 | } |
| 3968 | |
| 3969 | /* Find the address type */ |
| 3970 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 3971 | if (result != SDP_SUCCESS) { |
| 3972 | sdp_p->conf_p->num_invalid_param++; |
| 3973 | return (SDP_INVALID_PARAMETER); |
| 3974 | } |
| 3975 | for (i = 0; i < SDP_MAX_ADDR_TYPES; i++) { |
| 3976 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_addrtype[i].name, |
| 3977 | sdp_addrtype[i].strlen) == 0) { |
| 3978 | if (sdp_p->conf_p->addrtype_supported[i] == TRUE1) { |
| 3979 | attr_p->attr.source_filter.addrtype = (sdp_addrtype_e)i; |
| 3980 | } |
| 3981 | } |
| 3982 | } |
| 3983 | if (attr_p->attr.source_filter.addrtype == SDP_AT_UNSUPPORTED) { |
| 3984 | if (strncmp(tmp, "*", 1) == 0) { |
| 3985 | attr_p->attr.source_filter.addrtype = SDP_AT_FQDN; |
| 3986 | } else { |
| 3987 | sdp_parse_error(sdp_p, |
| 3988 | "%s Warning: Address type unsupported " |
| 3989 | "(%s) for a=source-filter", sdp_p->debug_str, tmp); |
| 3990 | sdp_p->conf_p->num_invalid_param++; |
| 3991 | return (SDP_INVALID_PARAMETER); |
| 3992 | } |
| 3993 | } |
| 3994 | |
| 3995 | /* Find the destination addr */ |
| 3996 | ptr = sdp_getnextstrtok(ptr, attr_p->attr.source_filter.dest_addr, |
| 3997 | sizeof(attr_p->attr.source_filter.dest_addr), " \t", &result); |
| 3998 | if (result != SDP_SUCCESS) { |
| 3999 | sdp_parse_error(sdp_p, |
| 4000 | "%s No filter destination address specified for " |
| 4001 | "a=source-filter", sdp_p->debug_str); |
| 4002 | sdp_p->conf_p->num_invalid_param++; |
| 4003 | return (SDP_INVALID_PARAMETER); |
| 4004 | } |
| 4005 | |
| 4006 | /* Find the list of source address to apply the filter */ |
| 4007 | for (i = 0; i < SDP_MAX_SRC_ADDR_LIST1; i++) { |
| 4008 | ptr = sdp_getnextstrtok(ptr, attr_p->attr.source_filter.src_list[i], |
| 4009 | sizeof(attr_p->attr.source_filter.src_list[i]), " \t", &result); |
| 4010 | if (result != SDP_SUCCESS) { |
| 4011 | break; |
| 4012 | } |
| 4013 | attr_p->attr.source_filter.num_src_addr++; |
| 4014 | } |
| 4015 | if (attr_p->attr.source_filter.num_src_addr == 0) { |
| 4016 | sdp_parse_error(sdp_p, |
| 4017 | "%s Warning: No source list provided " |
| 4018 | "for a=source-filter", sdp_p->debug_str); |
| 4019 | sdp_p->conf_p->num_invalid_param++; |
| 4020 | return (SDP_INVALID_PARAMETER); |
| 4021 | } |
| 4022 | |
| 4023 | return (SDP_SUCCESS); |
| 4024 | } |
| 4025 | |
| 4026 | sdp_result_e sdp_build_source_filter (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 4027 | flex_string *fs) |
| 4028 | { |
| 4029 | int i; |
| 4030 | |
| 4031 | flex_string_sprintf(fs, "a=%s:%s %s %s %s", |
| 4032 | sdp_get_attr_name(attr_p->type), |
| 4033 | sdp_get_src_filter_mode_name(attr_p->attr.source_filter.mode), |
| 4034 | sdp_get_network_name(attr_p->attr.source_filter.nettype), |
| 4035 | sdp_get_address_name(attr_p->attr.source_filter.addrtype), |
| 4036 | attr_p->attr.source_filter.dest_addr); |
| 4037 | |
| 4038 | for (i = 0; i < attr_p->attr.source_filter.num_src_addr; i++) { |
| 4039 | flex_string_append(fs, " "); |
| 4040 | flex_string_append(fs, attr_p->attr.source_filter.src_list[i]); |
| 4041 | } |
| 4042 | |
| 4043 | flex_string_append(fs, "\r\n"); |
| 4044 | |
| 4045 | return SDP_SUCCESS; |
| 4046 | } |
| 4047 | |
| 4048 | /* Parse the rtcp-unicast attribute |
| 4049 | * "a=rtcp-unicast:<reflection|rsi>" |
| 4050 | */ |
| 4051 | sdp_result_e sdp_parse_attr_rtcp_unicast (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 4052 | const char *ptr) |
| 4053 | { |
| 4054 | sdp_result_e result; |
| 4055 | uint32_t i; |
| 4056 | char tmp[SDP_MAX_STRING_LEN256]; |
| 4057 | |
| 4058 | attr_p->attr.u32_val = SDP_RTCP_UNICAST_MODE_NOT_PRESENT; |
| 4059 | |
| 4060 | memset(tmp, 0, sizeof(tmp)); |
| 4061 | |
| 4062 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
Value stored to 'ptr' is never read | |
| 4063 | if (result != SDP_SUCCESS) { |
| 4064 | sdp_parse_error(sdp_p, |
| 4065 | "%s Warning: No rtcp unicast mode specified for " |
| 4066 | "a=rtcp-unicast line", sdp_p->debug_str); |
| 4067 | sdp_p->conf_p->num_invalid_param++; |
| 4068 | return (SDP_INVALID_PARAMETER); |
| 4069 | } |
| 4070 | for (i = 0; i < SDP_RTCP_MAX_UNICAST_MODE; i++) { |
| 4071 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_rtcp_unicast_mode_val[i].name, |
| 4072 | sdp_rtcp_unicast_mode_val[i].strlen) == 0) { |
| 4073 | attr_p->attr.u32_val = i; |
| 4074 | break; |
| 4075 | } |
| 4076 | } |
| 4077 | if (attr_p->attr.u32_val == SDP_RTCP_UNICAST_MODE_NOT_PRESENT) { |
| 4078 | sdp_parse_error(sdp_p, |
| 4079 | "%s Warning: Invalid rtcp unicast mode for " |
| 4080 | "a=rtcp-unicast line", sdp_p->debug_str); |
| 4081 | sdp_p->conf_p->num_invalid_param++; |
| 4082 | return (SDP_INVALID_PARAMETER); |
| 4083 | } |
| 4084 | return (SDP_SUCCESS); |
| 4085 | } |
| 4086 | |
| 4087 | sdp_result_e sdp_build_attr_rtcp_unicast (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 4088 | flex_string *fs) |
| 4089 | { |
| 4090 | if (attr_p->attr.u32_val >= SDP_RTCP_MAX_UNICAST_MODE) { |
| 4091 | return SDP_INVALID_PARAMETER; |
| 4092 | } |
| 4093 | |
| 4094 | flex_string_sprintf(fs, "a=%s:%s\r\n", |
| 4095 | sdp_get_attr_name(attr_p->type), |
| 4096 | sdp_get_rtcp_unicast_mode_name((sdp_rtcp_unicast_mode_e)attr_p->attr.u32_val)); |
| 4097 | |
| 4098 | return SDP_SUCCESS; |
| 4099 | } |
| 4100 | |
| 4101 | |
| 4102 | /* |
| 4103 | * store_sdescriptions_mki_or_lifetime |
| 4104 | * |
| 4105 | * Verifies the syntax of the MKI or lifetime parameter and stores |
| 4106 | * it in the sdescriptions attribute struct. |
| 4107 | * |
| 4108 | * Inputs: |
| 4109 | * buf - pointer to MKI or lifetime string assumes string is null |
| 4110 | * terminated. |
| 4111 | * attr_p - pointer to attribute struct |
| 4112 | * |
| 4113 | * Outputs: |
| 4114 | * Return TRUE all is good otherwise FALSE for error. |
| 4115 | */ |
| 4116 | |
| 4117 | tinybool |
| 4118 | store_sdescriptions_mki_or_lifetime (char *buf, sdp_attr_t *attr_p) |
| 4119 | { |
| 4120 | |
| 4121 | tinybool result; |
| 4122 | uint16_t mkiLen; |
| 4123 | char mkiValue[SDP_SRTP_MAX_MKI_SIZE_BYTES4]; |
| 4124 | |
| 4125 | /* MKI has a colon */ |
| 4126 | if (strstr(buf, ":")) { |
| 4127 | result = verify_sdescriptions_mki(buf, mkiValue, &mkiLen); |
| 4128 | if (result) { |
| 4129 | attr_p->attr.srtp_context.mki_size_bytes = mkiLen; |
| 4130 | sstrncpy((char*)attr_p->attr.srtp_context.mki, mkiValue, |
| 4131 | SDP_SRTP_MAX_MKI_SIZE_BYTES4); |
| 4132 | } |
| 4133 | |
| 4134 | } else { |
| 4135 | result = verify_sdescriptions_lifetime(buf); |
| 4136 | if (result) { |
| 4137 | sstrncpy((char*)attr_p->attr.srtp_context.master_key_lifetime, buf, |
| 4138 | SDP_SRTP_MAX_LIFETIME_BYTES16); |
| 4139 | } |
| 4140 | } |
| 4141 | |
| 4142 | return result; |
| 4143 | |
| 4144 | } |
| 4145 | |
| 4146 | /* |
| 4147 | * sdp_parse_sdescriptions_key_param |
| 4148 | * |
| 4149 | * This routine parses the srtp key-params pointed to by str. |
| 4150 | * |
| 4151 | * key-params = <key-method> ":" <key-info> |
| 4152 | * key-method = "inline" / key-method-ext [note V9 only supports 'inline'] |
| 4153 | * key-info = srtp-key-info |
| 4154 | * srtp-key-info = key-salt ["|" lifetime] ["|" mki] |
| 4155 | * key-salt = 1*(base64) ; binary key and salt values |
| 4156 | * ; concatenated together, and then |
| 4157 | * ; base64 encoded [section 6.8 of |
| 4158 | * ; RFC2046] |
| 4159 | * |
| 4160 | * lifetime = ["2^"] 1*(DIGIT) |
| 4161 | * mki = mki-value ":" mki-length |
| 4162 | * mki-value = 1*DIGIT |
| 4163 | * mki-length = 1*3DIGIT ; range 1..128. |
| 4164 | * |
| 4165 | * Inputs: str - pointer to beginning of key-params and assumes |
| 4166 | * null terminated string. |
| 4167 | */ |
| 4168 | |
| 4169 | |
| 4170 | tinybool |
| 4171 | sdp_parse_sdescriptions_key_param (const char *str, sdp_attr_t *attr_p, |
| 4172 | sdp_t *sdp_p) |
| 4173 | { |
| 4174 | char buf[SDP_MAX_STRING_LEN256], |
| 4175 | base64decodeData[SDP_MAX_STRING_LEN256]; |
| 4176 | const char *ptr; |
| 4177 | sdp_result_e result = SDP_SUCCESS; |
| 4178 | tinybool keyFound = FALSE0; |
| 4179 | int len, |
| 4180 | keySize, |
| 4181 | saltSize; |
| 4182 | base64_result_t status; |
| 4183 | |
| 4184 | ptr = str; |
| 4185 | if (cpr_strncasecmpstrncasecmp(ptr, "inline:", 7) != 0) { |
| 4186 | sdp_parse_error(sdp_p, |
| 4187 | "%s Could not find keyword inline", sdp_p->debug_str); |
| 4188 | sdp_p->conf_p->num_invalid_param++; |
| 4189 | return FALSE0; |
| 4190 | } |
| 4191 | |
| 4192 | /* advance pass the inline key word */ |
| 4193 | ptr = ptr + 7; |
| 4194 | ptr = sdp_getnextstrtok(ptr, buf, sizeof(buf), "|", &result); |
| 4195 | while (result == SDP_SUCCESS) { |
| 4196 | /* the fist time this loop executes, the key is gotten */ |
| 4197 | if (keyFound == FALSE0) { |
| 4198 | keyFound = TRUE1; |
| 4199 | len = SDP_MAX_STRING_LEN256; |
| 4200 | /* The key is base64 encoded composed of the master key concatenated with the |
| 4201 | * master salt. |
| 4202 | */ |
| 4203 | status = base64_decode((unsigned char *)buf, strlen(buf), |
| 4204 | (unsigned char *)base64decodeData, &len); |
| 4205 | |
| 4206 | if (status != BASE64_SUCCESS) { |
| 4207 | sdp_parse_error(sdp_p, |
| 4208 | "%s key-salt error decoding buffer: %s", |
| 4209 | sdp_p->debug_str, BASE64_RESULT_TO_STRING(status)(((status)>=0 && (status)<BASE64_RESULT_MAX)?(base64_result_table [status]):("UNKNOWN Result Code"))); |
| 4210 | return FALSE0; |
| 4211 | } |
| 4212 | |
| 4213 | keySize = attr_p->attr.srtp_context.master_key_size_bytes; |
| 4214 | saltSize = attr_p->attr.srtp_context.master_salt_size_bytes; |
| 4215 | |
| 4216 | if (len != keySize + saltSize) { |
| 4217 | sdp_parse_error(sdp_p, |
| 4218 | "%s key-salt size doesn't match: (%d, %d, %d)", |
| 4219 | sdp_p->debug_str, len, keySize, saltSize); |
| 4220 | return(FALSE0); |
| 4221 | } |
| 4222 | |
| 4223 | memcpy(attr_p->attr.srtp_context.master_key, |
| 4224 | base64decodeData, |
| 4225 | keySize); |
| 4226 | |
| 4227 | memcpy(attr_p->attr.srtp_context.master_salt, |
| 4228 | base64decodeData + keySize, |
| 4229 | saltSize); |
| 4230 | |
| 4231 | /* Used only for MGCP */ |
| 4232 | SDP_SRTP_CONTEXT_SET_MASTER_KEY((attr_p->attr.srtp_context.selection_flags) |= 0x80000000 ) |
| 4233 | (attr_p->attr.srtp_context.selection_flags)((attr_p->attr.srtp_context.selection_flags) |= 0x80000000 ); |
| 4234 | SDP_SRTP_CONTEXT_SET_MASTER_SALT((attr_p->attr.srtp_context.selection_flags) |= 0x40000000 ) |
| 4235 | (attr_p->attr.srtp_context.selection_flags)((attr_p->attr.srtp_context.selection_flags) |= 0x40000000 ); |
| 4236 | |
| 4237 | } else if (store_sdescriptions_mki_or_lifetime(buf, attr_p) == FALSE0) { |
| 4238 | return FALSE0; |
| 4239 | } |
| 4240 | |
| 4241 | /* if we haven't reached the end of line, get the next token */ |
| 4242 | ptr = sdp_getnextstrtok(ptr, buf, sizeof(buf), "|", &result); |
| 4243 | } |
| 4244 | |
| 4245 | /* if we didn't find the key, error out */ |
| 4246 | if (keyFound == FALSE0) { |
| 4247 | sdp_parse_error(sdp_p, |
| 4248 | "%s Could not find sdescriptions key", sdp_p->debug_str); |
| 4249 | sdp_p->conf_p->num_invalid_param++; |
| 4250 | return FALSE0; |
| 4251 | } |
| 4252 | |
| 4253 | return TRUE1; |
| 4254 | |
| 4255 | } |
| 4256 | |
| 4257 | /* |
| 4258 | * sdp_build_attr_sdescriptions |
| 4259 | * |
| 4260 | * Builds a=crypto line for attribute type SDP_ATTR_SDESCRIPTIONS. |
| 4261 | * |
| 4262 | * a=crypto:tag 1*WSP crypto-suite 1*WSP key-params |
| 4263 | * |
| 4264 | * Where key-params = inline: <key|salt> ["|"lifetime] ["|" MKI:length] |
| 4265 | * The key and salt is base64 encoded and lifetime and MKI/length are optional. |
| 4266 | */ |
| 4267 | |
| 4268 | sdp_result_e |
| 4269 | sdp_build_attr_sdescriptions (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 4270 | flex_string *fs) |
| 4271 | { |
| 4272 | |
| 4273 | unsigned char base64_encoded_data[MAX_BASE64_STRING_LEN60]; |
| 4274 | unsigned char base64_encoded_input[MAX_BASE64_STRING_LEN60]; |
| 4275 | int keySize, |
| 4276 | saltSize, |
| 4277 | outputLen; |
| 4278 | base64_result_t status; |
| 4279 | |
| 4280 | keySize = attr_p->attr.srtp_context.master_key_size_bytes; |
| 4281 | saltSize = attr_p->attr.srtp_context.master_salt_size_bytes; |
| 4282 | |
| 4283 | /* concatenate the master key + salt then base64 encode it */ |
| 4284 | memcpy(base64_encoded_input, |
| 4285 | attr_p->attr.srtp_context.master_key, |
| 4286 | keySize); |
| 4287 | |
| 4288 | memcpy(base64_encoded_input + keySize, |
| 4289 | attr_p->attr.srtp_context.master_salt, |
| 4290 | saltSize); |
| 4291 | |
| 4292 | outputLen = MAX_BASE64_STRING_LEN60; |
| 4293 | status = base64_encode(base64_encoded_input, keySize + saltSize, |
| 4294 | base64_encoded_data, &outputLen); |
| 4295 | |
| 4296 | if (status != BASE64_SUCCESS) { |
| 4297 | if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) { |
| 4298 | SDPLogError(logTag, "%s Error: Failure to Base64 Encoded data (%s) ",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 4299, logTag, "%s Error: Failure to Base64 Encoded data (%s) " , sdp_p->debug_str, (((status)>=0 && (status)< BASE64_RESULT_MAX)?(base64_result_table[status]):("UNKNOWN Result Code" ))) |
| 4299 | sdp_p->debug_str, BASE64_RESULT_TO_STRING(status))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 4299, logTag, "%s Error: Failure to Base64 Encoded data (%s) " , sdp_p->debug_str, (((status)>=0 && (status)< BASE64_RESULT_MAX)?(base64_result_table[status]):("UNKNOWN Result Code" ))); |
| 4300 | } |
| 4301 | return (SDP_INVALID_PARAMETER); |
| 4302 | |
| 4303 | } |
| 4304 | |
| 4305 | base64_encoded_data[outputLen] = 0; |
| 4306 | |
| 4307 | /* lifetime and MKI parameters are optional. Only inlcude them if |
| 4308 | * they were set. |
| 4309 | */ |
| 4310 | |
| 4311 | |
| 4312 | if (attr_p->attr.srtp_context.master_key_lifetime[0] != 0 && |
| 4313 | attr_p->attr.srtp_context.mki[0] != 0) { |
| 4314 | flex_string_sprintf(fs, "a=%s:%d %s inline:%s|%s|%s:%d\r\n", |
| 4315 | sdp_attr[attr_p->type].name, |
| 4316 | attr_p->attr.srtp_context.tag, |
| 4317 | sdp_srtp_context_crypto_suite[attr_p->attr.srtp_context.suite].name, |
| 4318 | base64_encoded_data, |
| 4319 | attr_p->attr.srtp_context.master_key_lifetime, |
| 4320 | attr_p->attr.srtp_context.mki, |
| 4321 | attr_p->attr.srtp_context.mki_size_bytes); |
| 4322 | |
| 4323 | return SDP_SUCCESS; |
| 4324 | } |
| 4325 | |
| 4326 | /* if we get here, either lifetime is populated and mki and is not or mki is populated |
| 4327 | * and lifetime is not or neither is populated |
| 4328 | */ |
| 4329 | |
| 4330 | if (attr_p->attr.srtp_context.master_key_lifetime[0] != 0) { |
| 4331 | flex_string_sprintf(fs, "a=%s:%d %s inline:%s|%s\r\n", |
| 4332 | sdp_attr[attr_p->type].name, |
| 4333 | attr_p->attr.srtp_context.tag, |
| 4334 | sdp_srtp_context_crypto_suite[attr_p->attr.srtp_context.suite].name, |
| 4335 | base64_encoded_data, |
| 4336 | attr_p->attr.srtp_context.master_key_lifetime); |
| 4337 | |
| 4338 | } else if (attr_p->attr.srtp_context.mki[0] != 0) { |
| 4339 | flex_string_sprintf(fs, "a=%s:%d %s inline:%s|%s:%d\r\n", |
| 4340 | sdp_attr[attr_p->type].name, |
| 4341 | attr_p->attr.srtp_context.tag, |
| 4342 | sdp_srtp_context_crypto_suite[attr_p->attr.srtp_context.suite].name, |
| 4343 | base64_encoded_data, |
| 4344 | attr_p->attr.srtp_context.mki, |
| 4345 | attr_p->attr.srtp_context.mki_size_bytes); |
| 4346 | |
| 4347 | } else { |
| 4348 | flex_string_sprintf(fs, "a=%s:%d %s inline:%s\r\n", |
| 4349 | sdp_attr[attr_p->type].name, |
| 4350 | attr_p->attr.srtp_context.tag, |
| 4351 | sdp_srtp_context_crypto_suite[attr_p->attr.srtp_context.suite].name, |
| 4352 | base64_encoded_data); |
| 4353 | |
| 4354 | } |
| 4355 | |
| 4356 | return SDP_SUCCESS; |
| 4357 | |
| 4358 | } |
| 4359 | |
| 4360 | |
| 4361 | /* |
| 4362 | * sdp_parse_attr_srtp |
| 4363 | * |
| 4364 | * Parses Session Description for Protocol Security Descriptions |
| 4365 | * version 2 or version 9. Grammar is of the form: |
| 4366 | * |
| 4367 | * a=crypto:<tag> <crypto-suite> <key-params> [<session-params>] |
| 4368 | * |
| 4369 | * Note session-params is not supported and will not be parsed. |
| 4370 | * Version 2 does not contain a tag. |
| 4371 | * |
| 4372 | * Inputs: |
| 4373 | * sdp_p - pointer to sdp handle |
| 4374 | * attr_p - pointer to attribute structure |
| 4375 | * ptr - pointer to string to be parsed |
| 4376 | * vtype - version type |
| 4377 | */ |
| 4378 | |
| 4379 | sdp_result_e |
| 4380 | sdp_parse_attr_srtp (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 4381 | const char *ptr, sdp_attr_e vtype) |
| 4382 | { |
| 4383 | |
| 4384 | char tmp[SDP_MAX_STRING_LEN256]; |
| 4385 | sdp_result_e result = SDP_FAILURE; |
| 4386 | int k = 0; |
| 4387 | |
| 4388 | /* initialize only the optional parameters */ |
| 4389 | attr_p->attr.srtp_context.master_key_lifetime[0] = 0; |
| 4390 | attr_p->attr.srtp_context.mki[0] = 0; |
| 4391 | |
| 4392 | /* used only for MGCP */ |
| 4393 | SDP_SRTP_CONTEXT_SET_ENCRYPT_AUTHENTICATE((attr_p->attr.srtp_context.selection_flags) |= (0x00000001 | 0x00000002 | 0x00000004)) |
| 4394 | (attr_p->attr.srtp_context.selection_flags)((attr_p->attr.srtp_context.selection_flags) |= (0x00000001 | 0x00000002 | 0x00000004)); |
| 4395 | |
| 4396 | /* get the tag only if we are version 9 */ |
| 4397 | if (vtype == SDP_ATTR_SDESCRIPTIONS) { |
| 4398 | attr_p->attr.srtp_context.tag = |
| 4399 | sdp_getnextnumtok(ptr, &ptr, " \t", &result); |
| 4400 | |
| 4401 | if (result != SDP_SUCCESS) { |
| 4402 | sdp_parse_error(sdp_p, |
| 4403 | "%s Could not find sdescriptions tag", |
| 4404 | sdp_p->debug_str); |
| 4405 | sdp_p->conf_p->num_invalid_param++; |
| 4406 | return (SDP_INVALID_PARAMETER); |
| 4407 | |
| 4408 | } |
| 4409 | } |
| 4410 | |
| 4411 | /* get the crypto suite */ |
| 4412 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 4413 | if (result != SDP_SUCCESS) { |
| 4414 | sdp_parse_error(sdp_p, |
| 4415 | "%s Could not find sdescriptions crypto suite", sdp_p->debug_str); |
| 4416 | sdp_p->conf_p->num_invalid_param++; |
| 4417 | return (SDP_INVALID_PARAMETER); |
| 4418 | } |
| 4419 | |
| 4420 | if (!sdp_parse_context_crypto_suite(tmp, attr_p, sdp_p)) { |
| 4421 | sdp_parse_error(sdp_p, |
| 4422 | "%s Unsupported crypto suite", sdp_p->debug_str); |
| 4423 | return (SDP_INVALID_PARAMETER); |
| 4424 | } |
| 4425 | |
| 4426 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 4427 | if (result != SDP_SUCCESS) { |
| 4428 | sdp_parse_error(sdp_p, |
| 4429 | "%s Could not find sdescriptions key params", sdp_p->debug_str); |
| 4430 | sdp_p->conf_p->num_invalid_param++; |
| 4431 | return (SDP_INVALID_PARAMETER); |
| 4432 | } |
| 4433 | |
| 4434 | if (!sdp_parse_sdescriptions_key_param(tmp, attr_p, sdp_p)) { |
| 4435 | sdp_parse_error(sdp_p, |
| 4436 | "%s Failed to parse key-params", sdp_p->debug_str); |
| 4437 | return (SDP_INVALID_PARAMETER); |
| 4438 | } |
| 4439 | |
| 4440 | /* if there are session parameters, scan the session parameters |
| 4441 | * into tmp until we reach end of line. Currently the sdp parser |
| 4442 | * does not parse session parameters but if they are present, |
| 4443 | * we store them for the application. |
| 4444 | */ |
| 4445 | /*sa_ignore NO_NULL_CHK |
| 4446 | *{ptr is valid since the pointer was checked earlier and the |
| 4447 | * function would have exited if NULL.} |
| 4448 | */ |
| 4449 | while (*ptr && *ptr != '\n' && *ptr != '\r' && k < SDP_MAX_STRING_LEN256) { |
| 4450 | tmp[k++] = *ptr++; |
| 4451 | } |
| 4452 | |
| 4453 | if ((k) && (k < SDP_MAX_STRING_LEN256)) { |
| 4454 | tmp[k] = 0; |
| 4455 | attr_p->attr.srtp_context.session_parameters = cpr_strdup(tmp); |
| 4456 | } |
| 4457 | |
| 4458 | return SDP_SUCCESS; |
| 4459 | |
| 4460 | } |
| 4461 | |
| 4462 | /* Parses crypto attribute based on the sdescriptions version |
| 4463 | * 9 grammar. |
| 4464 | * |
| 4465 | */ |
| 4466 | |
| 4467 | sdp_result_e |
| 4468 | sdp_parse_attr_sdescriptions (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 4469 | const char *ptr) |
| 4470 | { |
| 4471 | |
| 4472 | return sdp_parse_attr_srtp(sdp_p, attr_p, ptr, |
| 4473 | SDP_ATTR_SDESCRIPTIONS); |
| 4474 | |
| 4475 | } |
| 4476 | |
| 4477 | /* Parses X-crypto attribute based on the sdescriptions version |
| 4478 | * 2 grammar. |
| 4479 | * |
| 4480 | */ |
| 4481 | |
| 4482 | sdp_result_e sdp_parse_attr_srtpcontext (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 4483 | const char *ptr) |
| 4484 | { |
| 4485 | |
| 4486 | return sdp_parse_attr_srtp(sdp_p, attr_p, ptr, |
| 4487 | SDP_ATTR_SRTP_CONTEXT); |
| 4488 | } |
| 4489 | |
| 4490 | |
| 4491 | sdp_result_e sdp_build_attr_ice_attr (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 4492 | flex_string *fs) { |
| 4493 | flex_string_sprintf(fs, "a=%s:%s\r\n", |
| 4494 | sdp_get_attr_name(attr_p->type), |
| 4495 | attr_p->attr.ice_attr); |
| 4496 | |
| 4497 | return SDP_SUCCESS; |
| 4498 | } |
| 4499 | |
| 4500 | |
| 4501 | sdp_result_e sdp_parse_attr_ice_attr (sdp_t *sdp_p, sdp_attr_t *attr_p, const char *ptr) { |
| 4502 | sdp_result_e result; |
| 4503 | char tmp[SDP_MAX_STRING_LEN256]; |
| 4504 | |
| 4505 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), "\r\n", &result); |
| 4506 | if (result != SDP_SUCCESS){ |
| 4507 | sdp_parse_error(sdp_p, |
| 4508 | "%s Warning: problem parsing ice attribute ", sdp_p->debug_str); |
| 4509 | sdp_p->conf_p->num_invalid_param++; |
| 4510 | return (SDP_INVALID_PARAMETER); |
| 4511 | } |
| 4512 | |
| 4513 | snprintf(attr_p->attr.ice_attr, sizeof(attr_p->attr.ice_attr), "%s", tmp); |
| 4514 | |
| 4515 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 4516 | SDP_PRINT("%s Parsed a=%s, %s", sdp_p->debug_str, sdp_get_attr_name(attr_p->type), tmp)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 4516, "sdp", "%s Parsed a=%s, %s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), tmp); |
| 4517 | } |
| 4518 | return (SDP_SUCCESS); |
| 4519 | } |
| 4520 | |
| 4521 | |
| 4522 | sdp_result_e sdp_build_attr_simple_flag (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 4523 | flex_string *fs) { |
| 4524 | flex_string_sprintf(fs, "a=%s\r\n", sdp_get_attr_name(attr_p->type)); |
| 4525 | |
| 4526 | return SDP_SUCCESS; |
| 4527 | } |
| 4528 | |
| 4529 | |
| 4530 | sdp_result_e sdp_parse_attr_simple_flag (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 4531 | const char *ptr) { |
| 4532 | /* No parameters to parse. */ |
| 4533 | |
| 4534 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 4535 | SDP_PRINT("%s Parsed a=%s", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 4536, "sdp", "%s Parsed a=%s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type)) |
| 4536 | sdp_get_attr_name(attr_p->type))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 4536, "sdp", "%s Parsed a=%s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type)); |
| 4537 | } |
| 4538 | |
| 4539 | return (SDP_SUCCESS); |
| 4540 | } |
| 4541 | |
| 4542 | static sdp_result_e sdp_parse_attr_line(sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 4543 | const char *ptr, char *buf, size_t buf_len) { |
| 4544 | sdp_result_e result; |
| 4545 | |
| 4546 | (void)sdp_getnextstrtok(ptr, buf, buf_len, "\r\n", &result); |
| 4547 | |
| 4548 | if (result != SDP_SUCCESS) { |
| 4549 | sdp_parse_error(sdp_p, |
| 4550 | "%s Warning: No string token found for %s attribute", |
| 4551 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type)); |
| 4552 | sdp_p->conf_p->num_invalid_param++; |
| 4553 | return (SDP_INVALID_PARAMETER); |
| 4554 | } else { |
| 4555 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 4556 | SDP_PRINT("%s Parsed a=%s, %s", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 4558, "sdp", "%s Parsed a=%s, %s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), buf) |
| 4557 | sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 4558, "sdp", "%s Parsed a=%s, %s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), buf) |
| 4558 | buf)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 4558, "sdp", "%s Parsed a=%s, %s", sdp_p->debug_str, sdp_get_attr_name (attr_p->type), buf); |
| 4559 | } |
| 4560 | return (SDP_SUCCESS); |
| 4561 | } |
| 4562 | } |
| 4563 | |
| 4564 | sdp_result_e sdp_parse_attr_complete_line (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 4565 | const char *ptr) |
| 4566 | { |
| 4567 | return sdp_parse_attr_line(sdp_p, attr_p, ptr, |
| 4568 | attr_p->attr.string_val, |
| 4569 | sizeof(attr_p->attr.string_val)); |
| 4570 | } |
| 4571 | |
| 4572 | sdp_result_e sdp_parse_attr_long_line (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 4573 | const char *ptr) |
| 4574 | { |
| 4575 | sdp_result_e result; |
| 4576 | char buffer[SDP_MAX_LONG_STRING_LEN4096]; |
| 4577 | |
| 4578 | result = sdp_parse_attr_line(sdp_p, attr_p, ptr, |
| 4579 | buffer, sizeof(buffer)); |
| 4580 | if (result == SDP_SUCCESS) { |
| 4581 | attr_p->attr.stringp = cpr_strdup(buffer); |
| 4582 | } |
| 4583 | return result; |
| 4584 | } |
| 4585 | |
| 4586 | sdp_result_e sdp_build_attr_long_line (sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 4587 | flex_string *fs) |
| 4588 | { |
| 4589 | flex_string_sprintf(fs, "a=%s:%s\r\n", sdp_attr[attr_p->type].name, |
| 4590 | attr_p->attr.stringp); |
| 4591 | return SDP_SUCCESS; |
| 4592 | } |
| 4593 | |
| 4594 | sdp_result_e sdp_build_attr_rtcp_fb(sdp_t *sdp_p, |
| 4595 | sdp_attr_t *attr_p, |
| 4596 | flex_string *fs) |
| 4597 | { |
| 4598 | flex_string_sprintf(fs, "a=%s:", sdp_attr[attr_p->type].name); |
| 4599 | |
| 4600 | /* Payload Type */ |
| 4601 | if (attr_p->attr.rtcp_fb.payload_num == SDP_ALL_PAYLOADS0xFFFF) { |
| 4602 | flex_string_sprintf(fs, "* "); |
| 4603 | } else { |
| 4604 | flex_string_sprintf(fs, "%d ",attr_p->attr.rtcp_fb.payload_num); |
| 4605 | } |
| 4606 | |
| 4607 | /* Feedback Type */ |
| 4608 | if (attr_p->attr.rtcp_fb.feedback_type < SDP_RTCP_FB_UNKNOWN) { |
| 4609 | flex_string_sprintf(fs, "%s", |
| 4610 | sdp_rtcp_fb_type_val[attr_p->attr.rtcp_fb.feedback_type].name); |
| 4611 | } |
| 4612 | |
| 4613 | /* Feedback Type Parameters */ |
| 4614 | switch (attr_p->attr.rtcp_fb.feedback_type) { |
| 4615 | case SDP_RTCP_FB_ACK: |
| 4616 | if (attr_p->attr.rtcp_fb.param.ack < SDP_MAX_RTCP_FB_ACK) { |
| 4617 | flex_string_sprintf(fs, " %s", |
| 4618 | sdp_rtcp_fb_ack_type_val[attr_p->attr.rtcp_fb.param.ack] |
| 4619 | .name); |
| 4620 | } |
| 4621 | break; |
| 4622 | case SDP_RTCP_FB_CCM: /* RFC 5104 */ |
| 4623 | if (attr_p->attr.rtcp_fb.param.ccm < SDP_MAX_RTCP_FB_CCM) { |
| 4624 | flex_string_sprintf(fs, " %s", |
| 4625 | sdp_rtcp_fb_ccm_type_val[attr_p->attr.rtcp_fb.param.ccm] |
| 4626 | .name); |
| 4627 | } |
| 4628 | break; |
| 4629 | case SDP_RTCP_FB_NACK: |
| 4630 | if (attr_p->attr.rtcp_fb.param.nack > SDP_RTCP_FB_NACK_BASIC |
| 4631 | && attr_p->attr.rtcp_fb.param.nack < SDP_MAX_RTCP_FB_NACK) { |
| 4632 | flex_string_sprintf(fs, " %s", |
| 4633 | sdp_rtcp_fb_nack_type_val[attr_p->attr.rtcp_fb.param.nack] |
| 4634 | .name); |
| 4635 | } |
| 4636 | break; |
| 4637 | case SDP_RTCP_FB_TRR_INT: |
| 4638 | flex_string_sprintf(fs, " %u", attr_p->attr.rtcp_fb.param.trr_int); |
| 4639 | break; |
| 4640 | case SDP_RTCP_FB_REMB: |
| 4641 | /* No additional params after REMB */ |
| 4642 | break; |
| 4643 | case SDP_RTCP_FB_TRANSPORT_CC: |
| 4644 | /* No additional params after Transport-CC */ |
| 4645 | break; |
| 4646 | |
| 4647 | case SDP_RTCP_FB_UNKNOWN: |
| 4648 | /* Contents are in the "extra" field */ |
| 4649 | break; |
| 4650 | |
| 4651 | default: |
| 4652 | SDPLogError(logTag, "%s Error: Invalid rtcp-fb enum (%d)",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 4653, logTag, "%s Error: Invalid rtcp-fb enum (%d)", sdp_p-> debug_str, attr_p->attr.rtcp_fb.feedback_type) |
| 4653 | sdp_p->debug_str, attr_p->attr.rtcp_fb.feedback_type)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 4653, logTag, "%s Error: Invalid rtcp-fb enum (%d)", sdp_p-> debug_str, attr_p->attr.rtcp_fb.feedback_type); |
| 4654 | return SDP_FAILURE; |
| 4655 | } |
| 4656 | |
| 4657 | /* Tack on any information that cannot otherwise be represented by |
| 4658 | * the sdp_fmtp_fb_t structure. */ |
| 4659 | if (attr_p->attr.rtcp_fb.extra[0]) { |
| 4660 | flex_string_sprintf(fs, " %s", attr_p->attr.rtcp_fb.extra); |
| 4661 | } |
| 4662 | |
| 4663 | /* Line ending */ |
| 4664 | flex_string_sprintf(fs, "\r\n"); |
| 4665 | |
| 4666 | return SDP_SUCCESS; |
| 4667 | } |
| 4668 | |
| 4669 | sdp_result_e sdp_parse_attr_rtcp_fb (sdp_t *sdp_p, |
| 4670 | sdp_attr_t *attr_p, |
| 4671 | const char *ptr) |
| 4672 | { |
| 4673 | sdp_result_e result = SDP_SUCCESS; |
| 4674 | sdp_fmtp_fb_t *rtcp_fb_p = &(attr_p->attr.rtcp_fb); |
| 4675 | int i; |
| 4676 | |
| 4677 | /* Set up attribute fields */ |
| 4678 | rtcp_fb_p->payload_num = 0; |
| 4679 | rtcp_fb_p->feedback_type = SDP_RTCP_FB_UNKNOWN; |
| 4680 | rtcp_fb_p->extra[0] = '\0'; |
| 4681 | |
| 4682 | /* Skip WS (just in case) */ |
| 4683 | while (*ptr == ' ' || *ptr == '\t') { |
| 4684 | ptr++; |
| 4685 | } |
| 4686 | |
| 4687 | /* Look for the special "*" payload type */ |
| 4688 | if (*ptr == '*') { |
| 4689 | rtcp_fb_p->payload_num = SDP_ALL_PAYLOADS0xFFFF; |
| 4690 | ptr++; |
| 4691 | } else { |
| 4692 | /* If the pt is not '*', parse it out as an integer */ |
| 4693 | rtcp_fb_p->payload_num = (uint16_t)sdp_getnextnumtok(ptr, &ptr, |
| 4694 | " \t", &result); |
| 4695 | if (result != SDP_SUCCESS) { |
| 4696 | sdp_parse_error(sdp_p, |
| 4697 | "%s Warning: could not parse payload type for rtcp-fb attribute", |
| 4698 | sdp_p->debug_str); |
| 4699 | sdp_p->conf_p->num_invalid_param++; |
| 4700 | |
| 4701 | return SDP_INVALID_PARAMETER; |
| 4702 | } |
| 4703 | } |
| 4704 | |
| 4705 | /* Read feedback type */ |
| 4706 | i = find_token_enum("rtcp-fb attribute", sdp_p, &ptr, sdp_rtcp_fb_type_val, |
| 4707 | SDP_MAX_RTCP_FB, SDP_RTCP_FB_UNKNOWN); |
| 4708 | if (i < 0) { |
| 4709 | sdp_parse_error(sdp_p, |
| 4710 | "%s Warning: could not parse feedback type for rtcp-fb attribute", |
| 4711 | sdp_p->debug_str); |
| 4712 | sdp_p->conf_p->num_invalid_param++; |
| 4713 | return SDP_INVALID_PARAMETER; |
| 4714 | } |
| 4715 | rtcp_fb_p->feedback_type = (sdp_rtcp_fb_type_e) i; |
| 4716 | |
| 4717 | switch(rtcp_fb_p->feedback_type) { |
| 4718 | case SDP_RTCP_FB_ACK: |
| 4719 | i = find_token_enum("rtcp-fb ack type", sdp_p, &ptr, |
| 4720 | sdp_rtcp_fb_ack_type_val, |
| 4721 | SDP_MAX_RTCP_FB_ACK, SDP_RTCP_FB_ACK_UNKNOWN); |
| 4722 | if (i < 0) { |
| 4723 | sdp_parse_error(sdp_p, |
| 4724 | "%s Warning: could not parse ack type for rtcp-fb attribute", |
| 4725 | sdp_p->debug_str); |
| 4726 | sdp_p->conf_p->num_invalid_param++; |
| 4727 | return SDP_INVALID_PARAMETER; |
| 4728 | } |
| 4729 | rtcp_fb_p->param.ack = (sdp_rtcp_fb_ack_type_e) i; |
| 4730 | break; |
| 4731 | |
| 4732 | case SDP_RTCP_FB_CCM: |
| 4733 | i = find_token_enum("rtcp-fb ccm type", sdp_p, &ptr, |
| 4734 | sdp_rtcp_fb_ccm_type_val, |
| 4735 | SDP_MAX_RTCP_FB_CCM, SDP_RTCP_FB_CCM_UNKNOWN); |
| 4736 | if (i < 0) { |
| 4737 | sdp_parse_error(sdp_p, |
| 4738 | "%s Warning: could not parse ccm type for rtcp-fb attribute", |
| 4739 | sdp_p->debug_str); |
| 4740 | sdp_p->conf_p->num_invalid_param++; |
| 4741 | return SDP_INVALID_PARAMETER; |
| 4742 | } |
| 4743 | rtcp_fb_p->param.ccm = (sdp_rtcp_fb_ccm_type_e) i; |
| 4744 | |
| 4745 | /* TODO -- We don't currently parse tmmbr parameters or vbcm |
| 4746 | submessage types. If we decide to support these modes of |
| 4747 | operation, we probably want to add parsing code for them. |
| 4748 | For the time being, they'll just end up parsed into "extra" |
| 4749 | Bug 1097169. |
| 4750 | */ |
| 4751 | break; |
| 4752 | |
| 4753 | case SDP_RTCP_FB_NACK: |
| 4754 | /* Skip any remaining WS -- see |
| 4755 | http://code.google.com/p/webrtc/issues/detail?id=1922 */ |
| 4756 | while (*ptr == ' ' || *ptr == '\t') { |
| 4757 | ptr++; |
| 4758 | } |
| 4759 | /* Check for empty string */ |
| 4760 | if (*ptr == '\r' || *ptr == '\n') { |
| 4761 | rtcp_fb_p->param.nack = SDP_RTCP_FB_NACK_BASIC; |
| 4762 | break; |
| 4763 | } |
| 4764 | i = find_token_enum("rtcp-fb nack type", sdp_p, &ptr, |
| 4765 | sdp_rtcp_fb_nack_type_val, |
| 4766 | SDP_MAX_RTCP_FB_NACK, SDP_RTCP_FB_NACK_UNKNOWN); |
| 4767 | if (i < 0) { |
| 4768 | sdp_parse_error(sdp_p, |
| 4769 | "%s Warning: could not parse nack type for rtcp-fb attribute", |
| 4770 | sdp_p->debug_str); |
| 4771 | sdp_p->conf_p->num_invalid_param++; |
| 4772 | return SDP_INVALID_PARAMETER; |
| 4773 | } |
| 4774 | rtcp_fb_p->param.nack = (sdp_rtcp_fb_nack_type_e) i; |
| 4775 | break; |
| 4776 | |
| 4777 | case SDP_RTCP_FB_TRR_INT: |
| 4778 | rtcp_fb_p->param.trr_int = sdp_getnextnumtok(ptr, &ptr, |
| 4779 | " \t", &result); |
| 4780 | if (result != SDP_SUCCESS) { |
| 4781 | sdp_parse_error(sdp_p, |
| 4782 | "%s Warning: could not parse trr-int value for rtcp-fb " |
| 4783 | "attribute", sdp_p->debug_str); |
| 4784 | sdp_p->conf_p->num_invalid_param++; |
| 4785 | return SDP_INVALID_PARAMETER; |
| 4786 | } |
| 4787 | break; |
| 4788 | |
| 4789 | case SDP_RTCP_FB_REMB: |
| 4790 | /* No additional tokens to parse after goog-remb */ |
| 4791 | break; |
| 4792 | |
| 4793 | case SDP_RTCP_FB_TRANSPORT_CC: |
| 4794 | /* No additional tokens to parse after transport-cc */ |
| 4795 | break; |
| 4796 | |
| 4797 | case SDP_RTCP_FB_UNKNOWN: |
| 4798 | /* Handled by "extra", below */ |
| 4799 | break; |
| 4800 | |
| 4801 | default: |
| 4802 | /* This is an internal error, not a parsing error */ |
| 4803 | SDPLogError(logTag, "%s Error: Invalid rtcp-fb enum (%d)",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 4804, logTag, "%s Error: Invalid rtcp-fb enum (%d)", sdp_p-> debug_str, attr_p->attr.rtcp_fb.feedback_type) |
| 4804 | sdp_p->debug_str, attr_p->attr.rtcp_fb.feedback_type)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 4804, logTag, "%s Error: Invalid rtcp-fb enum (%d)", sdp_p-> debug_str, attr_p->attr.rtcp_fb.feedback_type); |
| 4805 | return SDP_FAILURE; |
| 4806 | } |
| 4807 | |
| 4808 | /* Skip any remaining WS */ |
| 4809 | while (*ptr == ' ' || *ptr == '\t') { |
| 4810 | ptr++; |
| 4811 | } |
| 4812 | |
| 4813 | /* Just store the rest of the line in "extra" -- this will return |
| 4814 | a failure result if there is no more text, but that's fine. */ |
| 4815 | ptr = sdp_getnextstrtok(ptr, rtcp_fb_p->extra, |
| 4816 | sizeof(rtcp_fb_p->extra), "\r\n", &result); |
| 4817 | |
| 4818 | return SDP_SUCCESS; |
| 4819 | } |
| 4820 | |
| 4821 | sdp_result_e sdp_build_attr_setup(sdp_t *sdp_p, |
| 4822 | sdp_attr_t *attr_p, |
| 4823 | flex_string *fs) |
| 4824 | { |
| 4825 | switch (attr_p->attr.setup) { |
| 4826 | case SDP_SETUP_ACTIVE: |
| 4827 | case SDP_SETUP_PASSIVE: |
| 4828 | case SDP_SETUP_ACTPASS: |
| 4829 | case SDP_SETUP_HOLDCONN: |
| 4830 | flex_string_sprintf(fs, "a=%s:%s\r\n", |
| 4831 | sdp_attr[attr_p->type].name, |
| 4832 | sdp_setup_type_val[attr_p->attr.setup].name); |
| 4833 | break; |
| 4834 | default: |
| 4835 | SDPLogError(logTag, "%s Error: Invalid setup enum (%d)",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 4836, logTag, "%s Error: Invalid setup enum (%d)", sdp_p-> debug_str, attr_p->attr.setup) |
| 4836 | sdp_p->debug_str, attr_p->attr.setup)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 4836, logTag, "%s Error: Invalid setup enum (%d)", sdp_p-> debug_str, attr_p->attr.setup); |
| 4837 | return SDP_FAILURE; |
| 4838 | } |
| 4839 | |
| 4840 | return SDP_SUCCESS; |
| 4841 | } |
| 4842 | |
| 4843 | sdp_result_e sdp_parse_attr_setup(sdp_t *sdp_p, |
| 4844 | sdp_attr_t *attr_p, |
| 4845 | const char *ptr) |
| 4846 | { |
| 4847 | int i = find_token_enum("setup attribute", sdp_p, &ptr, |
| 4848 | sdp_setup_type_val, |
| 4849 | SDP_MAX_SETUP, SDP_SETUP_UNKNOWN); |
| 4850 | |
| 4851 | if (i < 0) { |
| 4852 | sdp_parse_error(sdp_p, |
| 4853 | "%s Warning: could not parse setup attribute", |
| 4854 | sdp_p->debug_str); |
| 4855 | sdp_p->conf_p->num_invalid_param++; |
| 4856 | return SDP_INVALID_PARAMETER; |
| 4857 | } |
| 4858 | |
| 4859 | attr_p->attr.setup = (sdp_setup_type_e) i; |
| 4860 | |
| 4861 | switch (attr_p->attr.setup) { |
| 4862 | case SDP_SETUP_ACTIVE: |
| 4863 | case SDP_SETUP_PASSIVE: |
| 4864 | case SDP_SETUP_ACTPASS: |
| 4865 | case SDP_SETUP_HOLDCONN: |
| 4866 | /* All these values are OK */ |
| 4867 | break; |
| 4868 | case SDP_SETUP_UNKNOWN: |
| 4869 | sdp_parse_error(sdp_p, |
| 4870 | "%s Warning: Unknown setup attribute", |
| 4871 | sdp_p->debug_str); |
| 4872 | return SDP_INVALID_PARAMETER; |
| 4873 | default: |
| 4874 | /* This is an internal error, not a parsing error */ |
| 4875 | SDPLogError(logTag, "%s Error: Invalid setup enum (%d)",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 4876, logTag, "%s Error: Invalid setup enum (%d)", sdp_p-> debug_str, attr_p->attr.setup) |
| 4876 | sdp_p->debug_str, attr_p->attr.setup)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 4876, logTag, "%s Error: Invalid setup enum (%d)", sdp_p-> debug_str, attr_p->attr.setup); |
| 4877 | return SDP_FAILURE; |
| 4878 | } |
| 4879 | |
| 4880 | return SDP_SUCCESS; |
| 4881 | } |
| 4882 | |
| 4883 | sdp_result_e sdp_build_attr_connection(sdp_t *sdp_p, |
| 4884 | sdp_attr_t *attr_p, |
| 4885 | flex_string *fs) |
| 4886 | { |
| 4887 | switch (attr_p->attr.connection) { |
| 4888 | case SDP_CONNECTION_NEW: |
| 4889 | case SDP_CONNECTION_EXISTING: |
| 4890 | flex_string_sprintf(fs, "a=%s:%s\r\n", |
| 4891 | sdp_attr[attr_p->type].name, |
| 4892 | sdp_connection_type_val[attr_p->attr.connection].name); |
| 4893 | break; |
| 4894 | default: |
| 4895 | SDPLogError(logTag, "%s Error: Invalid connection enum (%d)",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 4896, logTag, "%s Error: Invalid connection enum (%d)", sdp_p ->debug_str, attr_p->attr.connection) |
| 4896 | sdp_p->debug_str, attr_p->attr.connection)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 4896, logTag, "%s Error: Invalid connection enum (%d)", sdp_p ->debug_str, attr_p->attr.connection); |
| 4897 | return SDP_FAILURE; |
| 4898 | } |
| 4899 | |
| 4900 | return SDP_SUCCESS; |
| 4901 | } |
| 4902 | |
| 4903 | sdp_result_e sdp_parse_attr_connection(sdp_t *sdp_p, |
| 4904 | sdp_attr_t *attr_p, |
| 4905 | const char *ptr) |
| 4906 | { |
| 4907 | int i = find_token_enum("connection attribute", sdp_p, &ptr, |
| 4908 | sdp_connection_type_val, |
| 4909 | SDP_MAX_CONNECTION, SDP_CONNECTION_UNKNOWN); |
| 4910 | |
| 4911 | if (i < 0) { |
| 4912 | sdp_parse_error(sdp_p, |
| 4913 | "%s Warning: could not parse connection attribute", |
| 4914 | sdp_p->debug_str); |
| 4915 | sdp_p->conf_p->num_invalid_param++; |
| 4916 | return SDP_INVALID_PARAMETER; |
| 4917 | } |
| 4918 | |
| 4919 | attr_p->attr.connection = (sdp_connection_type_e) i; |
| 4920 | |
| 4921 | switch (attr_p->attr.connection) { |
| 4922 | case SDP_CONNECTION_NEW: |
| 4923 | case SDP_CONNECTION_EXISTING: |
| 4924 | /* All these values are OK */ |
| 4925 | break; |
| 4926 | case SDP_CONNECTION_UNKNOWN: |
| 4927 | sdp_parse_error(sdp_p, |
| 4928 | "%s Warning: Unknown connection attribute", |
| 4929 | sdp_p->debug_str); |
| 4930 | return SDP_INVALID_PARAMETER; |
| 4931 | default: |
| 4932 | /* This is an internal error, not a parsing error */ |
| 4933 | SDPLogError(logTag, "%s Error: Invalid connection enum (%d)",SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 4934, logTag, "%s Error: Invalid connection enum (%d)", sdp_p ->debug_str, attr_p->attr.connection) |
| 4934 | sdp_p->debug_str, attr_p->attr.connection)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 4934, logTag, "%s Error: Invalid connection enum (%d)", sdp_p ->debug_str, attr_p->attr.connection); |
| 4935 | return SDP_FAILURE; |
| 4936 | } |
| 4937 | return SDP_SUCCESS; |
| 4938 | } |
| 4939 | |
| 4940 | sdp_result_e sdp_build_attr_extmap(sdp_t *sdp_p, |
| 4941 | sdp_attr_t *attr_p, |
| 4942 | flex_string *fs) |
| 4943 | { |
| 4944 | flex_string_sprintf(fs, "a=extmap:%d %s\r\n", |
| 4945 | attr_p->attr.extmap.id, |
| 4946 | attr_p->attr.extmap.uri); |
| 4947 | |
| 4948 | return SDP_SUCCESS; |
| 4949 | } |
| 4950 | |
| 4951 | sdp_result_e sdp_parse_attr_extmap(sdp_t *sdp_p, |
| 4952 | sdp_attr_t *attr_p, |
| 4953 | const char *ptr) |
| 4954 | { |
| 4955 | sdp_result_e result; |
| 4956 | |
| 4957 | attr_p->attr.extmap.id = 0; |
| 4958 | attr_p->attr.extmap.media_direction = SDP_DIRECTION_SENDRECV; |
| 4959 | attr_p->attr.extmap.media_direction_specified = FALSE0; |
| 4960 | attr_p->attr.extmap.uri[0] = '\0'; |
| 4961 | attr_p->attr.extmap.extension_attributes[0] = '\0'; |
| 4962 | |
| 4963 | /* Find the payload type number. */ |
| 4964 | attr_p->attr.extmap.id = |
| 4965 | (uint16_t)sdp_getnextnumtok(ptr, &ptr, "/ \t", &result); |
| 4966 | if (result != SDP_SUCCESS) { |
| 4967 | sdp_parse_error(sdp_p, |
| 4968 | "%s Warning: Invalid extmap id specified for %s attribute.", |
| 4969 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type)); |
| 4970 | sdp_p->conf_p->num_invalid_param++; |
| 4971 | return (SDP_INVALID_PARAMETER); |
| 4972 | } |
| 4973 | |
| 4974 | if (*ptr == '/') { |
| 4975 | char direction[SDP_MAX_STRING_LEN256+1]; |
| 4976 | ++ptr; /* Skip over '/' */ |
| 4977 | ptr = sdp_getnextstrtok(ptr, direction, |
| 4978 | sizeof(direction), " \t", &result); |
| 4979 | if (result != SDP_SUCCESS) { |
| 4980 | sdp_parse_error(sdp_p, |
| 4981 | "%s Warning: Invalid direction specified in %s attribute.", |
| 4982 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type)); |
| 4983 | sdp_p->conf_p->num_invalid_param++; |
| 4984 | return (SDP_INVALID_PARAMETER); |
| 4985 | } |
| 4986 | |
| 4987 | if (!cpr_strcasecmpstrcasecmp(direction, "sendrecv")) { |
| 4988 | attr_p->attr.extmap.media_direction = SDP_DIRECTION_SENDRECV; |
| 4989 | } else if (!cpr_strcasecmpstrcasecmp(direction, "sendonly")) { |
| 4990 | attr_p->attr.extmap.media_direction = SDP_DIRECTION_SENDONLY; |
| 4991 | } else if (!cpr_strcasecmpstrcasecmp(direction, "recvonly")) { |
| 4992 | attr_p->attr.extmap.media_direction = SDP_DIRECTION_RECVONLY; |
| 4993 | } else if (!cpr_strcasecmpstrcasecmp(direction, "inactive")) { |
| 4994 | attr_p->attr.extmap.media_direction = SDP_DIRECTION_INACTIVE; |
| 4995 | } else { |
| 4996 | sdp_parse_error(sdp_p, |
| 4997 | "%s Warning: Invalid direction specified in %s attribute.", |
| 4998 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type)); |
| 4999 | sdp_p->conf_p->num_invalid_param++; |
| 5000 | return (SDP_INVALID_PARAMETER); |
| 5001 | } |
| 5002 | attr_p->attr.extmap.media_direction_specified = TRUE1; |
| 5003 | } |
| 5004 | |
| 5005 | ptr = sdp_getnextstrtok(ptr, attr_p->attr.extmap.uri, |
| 5006 | sizeof(attr_p->attr.extmap.uri), " \t", &result); |
| 5007 | if (result != SDP_SUCCESS) { |
| 5008 | sdp_parse_error(sdp_p, |
| 5009 | "%s Warning: No uri specified in %s attribute.", |
| 5010 | sdp_p->debug_str, sdp_get_attr_name(attr_p->type)); |
| 5011 | sdp_p->conf_p->num_invalid_param++; |
| 5012 | return (SDP_INVALID_PARAMETER); |
| 5013 | } |
| 5014 | |
| 5015 | while (*ptr == ' ' || *ptr == '\t') { |
| 5016 | ++ptr; |
| 5017 | } |
| 5018 | |
| 5019 | /* Grab everything that follows, even if it contains whitespace */ |
| 5020 | ptr = sdp_getnextstrtok(ptr, attr_p->attr.extmap.extension_attributes, |
| 5021 | sizeof(attr_p->attr.extmap.extension_attributes), "\r\n", &result); |
| 5022 | |
| 5023 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 5024 | SDP_PRINT("%s Parsed a=%s, id %u, direction %s, "SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 5030, "sdp", "%s Parsed a=%s, id %u, direction %s, " "uri %s, extension %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.extmap.id, (((sdp_direction_e)(attr_p->attr.extmap .media_direction)) == SDP_DIRECTION_INACTIVE ? "SDP_DIRECTION_INACTIVE " : ((sdp_direction_e)(attr_p->attr.extmap.media_direction) ) == SDP_DIRECTION_SENDONLY ? "SDP_DIRECTION_SENDONLY": ((sdp_direction_e )(attr_p->attr.extmap.media_direction)) == SDP_DIRECTION_RECVONLY ? "SDP_DIRECTION_RECVONLY ": ((sdp_direction_e)(attr_p->attr .extmap.media_direction)) == SDP_DIRECTION_SENDRECV ? " SDP_DIRECTION_SENDRECV" : "SDP_MAX_QOS_DIRECTIONS"), attr_p->attr.extmap.uri, attr_p ->attr.extmap.extension_attributes) |
| 5025 | "uri %s, extension %s", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 5030, "sdp", "%s Parsed a=%s, id %u, direction %s, " "uri %s, extension %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.extmap.id, (((sdp_direction_e)(attr_p->attr.extmap .media_direction)) == SDP_DIRECTION_INACTIVE ? "SDP_DIRECTION_INACTIVE " : ((sdp_direction_e)(attr_p->attr.extmap.media_direction) ) == SDP_DIRECTION_SENDONLY ? "SDP_DIRECTION_SENDONLY": ((sdp_direction_e )(attr_p->attr.extmap.media_direction)) == SDP_DIRECTION_RECVONLY ? "SDP_DIRECTION_RECVONLY ": ((sdp_direction_e)(attr_p->attr .extmap.media_direction)) == SDP_DIRECTION_SENDRECV ? " SDP_DIRECTION_SENDRECV" : "SDP_MAX_QOS_DIRECTIONS"), attr_p->attr.extmap.uri, attr_p ->attr.extmap.extension_attributes) |
| 5026 | sdp_get_attr_name(attr_p->type),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 5030, "sdp", "%s Parsed a=%s, id %u, direction %s, " "uri %s, extension %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.extmap.id, (((sdp_direction_e)(attr_p->attr.extmap .media_direction)) == SDP_DIRECTION_INACTIVE ? "SDP_DIRECTION_INACTIVE " : ((sdp_direction_e)(attr_p->attr.extmap.media_direction) ) == SDP_DIRECTION_SENDONLY ? "SDP_DIRECTION_SENDONLY": ((sdp_direction_e )(attr_p->attr.extmap.media_direction)) == SDP_DIRECTION_RECVONLY ? "SDP_DIRECTION_RECVONLY ": ((sdp_direction_e)(attr_p->attr .extmap.media_direction)) == SDP_DIRECTION_SENDRECV ? " SDP_DIRECTION_SENDRECV" : "SDP_MAX_QOS_DIRECTIONS"), attr_p->attr.extmap.uri, attr_p ->attr.extmap.extension_attributes) |
| 5027 | attr_p->attr.extmap.id,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 5030, "sdp", "%s Parsed a=%s, id %u, direction %s, " "uri %s, extension %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.extmap.id, (((sdp_direction_e)(attr_p->attr.extmap .media_direction)) == SDP_DIRECTION_INACTIVE ? "SDP_DIRECTION_INACTIVE " : ((sdp_direction_e)(attr_p->attr.extmap.media_direction) ) == SDP_DIRECTION_SENDONLY ? "SDP_DIRECTION_SENDONLY": ((sdp_direction_e )(attr_p->attr.extmap.media_direction)) == SDP_DIRECTION_RECVONLY ? "SDP_DIRECTION_RECVONLY ": ((sdp_direction_e)(attr_p->attr .extmap.media_direction)) == SDP_DIRECTION_SENDRECV ? " SDP_DIRECTION_SENDRECV" : "SDP_MAX_QOS_DIRECTIONS"), attr_p->attr.extmap.uri, attr_p ->attr.extmap.extension_attributes) |
| 5028 | SDP_DIRECTION_PRINT(attr_p->attr.extmap.media_direction),SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 5030, "sdp", "%s Parsed a=%s, id %u, direction %s, " "uri %s, extension %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.extmap.id, (((sdp_direction_e)(attr_p->attr.extmap .media_direction)) == SDP_DIRECTION_INACTIVE ? "SDP_DIRECTION_INACTIVE " : ((sdp_direction_e)(attr_p->attr.extmap.media_direction) ) == SDP_DIRECTION_SENDONLY ? "SDP_DIRECTION_SENDONLY": ((sdp_direction_e )(attr_p->attr.extmap.media_direction)) == SDP_DIRECTION_RECVONLY ? "SDP_DIRECTION_RECVONLY ": ((sdp_direction_e)(attr_p->attr .extmap.media_direction)) == SDP_DIRECTION_SENDRECV ? " SDP_DIRECTION_SENDRECV" : "SDP_MAX_QOS_DIRECTIONS"), attr_p->attr.extmap.uri, attr_p ->attr.extmap.extension_attributes) |
| 5029 | attr_p->attr.extmap.uri,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 5030, "sdp", "%s Parsed a=%s, id %u, direction %s, " "uri %s, extension %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.extmap.id, (((sdp_direction_e)(attr_p->attr.extmap .media_direction)) == SDP_DIRECTION_INACTIVE ? "SDP_DIRECTION_INACTIVE " : ((sdp_direction_e)(attr_p->attr.extmap.media_direction) ) == SDP_DIRECTION_SENDONLY ? "SDP_DIRECTION_SENDONLY": ((sdp_direction_e )(attr_p->attr.extmap.media_direction)) == SDP_DIRECTION_RECVONLY ? "SDP_DIRECTION_RECVONLY ": ((sdp_direction_e)(attr_p->attr .extmap.media_direction)) == SDP_DIRECTION_SENDRECV ? " SDP_DIRECTION_SENDRECV" : "SDP_MAX_QOS_DIRECTIONS"), attr_p->attr.extmap.uri, attr_p ->attr.extmap.extension_attributes) |
| 5030 | attr_p->attr.extmap.extension_attributes)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 5030, "sdp", "%s Parsed a=%s, id %u, direction %s, " "uri %s, extension %s" , sdp_p->debug_str, sdp_get_attr_name(attr_p->type), attr_p ->attr.extmap.id, (((sdp_direction_e)(attr_p->attr.extmap .media_direction)) == SDP_DIRECTION_INACTIVE ? "SDP_DIRECTION_INACTIVE " : ((sdp_direction_e)(attr_p->attr.extmap.media_direction) ) == SDP_DIRECTION_SENDONLY ? "SDP_DIRECTION_SENDONLY": ((sdp_direction_e )(attr_p->attr.extmap.media_direction)) == SDP_DIRECTION_RECVONLY ? "SDP_DIRECTION_RECVONLY ": ((sdp_direction_e)(attr_p->attr .extmap.media_direction)) == SDP_DIRECTION_SENDRECV ? " SDP_DIRECTION_SENDRECV" : "SDP_MAX_QOS_DIRECTIONS"), attr_p->attr.extmap.uri, attr_p ->attr.extmap.extension_attributes); |
| 5031 | } |
| 5032 | |
| 5033 | return (SDP_SUCCESS); |
| 5034 | } |
| 5035 | |
| 5036 | sdp_result_e sdp_parse_attr_msid(sdp_t *sdp_p, |
| 5037 | sdp_attr_t *attr_p, |
| 5038 | const char *ptr) |
| 5039 | { |
| 5040 | sdp_result_e result; |
| 5041 | |
| 5042 | ptr = sdp_getnextstrtok(ptr, attr_p->attr.msid.identifier, |
| 5043 | sizeof(attr_p->attr.msid.identifier), " \t", &result); |
| 5044 | if (result != SDP_SUCCESS) { |
| 5045 | sdp_parse_error(sdp_p, "%s Warning: Bad msid identity value", |
| 5046 | sdp_p->debug_str); |
| 5047 | sdp_p->conf_p->num_invalid_param++; |
| 5048 | return SDP_INVALID_PARAMETER; |
| 5049 | } |
| 5050 | |
| 5051 | ptr = sdp_getnextstrtok(ptr, attr_p->attr.msid.appdata, |
| 5052 | sizeof(attr_p->attr.msid.appdata), " \t", &result); |
| 5053 | if ((result != SDP_SUCCESS) && (result != SDP_EMPTY_TOKEN)) { |
| 5054 | sdp_parse_error(sdp_p, "%s Warning: Bad msid appdata value", |
| 5055 | sdp_p->debug_str); |
| 5056 | sdp_p->conf_p->num_invalid_param++; |
| 5057 | return SDP_INVALID_PARAMETER; |
| 5058 | } |
| 5059 | if (result == SDP_EMPTY_TOKEN) { |
| 5060 | attr_p->attr.msid.appdata[0] = '\0'; |
| 5061 | } |
| 5062 | |
| 5063 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 5064 | SDP_PRINT("%s Parsed a=msid, %s %s", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 5065, "sdp", "%s Parsed a=msid, %s %s", sdp_p->debug_str , attr_p->attr.msid.identifier, attr_p->attr.msid.appdata ) |
| 5065 | attr_p->attr.msid.identifier, attr_p->attr.msid.appdata)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 5065, "sdp", "%s Parsed a=msid, %s %s", sdp_p->debug_str , attr_p->attr.msid.identifier, attr_p->attr.msid.appdata ); |
| 5066 | } |
| 5067 | |
| 5068 | return SDP_SUCCESS; |
| 5069 | } |
| 5070 | |
| 5071 | |
| 5072 | sdp_result_e sdp_build_attr_msid(sdp_t *sdp_p, |
| 5073 | sdp_attr_t *attr_p, |
| 5074 | flex_string *fs) |
| 5075 | { |
| 5076 | flex_string_sprintf(fs, "a=msid:%s%s%s\r\n", |
| 5077 | attr_p->attr.msid.identifier, |
| 5078 | attr_p->attr.msid.appdata[0] ? " " : "", |
| 5079 | attr_p->attr.msid.appdata); |
| 5080 | return SDP_SUCCESS; |
| 5081 | } |
| 5082 | |
| 5083 | sdp_result_e sdp_parse_attr_msid_semantic(sdp_t *sdp_p, |
| 5084 | sdp_attr_t *attr_p, |
| 5085 | const char *ptr) |
| 5086 | { |
| 5087 | sdp_result_e result; |
| 5088 | int i; |
| 5089 | |
| 5090 | ptr = sdp_getnextstrtok(ptr, |
| 5091 | attr_p->attr.msid_semantic.semantic, |
| 5092 | sizeof(attr_p->attr.msid_semantic.semantic), |
| 5093 | " \t", |
| 5094 | &result); |
| 5095 | |
| 5096 | if (result != SDP_SUCCESS) { |
| 5097 | sdp_parse_error(sdp_p, "%s Warning: Bad msid-semantic attribute; " |
| 5098 | "missing semantic", |
| 5099 | sdp_p->debug_str); |
| 5100 | sdp_p->conf_p->num_invalid_param++; |
| 5101 | return SDP_INVALID_PARAMETER; |
| 5102 | } |
| 5103 | |
| 5104 | for (i = 0; i < SDP_MAX_MEDIA_STREAMS128; ++i) { |
| 5105 | /* msid-id can be up to 64 characters long, plus null terminator */ |
| 5106 | char temp[65]; |
| 5107 | ptr = sdp_getnextstrtok(ptr, temp, sizeof(temp), " \t", &result); |
| 5108 | |
| 5109 | if (result != SDP_SUCCESS) { |
| 5110 | break; |
| 5111 | } |
| 5112 | |
| 5113 | attr_p->attr.msid_semantic.msids[i] = cpr_strdup(temp); |
| 5114 | } |
| 5115 | |
| 5116 | if ((result != SDP_SUCCESS) && (result != SDP_EMPTY_TOKEN)) { |
| 5117 | sdp_parse_error(sdp_p, "%s Warning: Bad msid-semantic attribute", |
| 5118 | sdp_p->debug_str); |
| 5119 | sdp_p->conf_p->num_invalid_param++; |
| 5120 | return SDP_INVALID_PARAMETER; |
| 5121 | } |
| 5122 | |
| 5123 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 5124 | SDP_PRINT("%s Parsed a=msid-semantic, %s", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 5125, "sdp", "%s Parsed a=msid-semantic, %s", sdp_p->debug_str , attr_p->attr.msid_semantic.semantic) |
| 5125 | attr_p->attr.msid_semantic.semantic)SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 5125, "sdp", "%s Parsed a=msid-semantic, %s", sdp_p->debug_str , attr_p->attr.msid_semantic.semantic); |
| 5126 | for (i = 0; i < SDP_MAX_MEDIA_STREAMS128; ++i) { |
| 5127 | if (!attr_p->attr.msid_semantic.msids[i]) { |
| 5128 | break; |
| 5129 | } |
| 5130 | |
| 5131 | SDP_PRINT("%s ... msid %s", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 5132, "sdp", "%s ... msid %s", sdp_p->debug_str, attr_p-> attr.msid_semantic.msids[i]) |
| 5132 | attr_p->attr.msid_semantic.msids[i])SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 5132, "sdp", "%s ... msid %s", sdp_p->debug_str, attr_p-> attr.msid_semantic.msids[i]); |
| 5133 | } |
| 5134 | } |
| 5135 | |
| 5136 | return SDP_SUCCESS; |
| 5137 | } |
| 5138 | |
| 5139 | |
| 5140 | sdp_result_e sdp_build_attr_msid_semantic(sdp_t *sdp_p, |
| 5141 | sdp_attr_t *attr_p, |
| 5142 | flex_string *fs) |
| 5143 | { |
| 5144 | int i; |
| 5145 | flex_string_sprintf(fs, "a=msid-semantic:%s", |
| 5146 | attr_p->attr.msid_semantic.semantic); |
| 5147 | for (i = 0; i < SDP_MAX_MEDIA_STREAMS128; ++i) { |
| 5148 | if (!attr_p->attr.msid_semantic.msids[i]) { |
| 5149 | break; |
| 5150 | } |
| 5151 | |
| 5152 | flex_string_sprintf(fs, " %s", |
| 5153 | attr_p->attr.msid_semantic.msids[i]); |
| 5154 | } |
| 5155 | flex_string_sprintf(fs, "\r\n"); |
| 5156 | return SDP_SUCCESS; |
| 5157 | } |
| 5158 | |
| 5159 | sdp_result_e sdp_parse_attr_ssrc(sdp_t *sdp_p, |
| 5160 | sdp_attr_t *attr_p, |
| 5161 | const char *ptr) |
| 5162 | { |
| 5163 | sdp_result_e result; |
| 5164 | |
| 5165 | attr_p->attr.ssrc.ssrc = |
| 5166 | (uint32_t)sdp_getnextnumtok(ptr, &ptr, " \t", &result); |
| 5167 | |
| 5168 | if (result != SDP_SUCCESS) { |
| 5169 | sdp_parse_error(sdp_p, "%s Warning: Bad ssrc attribute, cannot parse ssrc", |
| 5170 | sdp_p->debug_str); |
| 5171 | sdp_p->conf_p->num_invalid_param++; |
| 5172 | return SDP_INVALID_PARAMETER; |
| 5173 | } |
| 5174 | |
| 5175 | /* Skip any remaining WS */ |
| 5176 | while (*ptr == ' ' || *ptr == '\t') { |
| 5177 | ptr++; |
| 5178 | } |
| 5179 | |
| 5180 | /* Just store the rest of the line in "attribute" -- this will return |
| 5181 | a failure result if there is no more text, but that's fine. */ |
| 5182 | ptr = sdp_getnextstrtok(ptr, |
| 5183 | attr_p->attr.ssrc.attribute, |
| 5184 | sizeof(attr_p->attr.ssrc.attribute), |
| 5185 | "\r\n", |
| 5186 | &result); |
| 5187 | |
| 5188 | return SDP_SUCCESS; |
| 5189 | } |
| 5190 | |
| 5191 | |
| 5192 | sdp_result_e sdp_build_attr_ssrc(sdp_t *sdp_p, |
| 5193 | sdp_attr_t *attr_p, |
| 5194 | flex_string *fs) |
| 5195 | { |
| 5196 | flex_string_sprintf(fs, "a=ssrc:%s%s%s\r\n", |
| 5197 | attr_p->attr.ssrc.ssrc, |
| 5198 | attr_p->attr.ssrc.attribute[0] ? " " : "", |
| 5199 | attr_p->attr.ssrc.attribute); |
| 5200 | return SDP_SUCCESS; |
| 5201 | } |
| 5202 | |
| 5203 | |
| 5204 | sdp_result_e sdp_parse_attr_ssrc_group(sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 5205 | const char *ptr) |
| 5206 | { |
| 5207 | sdp_result_e result; |
| 5208 | char tmp[SDP_MAX_STRING_LEN256 + 1]; |
| 5209 | int i; |
| 5210 | |
| 5211 | /* Find the a=ssrc-group:<semantic> <ssrc1> <ssrc2> ... values */ |
| 5212 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 5213 | if (result != SDP_SUCCESS) { |
| 5214 | sdp_parse_error(sdp_p, |
| 5215 | "%s Warning: No semantic attribute value specified for " |
| 5216 | "a=ssrc-group line", |
| 5217 | sdp_p->debug_str); |
| 5218 | sdp_p->conf_p->num_invalid_param++; |
| 5219 | return (SDP_INVALID_PARAMETER); |
| 5220 | } |
| 5221 | |
| 5222 | attr_p->attr.ssrc_group.semantic = SDP_SSRC_GROUP_ATTR_UNSUPPORTED; |
| 5223 | for (i = 0; i < SDP_MAX_SSRC_GROUP_ATTR_VAL; i++) { |
| 5224 | if (cpr_strncasecmpstrncasecmp(tmp, sdp_ssrc_group_attr_val[i].name, |
| 5225 | sdp_ssrc_group_attr_val[i].strlen) == 0) { |
| 5226 | attr_p->attr.ssrc_group.semantic = (sdp_ssrc_group_attr_e)i; |
| 5227 | break; |
| 5228 | } |
| 5229 | } |
| 5230 | |
| 5231 | if (attr_p->attr.ssrc_group.semantic == SDP_SSRC_GROUP_ATTR_UNSUPPORTED) { |
| 5232 | sdp_parse_error(sdp_p, |
| 5233 | "%s Warning: Ssrc group attribute type unsupported (%s).", |
| 5234 | sdp_p->debug_str, tmp); |
| 5235 | } |
| 5236 | |
| 5237 | for (i = 0; i < SDP_MAX_SSRC_GROUP_SSRCS32; ++i) { |
| 5238 | attr_p->attr.ssrc_group.ssrcs[i] = |
| 5239 | (uint32_t)sdp_getnextnumtok(ptr, &ptr, " \t", &result); |
| 5240 | |
| 5241 | if (result != SDP_SUCCESS) { |
| 5242 | break; |
| 5243 | } |
| 5244 | |
| 5245 | attr_p->attr.ssrc_group.num_ssrcs++; |
| 5246 | } |
| 5247 | |
| 5248 | ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result); |
| 5249 | if (result == SDP_SUCCESS) { |
| 5250 | sdp_parse_error(sdp_p, |
| 5251 | "%s Warning: Trailing tokens while parsing ssrc-group (%s).", |
| 5252 | sdp_p->debug_str, tmp); |
| 5253 | sdp_p->conf_p->num_invalid_param++; |
| 5254 | return (SDP_INVALID_PARAMETER); |
| 5255 | } |
| 5256 | |
| 5257 | if (attr_p->attr.ssrc_group.num_ssrcs == 0) { |
| 5258 | sdp_parse_error(sdp_p, |
| 5259 | "%s Warning: Ssrc group must contain at least one ssrc (%s).", |
| 5260 | sdp_p->debug_str, tmp); |
| 5261 | sdp_p->conf_p->num_invalid_param++; |
| 5262 | return (SDP_INVALID_PARAMETER); |
| 5263 | } |
| 5264 | |
| 5265 | if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) { |
| 5266 | SDP_PRINT("%s Parsed a=ssrc-group, semantic %s", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 5267, "sdp", "%s Parsed a=ssrc-group, semantic %s", sdp_p-> debug_str, sdp_get_ssrc_group_attr_name(attr_p->attr.ssrc_group .semantic)) |
| 5267 | sdp_get_ssrc_group_attr_name(attr_p->attr.ssrc_group.semantic))SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 5267, "sdp", "%s Parsed a=ssrc-group, semantic %s", sdp_p-> debug_str, sdp_get_ssrc_group_attr_name(attr_p->attr.ssrc_group .semantic)); |
| 5268 | for (i = 0; i < attr_p->attr.ssrc_group.num_ssrcs; ++i) { |
| 5269 | SDP_PRINT("%s ... ssrc %u", sdp_p->debug_str,SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 5270, "sdp", "%s ... ssrc %u", sdp_p->debug_str, attr_p-> attr.ssrc_group.ssrcs[i]) |
| 5270 | attr_p->attr.ssrc_group.ssrcs[i])SDPLog(SDP_LOG_ERROR, "/root/firefox-clang/third_party/sipcc/sdp_attr.c" , 5270, "sdp", "%s ... ssrc %u", sdp_p->debug_str, attr_p-> attr.ssrc_group.ssrcs[i]); |
| 5271 | } |
| 5272 | } |
| 5273 | |
| 5274 | return (SDP_SUCCESS); |
| 5275 | } |
| 5276 | |
| 5277 | sdp_result_e sdp_build_attr_ssrc_group(sdp_t *sdp_p, sdp_attr_t *attr_p, |
| 5278 | flex_string *fs) |
| 5279 | { |
| 5280 | int i; |
| 5281 | flex_string_sprintf( |
| 5282 | fs, "a=ssrc-group:%s", |
| 5283 | sdp_get_ssrc_group_attr_name(attr_p->attr.ssrc_group.semantic)); |
| 5284 | |
| 5285 | if (attr_p->attr.ssrc_group.num_ssrcs) { |
| 5286 | return (SDP_FAILURE); |
| 5287 | } |
| 5288 | |
| 5289 | for (i = 0; i < attr_p->attr.ssrc_group.num_ssrcs; ++i) { |
| 5290 | flex_string_sprintf(fs, " %u", attr_p->attr.ssrc_group.ssrcs[i]); |
| 5291 | } |
| 5292 | flex_string_sprintf(fs, "\r\n"); |
| 5293 | return (SDP_SUCCESS); |
| 5294 | } |