Changeset 54 for pjproject/trunk/pjsip/include/pjsip/sip_transport.h
- Timestamp:
- Nov 18, 2005 10:43:42 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsip/sip_transport.h
r51 r54 30 30 #include <pj/list.h> 31 31 #include <pj/ioqueue.h> 32 #include <pj/timer.h> 32 33 33 34 PJ_BEGIN_DECL … … 43 44 * @{ 44 45 */ 46 47 /***************************************************************************** 48 * 49 * GENERAL TRANSPORT (NAMES, TYPES, ETC.) 50 * 51 *****************************************************************************/ 52 53 /** 54 * Flags for SIP transports. 55 */ 56 enum pjsip_transport_flags_e 57 { 58 PJSIP_TRANSPORT_RELIABLE = 1, /**< Transport is reliable. */ 59 PJSIP_TRANSPORT_SECURE = 2, /**< Transport is secure. */ 60 PJSIP_TRANSPORT_DATAGRAM = 4, /**< Datagram based transport. */ 61 }; 62 63 /** 64 * Check if transport tp is reliable. 65 */ 66 #define PJSIP_TRANSPORT_IS_RELIABLE(tp) \ 67 ((tp)->flag & PJSIP_TRANSPORT_RELIABLE) 68 69 /** 70 * Get the transport type from the transport name. 71 * 72 * @param name Transport name, such as "TCP", or "UDP". 73 * 74 * @return The transport type, or PJSIP_TRANSPORT_UNSPECIFIED if 75 * the name is not recognized as the name of supported 76 * transport. 77 */ 78 PJ_DECL(pjsip_transport_type_e) 79 pjsip_transport_get_type_from_name(const pj_str_t *name); 80 81 /** 82 * Get the transport type for the specified flags. 83 * 84 * @param flag The transport flag. 85 * 86 * @return Transport type. 87 */ 88 PJ_DECL(pjsip_transport_type_e) 89 pjsip_transport_get_type_from_flag(unsigned flag); 90 91 /** 92 * Get transport flag from type. 93 * 94 * @param type Transport type. 95 * 96 * @return Transport flags. 97 */ 98 PJ_DECL(unsigned) 99 pjsip_transport_get_flag_from_type( pjsip_transport_type_e type ); 100 101 /** 102 * Get the default SIP port number for the specified type. 103 * 104 * @param type Transport type. 105 * 106 * @return The port number, which is the default SIP port number for 107 * the specified type. 108 */ 109 PJ_DECL(int) 110 pjsip_transport_get_default_port_for_type(pjsip_transport_type_e type); 111 112 113 /***************************************************************************** 114 * 115 * RECEIVE DATA BUFFER. 116 * 117 *****************************************************************************/ 45 118 46 119 /** … … 53 126 struct pjsip_rx_data 54 127 { 55 //PJ_DECL_LIST_MEMBER(struct pjsip_rx_data); 56 57 /** Memory pool for this buffer. */ 58 pj_pool_t *pool; 59 60 /** Ioqueue op key. */ 61 pj_ioqueue_op_key_t op_key; 62 63 /** Time when the message was received. */ 64 pj_time_val timestamp; 65 66 /** The packet buffer. */ 67 char packet[PJSIP_MAX_PKT_LEN]; 68 69 /** The length of the packet received. */ 70 int len; 71 72 /** The source address from which the packet was received. */ 73 pj_sockaddr_in addr; 74 75 /** The length of the source address. */ 76 int addr_len; 77 78 /** The transport object which received this packet. */ 79 pjsip_transport_t *transport; 80 81 /** The parsed message, if any. */ 82 pjsip_msg *msg; 83 84 /** This the transaction key generated from the message. This key is only 85 * available after the rdata has reached the endpoint. 86 */ 87 pj_str_t key; 88 89 /** The Call-ID header as found in the message. */ 90 pj_str_t call_id; 91 92 /** The From header as found in the message. */ 93 pjsip_from_hdr *from; 94 95 /** The To header as found in the message. */ 96 pjsip_to_hdr *to; 97 98 /** The topmost Via header as found in the message. */ 99 pjsip_via_hdr *via; 100 101 /** The CSeq header as found in the message. */ 102 pjsip_cseq_hdr *cseq; 103 104 /** Max forwards header. */ 105 pjsip_max_forwards_hdr *max_fwd; 106 107 /** The first route header. */ 108 pjsip_route_hdr *route; 109 110 /** The first record-route header. */ 111 pjsip_rr_hdr *record_route; 112 113 /** Content-type header. */ 114 pjsip_ctype_hdr *ctype; 115 116 /** Content-length header. */ 117 pjsip_clen_hdr *clen; 118 119 /** The first Require header. */ 120 pjsip_require_hdr *require; 121 122 /** The list of error generated by the parser when parsing this message. */ 123 pjsip_parser_err_report parse_err; 128 129 /** 130 * tp_info is part of rdata that remains static for the duration of the 131 * buffer. It is initialized when the buffer was created by transport. 132 */ 133 struct 134 { 135 /** Memory pool for this buffer. */ 136 pj_pool_t *pool; 137 138 /** The transport object which received this packet. */ 139 pjsip_transport *transport; 140 141 /** Ioqueue key. */ 142 pj_ioqueue_op_key_t op_key; 143 144 } tp_info; 145 146 147 /** 148 * pkt_info is initialized by transport when it receives an incoming 149 * packet. 150 */ 151 struct 152 { 153 /** Time when the message was received. */ 154 pj_time_val timestamp; 155 156 /** Pointer to the original packet. */ 157 char packet[PJSIP_MAX_PKT_LEN]; 158 159 /** Zero termination for the packet. */ 160 pj_uint32_t zero; 161 162 /** The length of the packet received. */ 163 int len; 164 165 /** The source address from which the packet was received. */ 166 pj_sockaddr_in addr; 167 168 /** The length of the source address. */ 169 int addr_len; 170 171 } pkt_info; 172 173 174 /** 175 * msg_info is initialized by transport mgr (tpmgr) before this buffer 176 * is passed to endpoint. 177 */ 178 struct 179 { 180 /** Start of msg buffer. */ 181 char *msg_buf; 182 183 /** Length fo message. */ 184 int len; 185 186 /** The parsed message, if any. */ 187 pjsip_msg *msg; 188 189 /** The Call-ID header as found in the message. */ 190 pj_str_t call_id; 191 192 /** The From header as found in the message. */ 193 pjsip_from_hdr *from; 194 195 /** The To header as found in the message. */ 196 pjsip_to_hdr *to; 197 198 /** The topmost Via header as found in the message. */ 199 pjsip_via_hdr *via; 200 201 /** The CSeq header as found in the message. */ 202 pjsip_cseq_hdr *cseq; 203 204 /** Max forwards header. */ 205 pjsip_max_forwards_hdr *max_fwd; 206 207 /** The first route header. */ 208 pjsip_route_hdr *route; 209 210 /** The first record-route header. */ 211 pjsip_rr_hdr *record_route; 212 213 /** Content-type header. */ 214 pjsip_ctype_hdr *ctype; 215 216 /** Content-length header. */ 217 pjsip_clen_hdr *clen; 218 219 /** The first Require header. */ 220 pjsip_require_hdr *require; 221 222 /** The list of error generated by the parser when parsing 223 this message. 224 */ 225 pjsip_parser_err_report parse_err; 226 227 } msg_info; 228 229 230 /** 231 * endpt_info is initialized by endpoint after this buffer reaches 232 * endpoint. 233 */ 234 struct 235 { 236 /** 237 * This the transaction key generated for the message. 238 */ 239 pj_str_t key; 240 241 } endpt_info; 242 124 243 }; 125 244 245 246 /***************************************************************************** 247 * 248 * TRANSMIT DATA BUFFER MANIPULATION. 249 * 250 *****************************************************************************/ 126 251 127 252 /** … … 157 282 158 283 /** The transport manager for this buffer. */ 159 pjsip_t ransport_mgr*mgr;284 pjsip_tpmgr *mgr; 160 285 161 286 /** Ioqueue asynchronous operation key. */ 162 287 pj_ioqueue_op_key_t op_key; 288 289 /** Lock object. */ 290 pj_lock_t *lock; 163 291 164 292 /** The message in this buffer. */ … … 175 303 /** Reference counter. */ 176 304 pj_atomic_t *ref_cnt; 305 306 /** Being sent? */ 307 int is_pending; 308 309 /** Transport internal. */ 310 void *token; 311 void (*cb)(void*, pjsip_tx_data*, pj_status_t); 177 312 }; 178 313 314 315 /** 316 * Create a new, blank transmit buffer. The reference count is initialized 317 * to zero. 318 * 319 * @param mgr The transport manager. 320 * @param tdata Pointer to receive transmit data. 321 * 322 * @return PJ_SUCCESS, or the appropriate error code. 323 * 324 * @see pjsip_endpt_create_tdata 325 */ 326 pj_status_t pjsip_tx_data_create( pjsip_tpmgr *mgr, 327 pjsip_tx_data **tdata ); 179 328 180 329 /** … … 194 343 */ 195 344 PJ_DECL(void) pjsip_tx_data_dec_ref( pjsip_tx_data *tdata ); 345 346 /** 347 * Check if transmit data buffer contains a valid message. 348 * 349 * @param tdata The transmit buffer. 350 */ 351 PJ_DECL(pj_bool_t) pjsip_tx_data_is_valid( pjsip_tx_data *tdata ); 196 352 197 353 /** … … 208 364 209 365 210 /** 211 * Flags for SIP transports. 212 */ 213 enum pjsip_transport_flags_e 366 /***************************************************************************** 367 * 368 * TRANSPORT 369 * 370 *****************************************************************************/ 371 372 /** 373 * This structure represent the "public" interface of a SIP transport. 374 * Applications normally extend this structure to include transport 375 * specific members. 376 */ 377 typedef struct pjsip_transport 214 378 { 215 PJSIP_TRANSPORT_RELIABLE = 1, /**< Transport is reliable. */ 216 PJSIP_TRANSPORT_SECURE = 2, /**< Transport is secure. */ 217 PJSIP_TRANSPORT_IOQUEUE_BUSY = 4, /**< WTH?? */ 379 char obj_name[PJ_MAX_OBJ_NAME]; /**< Name. */ 380 381 pj_pool_t *pool; /**< Pool used by transport. */ 382 pj_atomic_t *ref_cnt; /**< Reference counter. */ 383 pj_lock_t *lock; /**< Lock object. */ 384 int tracing; /**< Tracing enabled? */ 385 386 pjsip_transport_type_e type; /**< Transport type. */ 387 char type_name[8]; /**< Type name. */ 388 unsigned flag; /**< #pjsip_transport_flags_e */ 389 390 pj_sockaddr_in local_addr; /**< Bound address. */ 391 pj_sockaddr_in public_addr; /**< STUN addres. */ 392 pj_sockaddr_in rem_addr; /**< Remote addr (zero for UDP) */ 393 394 pjsip_tpmgr *tpmgr; /**< Transport manager. */ 395 pj_timer_entry idle_timer; /**< Timer when ref cnt is zero.*/ 396 397 /** 398 * Function to be called by transport manager to send SIP message. 399 * 400 * @param transport The transport to send the message. 401 * @param packet The buffer to send. 402 * @param length The length of the buffer to send. 403 * @param op_key Completion token, which will be supplied to 404 * caller when pending send operation completes. 405 * @param rem_addr The remote destination address. 406 * @param callback If supplied, the callback will be called 407 * once a pending transmission has completed. If 408 * the function completes immediately (i.e. return 409 * code is not PJ_EPENDING), the callback will not 410 * be called. 411 * 412 * @return Should return PJ_SUCCESS only if data has been 413 * succesfully queued to operating system for 414 * transmission. Otherwise it may return PJ_EPENDING 415 * if the underlying transport can not send the 416 * data immediately and will send it later, which in 417 * this case caller doesn't have to do anything 418 * except wait the calback to be called, if it 419 * supplies one. 420 * Other return values indicate the error code. 421 */ 422 pj_status_t (*send_msg)(pjsip_transport *transport, 423 const void *packet, 424 pj_size_t length, 425 pj_ioqueue_op_key_t *op_key, 426 const pj_sockaddr_in *rem_addr, 427 void *token, 428 void (*callback)(pjsip_transport *transport, 429 void *token, 430 pj_status_t status)); 431 432 /** 433 * Destroy this transport. 434 */ 435 pj_status_t (*destroy)(pjsip_transport *transport); 436 437 /* 438 * Application may extend this structure.. 439 */ 440 } pjsip_transport; 441 442 443 /** 444 * Register a transport. 445 */ 446 PJ_DECL(pj_status_t) pjsip_transport_register( pjsip_tpmgr *mgr, 447 pjsip_transport *tp ); 448 449 450 /** 451 * Unregister transport. This will eventually call the transport to 452 * destroy itself. 453 */ 454 PJ_DECL(pj_status_t) pjsip_transport_unregister( pjsip_tpmgr *mgr, 455 pjsip_transport *tp); 456 457 /** 458 * Add ref. 459 */ 460 PJ_DECL(pj_status_t) pjsip_transport_add_ref( pjsip_transport *tp ); 461 462 /** 463 * Dec ref. 464 */ 465 PJ_DECL(pj_status_t) pjsip_transport_dec_ref( pjsip_transport *tp ); 466 467 468 /** 469 * Call for incoming message. 470 */ 471 PJ_DECL(pj_ssize_t) pjsip_tpmgr_receive_packet(pjsip_tpmgr *mgr, 472 pjsip_rx_data *rdata); 473 474 475 /***************************************************************************** 476 * 477 * TRANSPORT FACTORY 478 * 479 *****************************************************************************/ 480 481 482 /** 483 * Transport factory. 484 */ 485 typedef struct pjsip_tpfactory pjsip_tpfactory; 486 487 /** 488 * Transport factory. 489 */ 490 struct pjsip_tpfactory 491 { 492 /* This list is managed by transport manager. */ 493 PJ_DECL_LIST_MEMBER(struct pjsip_tpfactory); 494 495 pj_pool_t *pool; 496 pj_lock_t *lock; 497 498 pjsip_transport_type_e type; 499 char type_name[8]; 500 unsigned flag; 501 502 pj_sockaddr_in local_addr; 503 pj_sockaddr_in public_addr; 504 505 /** 506 * Create new outbound connection. 507 */ 508 pj_status_t (*create_transport)(pjsip_tpfactory *factory, 509 pjsip_tpmgr *mgr, 510 pjsip_endpoint *endpt, 511 pj_ioqueue_t *ioqueue, 512 const pj_sockaddr_in *rem_addr, 513 pjsip_transport **transport); 514 515 /* 516 * Application may extend this structure.. 517 */ 218 518 }; 219 519 220 /** 221 * Get the transport type from the transport name. 222 * 223 * @param name Transport name, such as "TCP", or "UDP". 224 * 225 * @return The transport type, or PJSIP_TRANSPORT_UNSPECIFIED if 226 * the name is not recognized as the name of supported 227 * transport. 228 */ 229 PJ_DECL(pjsip_transport_type_e) 230 pjsip_transport_get_type_from_name(const pj_str_t *name); 231 232 /** 233 * Get the transport type for the specified flags. 234 * 235 * @param flag The transport flag. 236 * 237 * @return Transport type. 238 */ 239 PJ_DECL(pjsip_transport_type_e) 240 pjsip_transport_get_type_from_flag(unsigned flag); 241 242 /** 243 * Get the default SIP port number for the specified type. 244 * 245 * @param type Transport type. 246 * 247 * @return The port number, which is the default SIP port number for 248 * the specified type. 249 */ 250 PJ_DECL(int) 251 pjsip_transport_get_default_port_for_type(pjsip_transport_type_e type); 252 253 254 /** 255 * Add reference to transport. 256 * Transactions or dialogs that uses a particular transport must call this 257 * function to indicate that the transport is being used, thus preventing the 258 * transport from being closed. 259 * 260 * @param transport The transport. 261 */ 262 PJ_DECL(void) 263 pjsip_transport_add_ref( pjsip_transport_t *transport ); 264 265 /** 266 * Decrease reference to transport. 267 * When the transport reference counter becomes zero, a timer will be started 268 * and when this timer expires and the reference counter is still zero, the 269 * transport will be released. 270 * 271 * @param transport The transport 272 */ 273 PJ_DECL(void) 274 pjsip_transport_dec_ref( pjsip_transport_t *transport ); 275 276 277 /** 278 * Macro to check whether the transport is reliable. 279 * 280 * @param transport The transport 281 * 282 * @return non-zero (not necessarily 1) if transport is reliable. 283 */ 284 #define PJSIP_TRANSPORT_IS_RELIABLE(transport) \ 285 (pjsip_transport_get_flag(transport) & PJSIP_TRANSPORT_RELIABLE) 286 287 288 /** 289 * Macro to check whether the transport is secure. 290 * 291 * @param transport The transport 292 * 293 * @return non-zero (not necessarily one) if transport is secure. 294 */ 295 #define PJSIP_TRANSPORT_IS_SECURE(transport) \ 296 (pjsip_transport_get_flag(transport) & PJSIP_TRANSPORT_SECURE) 297 298 /** 299 * Get the transport type. 300 * 301 * @param tr The transport. 302 * 303 * @return Transport type. 304 */ 305 PJ_DECL(pjsip_transport_type_e) 306 pjsip_transport_get_type( const pjsip_transport_t * tr); 307 308 /** 309 * Get the transport type name (ie "UDP", or "TCP"). 310 * 311 * @param tr The transport. 312 * @return The string type. 313 */ 314 PJ_DECL(const char *) 315 pjsip_transport_get_type_name( const pjsip_transport_t * tr); 316 317 /** 318 * Get the transport's object name. 319 * 320 * @param tr The transport. 321 * @return The object name. 322 */ 323 PJ_DECL(const char*) 324 pjsip_transport_get_obj_name( const pjsip_transport_t *tr ); 325 326 /** 327 * Get the transport's reference counter. 328 * 329 * @param tr The transport. 330 * @return The reference count value. 331 */ 332 PJ_DECL(int) 333 pjsip_transport_get_ref_cnt( const pjsip_transport_t *tr ); 334 335 /** 336 * Get transport flag. 337 * 338 * @param tr The transport. 339 * @return Transport flag. 340 */ 341 PJ_DECL(unsigned) 342 pjsip_transport_get_flag( const pjsip_transport_t * tr ); 343 344 /** 345 * Get the local address of the transport, ie. the address which the socket 346 * is bound. 347 * 348 * @param tr The transport. 349 * @return The address. 350 */ 351 PJ_DECL(const pj_sockaddr_in *) 352 pjsip_transport_get_local_addr( pjsip_transport_t * tr ); 353 354 /** 355 * Get the address name of the transport. Address name can be an arbitrary 356 * address assigned to a transport. This is usefull for example when STUN 357 * is used, then the address name of an UDP transport can specify the public 358 * address of the transport. When the address name is not set, then value 359 * will be equal to the local/bound address. Application should normally 360 * prefer to use the address name instead of the local address. 361 * 362 * @param tr The transport. 363 * @return The address name. 364 */ 365 PJ_DECL(const pj_sockaddr_in*) 366 pjsip_transport_get_addr_name (pjsip_transport_t *tr); 367 368 /** 369 * Get the remote address of the transport. Not all transports will have 370 * a valid remote address. UDP transports, for example, will likely to have 371 * zero has their remote address, because UDP transport can be used to send 372 * and receive messages from multiple destinations. 373 * 374 * @param tr The transport. 375 * @return The address. 376 */ 377 PJ_DECL(const pj_sockaddr_in *) 378 pjsip_transport_get_remote_addr( const pjsip_transport_t * tr ); 379 380 /** 381 * Send a SIP message using the specified transport, to the address specified 382 * in the outgoing data. This function is only usefull for application when it 383 * wants to handle the message statelessly, because otherwise it should create 384 * a transaction and let the transaction handles the transmission of the 385 * message. 386 * 387 * This function will send the message immediately, so application must be 388 * sure that the transport is ready to do so before calling this function. 389 * 390 * @param tr The transport to send the message. 391 * @param tdata The outgoing message buffer. 392 * @param addr The remote address. 393 * @param sent If not null, it will be filled up with the length of 394 * data sent. 395 * 396 * @return PJ_SUCCESS on success, or the appropriate error code. 397 */ 398 PJ_DECL(pj_status_t) pjsip_transport_send_msg( pjsip_transport_t *tr, 399 pjsip_tx_data *tdata, 400 const pj_sockaddr_in *addr, 401 pj_ssize_t *sent); 520 521 522 /** 523 * Register a transport factory. 524 * 525 * @param mgr The transport manager. 526 * @param factory Transport factory. 527 * 528 * @return PJ_SUCCESS if listener was successfully created. 529 */ 530 PJ_DECL(pj_status_t) pjsip_tpmgr_register_tpfactory(pjsip_tpmgr *mgr, 531 pjsip_tpfactory *tpf); 532 533 /** 534 * Unregister factory. 535 */ 536 PJ_DECL(pj_status_t) pjsip_tpmgr_unregister_tpfactory(pjsip_tpmgr *mgr, 537 pjsip_tpfactory *tpf); 538 539 540 /***************************************************************************** 541 * 542 * TRANSPORT MANAGER 543 * 544 *****************************************************************************/ 545 546 /** 547 * Create a new transport manager. 548 * 549 * @param pool Pool. 550 * @param endpt Endpoint instance. 551 * @param cb Callback to receive incoming message. 552 * @param p_mgr Pointer to receive the new transport manager. 553 * 554 * @return PJ_SUCCESS or the appropriate error code on error. 555 */ 556 PJ_DECL(pj_status_t) pjsip_tpmgr_create( pj_pool_t *pool, 557 pjsip_endpoint * endpt, 558 pj_ioqueue_t *ioqueue, 559 pj_timer_heap_t *timer_heap, 560 void (*cb)(pjsip_endpoint*, 561 pj_status_t, 562 pjsip_rx_data *), 563 pjsip_tpmgr **p_mgr); 564 565 566 /** 567 * Destroy transport manager. 568 */ 569 PJ_DECL(pj_status_t) pjsip_tpmgr_destroy(pjsip_tpmgr *mgr); 570 571 572 /** 573 * Dump transport info. 574 */ 575 PJ_DECL(void) pjsip_tpmgr_dump_transports(pjsip_tpmgr *mgr); 576 577 578 /***************************************************************************** 579 * 580 * PUBLIC API 581 * 582 *****************************************************************************/ 583 584 585 /** 586 * Find transport to be used to send message to remote destination. If no 587 * suitable transport is found, a new one will be created. 588 */ 589 PJ_DECL(pj_status_t) pjsip_tpmgr_alloc_transport( pjsip_tpmgr *mgr, 590 pjsip_transport_type_e type, 591 const pj_sockaddr_in *remote, 592 pjsip_transport **p_transport ); 593 594 595 /** 596 * Send a SIP message using the specified transport. 597 */ 598 PJ_DECL(pj_status_t) pjsip_transport_send( pjsip_transport *tr, 599 pjsip_tx_data *tdata, 600 const pj_sockaddr_in *addr, 601 void *token, 602 void (*cb)(void *token, 603 pjsip_tx_data *tdata, 604 pj_status_t)); 402 605 403 606 … … 406 609 */ 407 610 408 /*409 * PRIVATE FUNCTIONS!!!410 *411 * These functions are normally to be used by endpoint. Application should412 * use the variant provided by the endpoint instance.413 *414 * Application normally wouldn't be able to call these functions because it415 * has no reference of the transport manager (the instance of the transport416 * manager is hidden by endpoint!).417 */418 419 /*420 * Create a new transmit buffer.421 *422 * @param mgr The transport manager.423 * @return The transmit buffer data, or NULL on error.424 */425 pj_status_t pjsip_tx_data_create( pjsip_transport_mgr *mgr,426 pjsip_tx_data **tdata );427 428 429 /**430 * Create listener.431 *432 * @param mgr The transport manager.433 * @param type Transport type.434 * @param local_addr The address to bind.435 * @param addr_name If not null, sets the address name. If NULL,436 * then the local address will be used.437 *438 * @return PJ_SUCCESS if listener was successfully created.439 */440 PJ_DECL(pj_status_t) pjsip_create_listener( pjsip_transport_mgr *mgr,441 pjsip_transport_type_e type,442 pj_sockaddr_in *local_addr,443 const pj_sockaddr_in *addr_name);444 445 446 /**447 * Create UDP listener.448 *449 * @param mgr The transport manager.450 * @param sock The UDP socket.451 * @param addr_name If not null, sets the address name. If NULL,452 * then the local address will be used.453 *454 * @return PJ_SUCCESS if listener was successfully created.455 */456 PJ_DECL(pj_status_t) pjsip_create_udp_listener( pjsip_transport_mgr *mgr,457 pj_sock_t sock,458 const pj_sockaddr_in *addr_name);459 460 /**461 * Type of function to receive asynchronous transport completion for462 * pjsip_transport_get() operation.463 *464 * @param tr The transport.465 * @param token Token registered previously.466 * @param status Status of operation.467 */468 typedef void pjsip_transport_completion_callback(pjsip_transport_t *tr,469 void *token,470 pj_status_t status);471 472 /**473 * Find transport to be used to send message to remote destination. If no474 * suitable transport is found, a new one will be created. If transport475 * can not be available immediately (for example, an outgoing TCP connec()),476 * then the caller will be notified later via the callback.477 *478 * @param mgr The transport manager.479 * @param pool Pool to allocate asychronous job (if required).480 * @param type The transport type.481 * @param remote The remote address.482 * @param token The token that will be passed to the callback.483 * @param cb The callback to be called to report the completion of484 * the operation.485 */486 PJ_DECL(void) pjsip_transport_get( pjsip_transport_mgr *mgr,487 pj_pool_t *pool,488 pjsip_transport_type_e type,489 const pj_sockaddr_in *remote,490 void *token,491 pjsip_transport_completion_callback *cb);492 611 493 612 PJ_END_DECL
Note: See TracChangeset
for help on using the changeset viewer.