summaryrefslogtreecommitdiff
path: root/pjsip/include
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-06-23 07:26:54 +0000
committerBenny Prijono <bennylp@teluu.com>2007-06-23 07:26:54 +0000
commitdd49a84c46ef7ea0cb755bfa8e78e6395f544c4e (patch)
treeabece2181d854eb6f19ad6a1b7bee7fb0849c7a7 /pjsip/include
parentde1e9a2df94e4a20bbf41f5edd241bfbdacd9b7f (diff)
More ticket #341: renamed pjsip_transport_send_raw() to pjsip_tpmgr_send_raw(), and added pjsip_endpt_send_raw() and pjsip_endpt_send_raw_to_uri()
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1388 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/include')
-rw-r--r--pjsip/include/pjsip/sip_transport.h34
-rw-r--r--pjsip/include/pjsip/sip_util.h88
2 files changed, 105 insertions, 17 deletions
diff --git a/pjsip/include/pjsip/sip_transport.h b/pjsip/include/pjsip/sip_transport.h
index 24b671f0..9f1ff044 100644
--- a/pjsip/include/pjsip/sip_transport.h
+++ b/pjsip/include/pjsip/sip_transport.h
@@ -1058,10 +1058,20 @@ PJ_DECL(pj_status_t) pjsip_transport_send( pjsip_transport *tr,
/**
- * This is a low-level function to send raw data using the specified transport
- * to the specified destination.
+ * This is a low-level function to send raw data to a destination.
*
- * @param tr The SIP transport to be used.
+ * See also #pjsip_endpt_send_raw() and #pjsip_endpt_send_raw_to_uri().
+ *
+ * @param mgr Transport manager.
+ * @param tp_type Transport type.
+ * @param sel Optional pointer to transport selector instance if
+ * application wants to use a specific transport instance
+ * rather then letting transport manager finds the suitable
+ * transport.
+ * @param tdata Optional transmit data buffer to be used. If this value
+ * is NULL, this function will create one internally. If
+ * tdata is specified, this function will decrement the
+ * reference counter upon completion.
* @param raw_data The data to be sent.
* @param data_len The length of the data.
* @param addr Destination address.
@@ -1079,14 +1089,16 @@ PJ_DECL(pj_status_t) pjsip_transport_send( pjsip_transport *tr,
* indicates immediate failure, and in this case the
* callback will not be called.
*/
-PJ_DECL(pj_status_t) pjsip_transport_send_raw(pjsip_transport *tr,
- const void *raw_data,
- pj_size_t data_len,
- const pj_sockaddr_t *addr,
- int addr_len,
- void *token,
- pjsip_tp_send_callback cb);
-
+PJ_DECL(pj_status_t) pjsip_tpmgr_send_raw(pjsip_tpmgr *mgr,
+ pjsip_transport_type_e tp_type,
+ const pjsip_tpselector *sel,
+ pjsip_tx_data *tdata,
+ const void *raw_data,
+ pj_size_t data_len,
+ const pj_sockaddr_t *addr,
+ int addr_len,
+ void *token,
+ pjsip_tp_send_callback cb);
/**
* @}
diff --git a/pjsip/include/pjsip/sip_util.h b/pjsip/include/pjsip/sip_util.h
index 18c1ce7b..75112ccf 100644
--- a/pjsip/include/pjsip/sip_util.h
+++ b/pjsip/include/pjsip/sip_util.h
@@ -20,6 +20,7 @@
#define __PJSIP_SIP_MISC_H__
#include <pjsip/sip_msg.h>
+#include <pjsip/sip_transport.h>
#include <pjsip/sip_resolve.h>
PJ_BEGIN_DECL
@@ -219,7 +220,6 @@ PJ_DECL(pj_status_t) pjsip_get_request_dest(const pjsip_tx_data *tdata,
PJ_DECL(pj_status_t) pjsip_process_route_set(pjsip_tx_data *tdata,
pjsip_host_info *dest_info );
-
/**
* This structure holds the state of outgoing stateless request.
*/
@@ -258,8 +258,10 @@ typedef struct pjsip_send_state
pj_bool_t *cont);
} pjsip_send_state;
-typedef void (*pjsip_endpt_callback)(pjsip_send_state*, pj_ssize_t sent,
- pj_bool_t *cont);
+
+typedef void (*pjsip_send_callback)(pjsip_send_state*, pj_ssize_t sent,
+ pj_bool_t *cont);
+
/**
* Send outgoing request statelessly The function will take care of which
* destination and transport to use based on the information in the message,
@@ -281,7 +283,81 @@ PJ_DECL(pj_status_t)
pjsip_endpt_send_request_stateless( pjsip_endpoint *endpt,
pjsip_tx_data *tdata,
void *token,
- pjsip_endpt_callback cb);
+ pjsip_send_callback cb);
+
+/**
+ * This is a low-level function to send raw data to a destination.
+ *
+ * See also #pjsip_endpt_send_raw_to_uri().
+ *
+ * @param endpt The SIP endpoint instance.
+ * @param tp_type Transport type.
+ * @param sel Optional pointer to transport selector instance if
+ * application wants to use a specific transport instance
+ * rather then letting transport manager finds the suitable
+ * transport..
+ * @param raw_data The data to be sent.
+ * @param data_len The length of the data.
+ * @param addr Destination address.
+ * @param addr_len Length of destination address.
+ * @param token Arbitrary token to be returned back to callback.
+ * @param cb Optional callback to be called to notify caller about
+ * the completion status of the pending send operation.
+ *
+ * @return If the message has been sent successfully, this function
+ * will return PJ_SUCCESS and the callback will not be
+ * called. If message cannot be sent immediately, this
+ * function will return PJ_EPENDING, and application will
+ * be notified later about the completion via the callback.
+ * Any statuses other than PJ_SUCCESS or PJ_EPENDING
+ * indicates immediate failure, and in this case the
+ * callback will not be called.
+ */
+PJ_DECL(pj_status_t) pjsip_endpt_send_raw(pjsip_endpoint *endpt,
+ pjsip_transport_type_e tp_type,
+ const pjsip_tpselector *sel,
+ const void *raw_data,
+ pj_size_t data_len,
+ const pj_sockaddr_t *addr,
+ int addr_len,
+ void *token,
+ pjsip_tp_send_callback cb);
+
+/**
+ * Send raw data to the specified destination URI. The actual destination
+ * address will be calculated from the URI, using normal SIP URI to host
+ * resolution.
+ *
+ * See also #pjsip_endpt_send_raw().
+ *
+ * @param endpt The SIP endpoint instance.
+ * @param dst_uri Destination address URI.
+ * @param sel Optional pointer to transport selector instance if
+ * application wants to use a specific transport instance
+ * rather then letting transport manager finds the suitable
+ * transport..
+ * @param raw_data The data to be sent.
+ * @param data_len The length of the data.
+ * @param token Arbitrary token to be returned back to callback.
+ * @param cb Optional callback to be called to notify caller about
+ * the completion status of the pending send operation.
+ *
+ * @return If the message has been sent successfully, this function
+ * will return PJ_SUCCESS and the callback will not be
+ * called. If message cannot be sent immediately, this
+ * function will return PJ_EPENDING, and application will
+ * be notified later about the completion via the callback.
+ * Any statuses other than PJ_SUCCESS or PJ_EPENDING
+ * indicates immediate failure, and in this case the
+ * callback will not be called.
+ */
+PJ_DECL(pj_status_t) pjsip_endpt_send_raw_to_uri(pjsip_endpoint *endpt,
+ const pj_str_t *dst_uri,
+ const pjsip_tpselector *sel,
+ const void *raw_data,
+ pj_size_t data_len,
+ void *token,
+ pjsip_tp_send_callback cb);
/**
* This structure describes destination information to send response.
@@ -357,7 +433,7 @@ PJ_DECL(pj_status_t) pjsip_endpt_send_response( pjsip_endpoint *endpt,
pjsip_response_addr *res_addr,
pjsip_tx_data *tdata,
void *token,
- pjsip_endpt_callback cb);
+ pjsip_send_callback cb);
/**
* This is a convenient function which wraps #pjsip_get_response_addr() and
@@ -380,7 +456,7 @@ PJ_DECL(pj_status_t) pjsip_endpt_send_response2(pjsip_endpoint *endpt,
pjsip_rx_data *rdata,
pjsip_tx_data *tdata,
void *token,
- pjsip_endpt_callback cb);
+ pjsip_send_callback cb);
/**
* This composite function sends response message statelessly to an incoming