- Timestamp:
- Apr 14, 2008 1:48:39 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/ice-turn07/pjnath/include/pjnath/ice_strans.h
r1487 r1926 26 26 */ 27 27 #include <pjnath/ice_session.h> 28 #include <pjnath/turn_sock.h> 28 29 #include <pjlib-util/resolver.h> 29 30 #include <pj/ioqueue.h> … … 92 93 * has completed, either successfully or with failure. 93 94 * 94 * After the ICE stream transport is created, application may set up the95 * STUN servers to be used to obtain STUN server reflexive and relayed96 * candidate, by calling #pj_ice_strans_set_stun_domain() or97 * #pj_ice_strans_set_stun_srv().98 *99 95 * Application then creates each component by calling 100 96 * #pj_ice_strans_create_comp(); this would create an actual socket … … 336 332 pj_uint8_t ka_tsx_id[12]; /**< ID for keep STUN alives */ 337 333 334 pj_turn_sock *turn_relay; /**< TURN relay object. */ 335 338 336 pj_sockaddr local_addr; /**< Local/base address. */ 339 337 … … 356 354 357 355 /** 356 * This structure describes ICE stream transport configuration. 357 */ 358 typedef struct pj_ice_strans_cfg 359 { 360 /** 361 * STUN config. This setting is mandatory. 362 */ 363 pj_stun_config stun_cfg; 364 365 /** 366 * STUN server address, if STUN is enabled. 367 * 368 * Default is to have no TURN server. 369 */ 370 pj_sockaddr stun_srv; 371 372 /** 373 * TURN server address, if TURN is enabled. 374 * 375 * Default is to have no TURN server. 376 */ 377 pj_sockaddr turn_srv; 378 379 /** 380 * Type of connection to the TURN server. 381 * 382 * Default is PJ_TURN_TP_UDP. 383 */ 384 pj_turn_tp_type turn_conn_type; 385 386 /** 387 * Credential to be used for the TURN session. 388 * 389 * Default is to have no credential. 390 */ 391 pj_stun_auth_cred turn_cred; 392 393 /** 394 * Optional TURN Allocate parameter. 395 * 396 * Default is all empty. 397 */ 398 pj_turn_alloc_param turn_alloc_param; 399 400 } pj_ice_strans_cfg; 401 402 403 /** 358 404 * This structure represents the ICE stream transport. 359 405 */ … … 364 410 pj_pool_t *pool; /**< Pool used by this object. */ 365 411 void *user_data; /**< Application data. */ 366 pj_ stun_config stun_cfg; /**< STUN settings. */412 pj_ice_strans_cfg cfg; /**< Configuration. */ 367 413 pj_ice_strans_cb cb; /**< Application callback. */ 368 414 … … 371 417 unsigned comp_cnt; /**< Number of components. */ 372 418 pj_ice_strans_comp **comp; /**< Components array. */ 373 374 pj_dns_resolver *resolver; /**< The resolver instance. */375 pj_bool_t has_rjob; /**< Has pending resolve? */376 pj_sockaddr_in stun_srv; /**< STUN server address. */377 pj_sockaddr_in turn_srv; /**< TURN server address. */378 419 379 420 pj_timer_entry ka_timer; /**< STUN keep-alive timer. */ … … 388 429 * function. 389 430 * 390 * @param stun_cfg The STUN settings.431 * @param cfg Configuration. 391 432 * @param name Optional name for logging identification. 392 433 * @param comp_cnt Number of components. … … 400 441 * successfully. 401 442 */ 402 PJ_DECL(pj_status_t) pj_ice_strans_create( pj_stun_config *stun_cfg,443 PJ_DECL(pj_status_t) pj_ice_strans_create(const pj_ice_strans_cfg *cfg, 403 444 const char *name, 404 445 unsigned comp_cnt, … … 417 458 */ 418 459 PJ_DECL(pj_status_t) pj_ice_strans_destroy(pj_ice_strans *ice_st); 419 420 421 /**422 * Set the domain to be used when resolving the STUN servers. If application423 * wants to utillize STUN, then STUN server must be specified, either by424 * calling this function or by calling #pj_ice_strans_set_stun_srv().425 *426 * If application calls this function, then the STUN/TURN servers will427 * be resolved by querying DNS SRV records for the specified domain.428 *429 * @param ice_st The ICE stream transport.430 * @param resolver The resolver instance that will be used to431 * resolve the STUN/TURN servers.432 * @param domain The target domain.433 *434 * @return PJ_SUCCESS if DNS SRV resolution job can be435 * started. The resolution process itself will436 * complete asynchronously.437 */438 PJ_DECL(pj_status_t) pj_ice_strans_set_stun_domain(pj_ice_strans *ice_st,439 pj_dns_resolver *resolver,440 const pj_str_t *domain);441 442 /**443 * Set the STUN and TURN server addresses. If application444 * wants to utillize STUN, then STUN server must be specified, either by445 * calling this function or by calling #pj_ice_strans_set_stun_domain().446 *447 * With this function, the STUN and TURN server addresses will be448 * assigned immediately, that is no DNS resolution will need to be449 * performed.450 *451 * @param ice_st The ICE stream transport.452 * @param stun_srv The STUN server address, or NULL if STUN453 * reflexive candidate is not to be used.454 * @param turn_srv The TURN server address, or NULL if STUN455 * relay candidate is not to be used.456 *457 * @return PJ_SUCCESS, or the appropriate error code.458 */459 PJ_DECL(pj_status_t)460 pj_ice_strans_set_stun_srv( pj_ice_strans *ice_st,461 const pj_sockaddr_in *stun_srv,462 const pj_sockaddr_in *turn_srv);463 460 464 461 /**
Note: See TracChangeset
for help on using the changeset viewer.