- Timestamp:
- Nov 19, 2005 1:20:08 PM (19 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/build/pjsip_core.dsp
r43 r57 128 128 # Begin Source File 129 129 130 SOURCE=..\src\pjsip\sip_transport_udp.c 131 # End Source File 132 # Begin Source File 133 130 134 SOURCE=..\src\pjsip\sip_uri.c 131 135 # End Source File -
pjproject/trunk/pjsip/include/pjsip/sip_endpoint.h
r54 r57 81 81 */ 82 82 PJ_DECL(pj_status_t) pjsip_endpt_create(pj_pool_factory *pf, 83 const char *name, 83 84 pjsip_endpoint **endpt); 84 85 … … 251 252 void *token, 252 253 pjsip_resolver_callback *cb); 254 255 /** 256 * Get transport manager instance. 257 * 258 * @param endpt The endpoint. 259 * 260 * @return Transport manager instance. 261 */ 262 PJ_DECL(pjsip_tpmgr*) pjsip_endpt_get_tpmgr(pjsip_endpoint *endpt); 263 264 /** 265 * Get ioqueue instance. 266 * 267 * @param endpt The endpoint. 268 * 269 * @return The ioqueue. 270 */ 271 PJ_DECL(pj_ioqueue_t*) pjsip_endpt_get_ioqueue(pjsip_endpoint *endpt); 253 272 254 273 /** -
pjproject/trunk/pjsip/include/pjsip/sip_transport.h
r54 r57 117 117 *****************************************************************************/ 118 118 119 /** 120 * A customized ioqueue async operation key which is used by transport 121 * to locate rdata when a pending read operation completes. 122 */ 123 typedef struct pjsip_rx_data_op_key 124 { 125 pj_ioqueue_op_key_t op_key; 126 pjsip_rx_data *rdata; 127 } pjsip_rx_data_op_key; 128 129 119 130 /** 120 131 * Incoming message buffer. … … 140 151 141 152 /** Ioqueue key. */ 142 pj _ioqueue_op_key_top_key;153 pjsip_rx_data_op_key op_key; 143 154 144 155 } tp_info; … … 250 261 *****************************************************************************/ 251 262 263 /** Customized ioqueue async operation key, used by transport to keep 264 * callback parameters. 265 */ 266 typedef struct pjsip_tx_data_op_key 267 { 268 pj_ioqueue_op_key_t key; 269 pjsip_tx_data *tdata; 270 void *token; 271 void (*callback)(pjsip_transport*,void*,pj_ssize_t); 272 } pjsip_tx_data_op_key; 273 274 252 275 /** 253 276 * Data structure for sending outgoing message. Application normally creates … … 266 289 struct pjsip_tx_data 267 290 { 291 /** This is for transmission queue; it's managed by transports. */ 268 292 PJ_DECL_LIST_MEMBER(struct pjsip_tx_data); 269 293 … … 285 309 286 310 /** Ioqueue asynchronous operation key. */ 287 pj _ioqueue_op_key_top_key;311 pjsip_tx_data_op_key op_key; 288 312 289 313 /** Lock object. */ … … 304 328 pj_atomic_t *ref_cnt; 305 329 306 /** Being sent? */330 /** Being processed by transport? */ 307 331 int is_pending; 308 332 309 /** Transport internal. */333 /** Transport manager internal. */ 310 334 void *token; 311 335 void (*cb)(void*, pjsip_tx_data*, pj_status_t); … … 392 416 pj_sockaddr_in rem_addr; /**< Remote addr (zero for UDP) */ 393 417 418 pjsip_endpoint *endpt; /**< Endpoint instance. */ 394 419 pjsip_tpmgr *tpmgr; /**< Transport manager. */ 395 420 pj_timer_entry idle_timer; /**< Timer when ref cnt is zero.*/ … … 421 446 */ 422 447 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, 448 pjsip_tx_data *tdata, 426 449 const pj_sockaddr_in *rem_addr, 427 450 void *token, 428 451 void (*callback)(pjsip_transport *transport, 429 452 void *token, 430 pj_s tatus_t status));453 pj_ssize_t sent_bytes)); 431 454 432 455 /** … … 509 532 pjsip_tpmgr *mgr, 510 533 pjsip_endpoint *endpt, 511 pj_ioqueue_t *ioqueue,512 534 const pj_sockaddr_in *rem_addr, 513 535 pjsip_transport **transport); … … 556 578 PJ_DECL(pj_status_t) pjsip_tpmgr_create( pj_pool_t *pool, 557 579 pjsip_endpoint * endpt, 558 pj_ioqueue_t *ioqueue,559 pj_timer_heap_t *timer_heap,560 580 void (*cb)(pjsip_endpoint*, 561 581 pj_status_t, … … 602 622 void (*cb)(void *token, 603 623 pjsip_tx_data *tdata, 604 pj_s tatus_t));624 pj_ssize_t bytes_sent)); 605 625 606 626 -
pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c
r54 r57 54 54 pj_pool_factory *pf; 55 55 56 /** Name. */ 57 pj_str_t name; 58 56 59 /** Transaction table. */ 57 60 pj_hash_table_t *tsx_table; … … 353 356 */ 354 357 PJ_DEF(pj_status_t) pjsip_endpt_create(pj_pool_factory *pf, 358 const char *name, 355 359 pjsip_endpoint **p_endpt) 356 360 { … … 377 381 endpt->pf = pf; 378 382 383 /* Get name. */ 384 if (name != NULL) { 385 pj_str_t temp; 386 pj_strdup_with_null(endpt->pool, &endpt->name, pj_cstr(&temp, name)); 387 } else { 388 pj_strdup_with_null(endpt->pool, &endpt->name, pj_gethostname()); 389 } 390 379 391 /* Create mutex for the events, etc. */ 380 392 status = pj_mutex_create_recursive( endpt->pool, "ept%p", &endpt->mutex ); … … 423 435 /* Create transport manager. */ 424 436 status = pjsip_tpmgr_create( endpt->pool, endpt, 425 endpt->ioqueue, endpt->timer_heap,426 437 &endpt_transport_callback, 427 438 &endpt->transport_mgr); … … 504 515 pj_pool_release(endpt->pool); 505 516 } 517 518 /* 519 * Get endpoint name. 520 */ 521 PJ_DEF(const pj_str_t*) pjsip_endpt_name(const pjsip_endpoint *endpt) 522 { 523 return &endpt->name; 524 } 525 506 526 507 527 /* … … 943 963 944 964 /* 965 * Get transport manager. 966 */ 967 PJ_DEF(pjsip_tpmgr*) pjsip_endpt_get_tpmgr(pjsip_endpoint *endpt) 968 { 969 return endpt->transport_mgr; 970 } 971 972 /* 973 * Get ioqueue instance. 974 */ 975 PJ_DEF(pj_ioqueue_t*) pjsip_endpt_get_ioqueue(pjsip_endpoint *endpt) 976 { 977 return endpt->ioqueue; 978 } 979 980 /* 945 981 * Find/create transport. 946 982 */ -
pjproject/trunk/pjsip/src/pjsip/sip_transport.c
r54 r57 43 43 pj_lock_t *lock; 44 44 pjsip_endpoint *endpt; 45 pj_ioqueue_t *ioqueue;46 pj_timer_heap_t *timer_heap;47 45 pjsip_tpfactory factory_list; 48 46 void (*msg_cb)(pjsip_endpoint*, pj_status_t, pjsip_rx_data*); … … 357 355 if (pj_atomic_get(tp->ref_cnt) == 1) { 358 356 if (tp->idle_timer.id != PJ_FALSE) { 359 pj _timer_heap_cancel(tp->tpmgr->timer_heap, &tp->idle_timer);357 pjsip_endpt_cancel_timer(tp->tpmgr->endpt, &tp->idle_timer); 360 358 tp->idle_timer.id = PJ_FALSE; 361 359 } … … 384 382 pj_assert(tp->idle_timer.id == 0); 385 383 tp->idle_timer.id = PJ_TRUE; 386 pj_timer_heap_schedule(tp->tpmgr->timer_heap, &tp->idle_timer, &delay); 384 pjsip_endpt_schedule_timer(tp->tpmgr->endpt, &tp->idle_timer, 385 &delay); 387 386 } 388 387 pj_lock_release(tp->tpmgr->lock); … … 441 440 pj_assert(tp->idle_timer.id == PJ_FALSE); 442 441 if (tp->idle_timer.id != PJ_FALSE) { 443 pj _timer_heap_cancel(mgr->timer_heap, &tp->idle_timer);442 pjsip_endpt_cancel_timer(mgr->endpt, &tp->idle_timer); 444 443 tp->idle_timer.id = PJ_FALSE; 445 444 } … … 532 531 PJ_DEF(pj_status_t) pjsip_tpmgr_create( pj_pool_t *pool, 533 532 pjsip_endpoint *endpt, 534 pj_ioqueue_t *ioqueue,535 pj_timer_heap_t *timer_heap,536 533 void (*cb)(pjsip_endpoint*, 537 534 pj_status_t, … … 549 546 mgr->endpt = endpt; 550 547 mgr->msg_cb = cb; 551 mgr->ioqueue = ioqueue;552 mgr->timer_heap = timer_heap;553 548 pj_list_init(&mgr->factory_list); 554 549 … … 593 588 itr = next; 594 589 } 595 pj_ioqueue_destroy(mgr->ioqueue);596 590 597 591 pj_lock_release(mgr->lock); … … 802 796 /* Request factory to create transport. */ 803 797 status = factory->create_transport(factory, mgr, mgr->endpt, 804 mgr->ioqueue,remote, p_transport);798 remote, p_transport); 805 799 806 800 pj_lock_release(mgr->lock);
Note: See TracChangeset
for help on using the changeset viewer.