Changeset 1559 for pjproject/trunk
- Timestamp:
- Nov 8, 2007 9:13:34 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/transport_ice.c
r1557 r1559 23 23 #include <pj/rand.h> 24 24 25 #define THIS_FILE "transport_ice.c" 25 26 26 27 struct transport_ice … … 349 350 /* Foundation */ 350 351 token = strtok(input.ptr, " "); 351 if (!token) 352 goto on_return; 352 if (!token) { 353 PJ_LOG(5,(THIS_FILE, "Expecting ICE foundation in candidate")); 354 goto on_return; 355 } 353 356 pj_strdup2(pool, &cand->foundation, token); 354 357 355 358 /* Component ID */ 356 359 token = strtok(NULL, " "); 357 if (!token) 358 goto on_return; 360 if (!token) { 361 PJ_LOG(5,(THIS_FILE, "Expecting ICE component ID in candidate")); 362 goto on_return; 363 } 359 364 cand->comp_id = atoi(token); 360 365 361 366 /* Transport */ 362 367 token = strtok(NULL, " "); 363 if (!token) 364 goto on_return; 365 if (pj_ansi_stricmp(token, "UDP") != 0) 366 goto on_return; 368 if (!token) { 369 PJ_LOG(5,(THIS_FILE, "Expecting ICE transport in candidate")); 370 goto on_return; 371 } 372 if (pj_ansi_stricmp(token, "UDP") != 0) { 373 PJ_LOG(5,(THIS_FILE, 374 "Expecting ICE UDP transport only in candidate")); 375 goto on_return; 376 } 367 377 368 378 /* Priority */ 369 379 token = strtok(NULL, " "); 370 if (!token) 371 goto on_return; 380 if (!token) { 381 PJ_LOG(5,(THIS_FILE, "Expecting ICE priority in candidate")); 382 goto on_return; 383 } 372 384 cand->prio = atoi(token); 373 385 374 386 /* Host */ 375 387 host = strtok(NULL, " "); 376 if (!host) 377 goto on_return; 378 if (pj_sockaddr_in_init(&cand->addr.ipv4, pj_cstr(&s, host), 0)) 379 goto on_return; 388 if (!host) { 389 PJ_LOG(5,(THIS_FILE, "Expecting ICE host in candidate")); 390 goto on_return; 391 } 392 if (pj_sockaddr_in_init(&cand->addr.ipv4, pj_cstr(&s, host), 0)) { 393 PJ_LOG(5,(THIS_FILE, 394 "Expecting ICE IPv4 transport address in candidate")); 395 goto on_return; 396 } 380 397 381 398 /* Port */ 382 399 token = strtok(NULL, " "); 383 if (!token) 384 goto on_return; 400 if (!token) { 401 PJ_LOG(5,(THIS_FILE, "Expecting ICE port number in candidate")); 402 goto on_return; 403 } 385 404 cand->addr.ipv4.sin_port = pj_htons((pj_uint16_t)atoi(token)); 386 405 387 406 /* typ */ 388 407 token = strtok(NULL, " "); 389 if (!token) 390 goto on_return; 391 if (pj_ansi_stricmp(token, "typ") != 0) 392 goto on_return; 408 if (!token) { 409 PJ_LOG(5,(THIS_FILE, "Expecting ICE \"typ\" in candidate")); 410 goto on_return; 411 } 412 if (pj_ansi_stricmp(token, "typ") != 0) { 413 PJ_LOG(5,(THIS_FILE, "Expecting ICE \"typ\" in candidate")); 414 goto on_return; 415 } 393 416 394 417 /* candidate type */ 395 418 token = strtok(NULL, " "); 396 if (!token) 397 goto on_return; 419 if (!token) { 420 PJ_LOG(5,(THIS_FILE, "Expecting ICE candidate type in candidate")); 421 goto on_return; 422 } 398 423 399 424 if (pj_ansi_stricmp(token, "host") == 0) { … … 410 435 411 436 } else { 437 PJ_LOG(5,(THIS_FILE, "Invalid ICE candidate type %s in candidate", 438 token)); 412 439 goto on_return; 413 440 } … … 527 554 /* Parse candidate */ 528 555 status = parse_cand(pool, &attr->value, &cand[cand_cnt]); 529 if (status != PJ_SUCCESS) 530 return status; 556 if (status != PJ_SUCCESS) { 557 PJ_LOG(4,(THIS_FILE, 558 "Error in parsing SDP candidate attribute, " 559 "candidate is ignored")); 560 continue; 561 } 531 562 532 563 /* Check if this candidate is equal to the connection line */
Note: See TracChangeset
for help on using the changeset viewer.