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