diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-02-23 01:07:54 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-02-23 01:07:54 +0000 |
commit | 75d3c1c4773b7b4e35db24ccf695788d871aba2e (patch) | |
tree | 833a5a8424487cdba248f146154fa3fbc565a471 /pjlib-util/include | |
parent | b9c4802224bd1772e144def6df556fbf0a3a71ed (diff) |
Ticket #121 and #122: Initial implementation of generic STUN transaction, with Binding request as an example
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@996 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib-util/include')
-rw-r--r-- | pjlib-util/include/pjlib-util/stun_endpoint.h | 12 | ||||
-rw-r--r-- | pjlib-util/include/pjlib-util/stun_msg.h | 9 | ||||
-rw-r--r-- | pjlib-util/include/pjlib-util/stun_transaction.h | 32 |
3 files changed, 17 insertions, 36 deletions
diff --git a/pjlib-util/include/pjlib-util/stun_endpoint.h b/pjlib-util/include/pjlib-util/stun_endpoint.h index 59bcdee1..fadde315 100644 --- a/pjlib-util/include/pjlib-util/stun_endpoint.h +++ b/pjlib-util/include/pjlib-util/stun_endpoint.h @@ -61,16 +61,16 @@ typedef struct pj_stun_endpoint /** * Create a STUN endpoint instance. */ -PJ_DECL(pj_status_t) pj_stun_endpt_create(pj_pool_factory *factory, - unsigned options, - pj_ioqueue_t *ioqueue, - pj_timer_heap_t *timer_heap, - pj_stun_endpoint **p_endpt); +PJ_DECL(pj_status_t) pj_stun_endpoint_create(pj_pool_factory *factory, + unsigned options, + pj_ioqueue_t *ioqueue, + pj_timer_heap_t *timer_heap, + pj_stun_endpoint **p_endpt); /** * Destroy STUN endpoint instance. */ -PJ_DECL(pj_status_t) pj_stun_endpt_destroy(pj_stun_endpoint *endpt); +PJ_DECL(pj_status_t) pj_stun_endpoint_destroy(pj_stun_endpoint *endpt); /** diff --git a/pjlib-util/include/pjlib-util/stun_msg.h b/pjlib-util/include/pjlib-util/stun_msg.h index f5e697f0..b0f80d6b 100644 --- a/pjlib-util/include/pjlib-util/stun_msg.h +++ b/pjlib-util/include/pjlib-util/stun_msg.h @@ -1195,15 +1195,16 @@ PJ_DECL(pj_status_t) pj_stun_msg_encode(const pj_stun_msg *msg, * @param msg The STUN message * @param buffer Buffer where the printable string output will * be printed on. - * @param length On input, specify the maximum length of the buffer. - * On output, it will be filled up with the actual - * length of the output string. + * @param length Specify the maximum length of the buffer. + * @param printed_len Optional pointer, which on output will be filled + * up with the actual length of the output string. * * @return The message string output. */ PJ_DECL(char*) pj_stun_msg_dump(const pj_stun_msg *msg, char *buffer, - unsigned *length); + unsigned length, + unsigned *printed_len); /** diff --git a/pjlib-util/include/pjlib-util/stun_transaction.h b/pjlib-util/include/pjlib-util/stun_transaction.h index ee57d11e..5463d3d7 100644 --- a/pjlib-util/include/pjlib-util/stun_transaction.h +++ b/pjlib-util/include/pjlib-util/stun_transaction.h @@ -102,6 +102,7 @@ typedef struct pj_stun_tsx_cb * * @param endpt The STUN endpoint, which will be used to retrieve * various settings for the transaction. + * @param pool Pool to be used to allocate memory from. * @param cb Callback structure, to be used by the transaction * to send message and to notify the application about * the completion of the transaction. @@ -110,6 +111,7 @@ typedef struct pj_stun_tsx_cb * @return PJ_SUCCESS on success, or the appropriate error code. */ PJ_DECL(pj_status_t) pj_stun_client_tsx_create( pj_stun_endpoint *endpt, + pj_pool_t *pool, const pj_stun_tsx_cb *cb, pj_stun_client_tsx **p_tsx); @@ -168,39 +170,17 @@ PJ_DECL(void*) pj_stun_client_tsx_get_data(pj_stun_client_tsx *tsx); * @param tsx The STUN client transaction. * @param retransmit Should this message be retransmitted by the * STUN transaction. - * @param msg The STUN message. + * @param pkt The STUN packet to send. + * @param pkt_len Length of STUN packet. * * @return PJ_SUCCESS on success or the appropriate error code. */ PJ_DECL(pj_status_t) pj_stun_client_tsx_send_msg(pj_stun_client_tsx *tsx, pj_bool_t retransmit, - const pj_stun_msg *msg); + void *pkt, + unsigned pkt_len); -/** - * Notify the STUN transaction about the arrival of STUN response. - * If the STUN response contains a final error (300 and greater), the - * transaction will be terminated and callback will be called. If the - * STUN response contains response code 100-299, retransmission - * will cease, but application must still call this function again - * with a final response later to allow the transaction to complete. - * - * @param tsx The STUN client transaction instance. - * @param packet The incoming packet. - * @param pkt_size Size of the incoming packet. - * @param parsed_len Optional pointer to receive the number of bytes - * that have been parsed from the incoming packet - * for the STUN message. This is useful if the - * STUN transaction is running over stream oriented - * socket such as TCP or TLS. - * - * @return PJ_SUCCESS on success or the appropriate error code. - */ -PJ_DECL(pj_status_t) pj_stun_client_tsx_on_rx_pkt(pj_stun_client_tsx *tsx, - const void *packet, - pj_size_t pkt_size, - unsigned *parsed_len); - /** * Notify the STUN transaction about the arrival of STUN response. |