summaryrefslogtreecommitdiff
path: root/pjsip/include/pjsip/sip_transaction.h
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2005-11-11 19:01:31 +0000
committerBenny Prijono <bennylp@teluu.com>2005-11-11 19:01:31 +0000
commit0b9e388f7f10dac01d5134ed6c1b24695810874e (patch)
treef01b4f05e8d074a8dba14a96b93803fd6797c105 /pjsip/include/pjsip/sip_transaction.h
parent0bc0f9112ac6319d7ce8662de86d6c076bd4b1e3 (diff)
First clean compile of pjsip
git-svn-id: http://svn.pjsip.org/repos/pjproject/main@43 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/include/pjsip/sip_transaction.h')
-rw-r--r--pjsip/include/pjsip/sip_transaction.h175
1 files changed, 111 insertions, 64 deletions
diff --git a/pjsip/include/pjsip/sip_transaction.h b/pjsip/include/pjsip/sip_transaction.h
index 3ef6ad14..cdb11235 100644
--- a/pjsip/include/pjsip/sip_transaction.h
+++ b/pjsip/include/pjsip/sip_transaction.h
@@ -1,5 +1,4 @@
/* $Id$
- *
*/
#ifndef __PJSIP_SIP_TRANSACTION_H__
#define __PJSIP_SIP_TRANSACTION_H__
@@ -11,8 +10,6 @@
#include <pjsip/sip_msg.h>
#include <pjsip/sip_resolve.h>
-//#include <pjsip/sip_config.h>
-//#include <pjsip/sip_endpoint.h>
#include <pj/timer.h>
PJ_BEGIN_DECL
@@ -22,7 +19,8 @@ PJ_BEGIN_DECL
* @ingroup PJSIP
* @{
*/
-
+
+/* Forward decl. */
struct pjsip_transaction;
@@ -60,68 +58,111 @@ typedef enum pjsip_tsx_transport_state_e
* Transaction state.
*/
struct pjsip_transaction
-{
- pj_pool_t *pool;
- pjsip_endpoint *endpt;
- char obj_name[PJ_MAX_OBJ_NAME];
- pjsip_role_e role;
- int status_code;
- pjsip_tsx_state_e state;
- int (*state_handler)(struct pjsip_transaction *, pjsip_event *);
-
- pj_mutex_t *mutex;
- pjsip_method method;
- int cseq;
- pj_str_t transaction_key;
- pj_str_t branch;
-
- pjsip_tsx_transport_state_e transport_state;
- pjsip_host_port dest_name;
- int current_addr;
- pjsip_server_addresses remote_addr;
- pjsip_transport_t *transport;
-
- pjsip_tx_data *last_tx;
- int has_unsent_msg;
- int handle_ack;
- int retransmit_count;
-
- pj_timer_entry retransmit_timer;
- pj_timer_entry timeout_timer;
+{
+ /*
+ * Administrivia
+ */
+ pj_pool_t *pool; /**< Pool owned by the tsx. */
+ pjsip_endpoint *endpt; /**< Endpoint instance. */
+ pj_mutex_t *mutex; /**< Mutex for this tsx. */
+ char obj_name[PJ_MAX_OBJ_NAME]; /**< Tsx name. */
+ int tracing; /**< Tracing enabled? */
+
+ /*
+ * Transaction identification.
+ */
+ pjsip_role_e role; /**< Role (UAS or UAC) */
+ pjsip_method method; /**< The method. */
+ int cseq; /**< The CSeq */
+ pj_str_t transaction_key;/**< hash table key. */
+ pj_str_t branch; /**< The branch Id. */
+
+ /*
+ * State and status.
+ */
+ int status_code; /**< Last status code seen. */
+ pjsip_tsx_state_e state; /**< State. */
+ int handle_ack; /**< Should we handle ACK? */
+
+ /** Handler according to current state. */
+ pj_status_t (*state_handler)(struct pjsip_transaction *, pjsip_event *);
+
+ /*
+ * Transport.
+ */
+ pjsip_tsx_transport_state_e transport_state;/**< Transport's state. */
+ pjsip_host_port dest_name; /**< Destination address. */
+ pjsip_server_addresses remote_addr; /**< Addresses resolved. */
+ int current_addr; /**< Address currently used. */
+
+ pjsip_transport_t *transport; /**< Transport to use. */
+
+ /*
+ * Messages and timer.
+ */
+ pjsip_tx_data *last_tx; /**< Msg kept for retrans. */
+ int has_unsent_msg; /**< Non-zero if tsx need to
+ transmit msg once resolver
+ completes. */
+ int retransmit_count;/**< Retransmission count. */
+ pj_timer_entry retransmit_timer;/**< Retransmit timer. */
+ pj_timer_entry timeout_timer; /**< Timeout timer. */
+
+ /** Module specific data. */
void *module_data[PJSIP_MAX_MODULE];
};
/**
- * Init transaction as UAC.
- * @param tsx the transaction.
- * @param tdata the transmit data.
- * @return PJ_SUCCESS if successfull.
+ * Init transaction as UAC from the specified transmit data (\c tdata).
+ * The transmit data must have a valid \c Request-Line and \c CSeq header.
+ * If \c Route headers are present, it will be used to calculate remote
+ * destination.
+ *
+ * If \c Via header does not exist, it will be created along with a unique
+ * \c branch parameter. If it exists and contains branch parameter, then
+ * the \c branch parameter will be used as is as the transaction key.
+ *
+ * The \c Route headers in the transmit data, if present, are used to
+ * calculate remote destination.
+ *
+ * At the end of the function, the transaction will start resolving the
+ * addresses of remote server to contact. Transport will be acquired as soon
+ * as the resolving job completes.
+ *
+ * @param tsx The transaction.
+ * @param tdata The transmit data.
+ *
+ * @return PJ_SUCCESS if successfull.
*/
PJ_DECL(pj_status_t) pjsip_tsx_init_uac( pjsip_transaction *tsx,
pjsip_tx_data *tdata);
/**
- * Init transaction as UAS.
- * @param tsx the transaction to be initialized.
- * @param rdata the received incoming request.
+ * Init transaction as UAS.
+ *
+ * @param tsx The transaction to be initialized.
+ * @param rdata The received incoming request.
+ *
* @return PJ_SUCCESS if successfull.
*/
PJ_DECL(pj_status_t) pjsip_tsx_init_uas( pjsip_transaction *tsx,
pjsip_rx_data *rdata);
/**
- * Process incoming message for this transaction.
- * @param tsx the transaction.
- * @param rdata the incoming message.
+ * Process incoming message for this transaction.
+ *
+ * @param tsx The transaction.
+ * @param rdata The incoming message.
*/
PJ_DECL(void) pjsip_tsx_on_rx_msg( pjsip_transaction *tsx,
pjsip_rx_data *rdata);
/**
- * Transmit message with this transaction.
- * @param tsx the transaction.
- * @param tdata the outgoing message.
+ * Transmit message with this transaction.
+ *
+ * @param tsx The transaction.
+ * @param tdata The outgoing message.
*/
PJ_DECL(void) pjsip_tsx_on_tx_msg( pjsip_transaction *tsx,
pjsip_tx_data *tdata);
@@ -133,35 +174,41 @@ PJ_DECL(void) pjsip_tsx_on_tx_msg( pjsip_transaction *tsx,
* This operation is only valid if the transaction is configured to handle ACK
* (tsx->handle_ack is non-zero). If this attribute is not set, then the
* transaction will comply with RFC-3261, i.e. it will set itself to
- * TERMINATED state when it receives 2xx/INVITE.
- * @param tsx The transaction.
- * @param tdata The ACK request.
+ * TERMINATED state when it receives 2xx/INVITE.
+ *
+ * @param tsx The transaction.
+ * @param tdata The ACK request.
*/
PJ_DECL(void) pjsip_tsx_on_tx_ack( pjsip_transaction *tsx,
pjsip_tx_data *tdata);
/**
- * Forcely terminate transaction.
- * @param tsx the transaction.
- * @param code the status code to report.
+ * Force terminate transaction.
+ *
+ * @param tsx The transaction.
+ * @param code The status code to report.
*/
PJ_DECL(void) pjsip_tsx_terminate( pjsip_transaction *tsx,
int code );
/**
* Create transaction key, which is used to match incoming requests
- * or response (retransmissions) against transactions.
- * @param pool The pool
- * @param key Output key.
- * @param role The role of the transaction.
- * @param method The method to be put as a key.
- * @param rdata The received data to calculate.
- */
-PJ_DECL(void) pjsip_tsx_create_key( pj_pool_t *pool,
- pj_str_t *key,
- pjsip_role_e role,
- const pjsip_method *method,
- const pjsip_rx_data *rdata );
+ * or response (retransmissions) against transactions.
+ *
+ * @param pool The pool
+ * @param key Output key.
+ * @param role The role of the transaction.
+ * @param method The method to be put as a key.
+ * @param rdata The received data to calculate.
+ *
+ * @return PJ_SUCCESS or the appropriate error code.
+ */
+PJ_DECL(pj_status_t) pjsip_tsx_create_key( pj_pool_t *pool,
+ pj_str_t *key,
+ pjsip_role_e role,
+ const pjsip_method *method,
+ const pjsip_rx_data *rdata );
+
/**
* @}
@@ -183,7 +230,7 @@ PJ_DECL(const char *) pjsip_role_name(pjsip_role_e role);
/* Thread Local Storage ID for transaction lock (initialized by endpoint) */
-extern int pjsip_tsx_lock_tls_id;
+extern long pjsip_tsx_lock_tls_id;
PJ_END_DECL