summaryrefslogtreecommitdiff
path: root/pjsip/include/pjsip-simple
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-08-15 20:26:34 +0000
committerBenny Prijono <bennylp@teluu.com>2006-08-15 20:26:34 +0000
commit540278de72f88da8853d86dc3b655fe9bb3013b5 (patch)
treeda69840039428b7daa2f1806d9d72eae13d51157 /pjsip/include/pjsip-simple
parentab77e4d8b4ddc20d6018d67c739e3317e4746c49 (diff)
Support for PUBLISH (RFC 3903):
- API BREAK: pjsua_pres_create_uac() API CHANGED!! Added options in the function, to allow creating SUBSCRIBE without ";id=" parameter in the Event header. - the generic event publication in pjsip-simple/publish.[hc] - split PIDF and X-PIDF body generation and parsing into pjsip-simple/presence_body.c. - allow NULL in module parameter in pjsip_endpt_add_capability() - added "--publish" option in PJSUA. - by default, PJSUA-LIB will not add ";id=" parameter in Event header in the SUBSCRIBE request since lots of server and user agents don't support this correctly. - Set version to 0.5.7.6. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@685 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/include/pjsip-simple')
-rw-r--r--pjsip/include/pjsip-simple/presence.h74
-rw-r--r--pjsip/include/pjsip-simple/publish.h25
2 files changed, 96 insertions, 3 deletions
diff --git a/pjsip/include/pjsip-simple/presence.h b/pjsip/include/pjsip-simple/presence.h
index ee2805f4..668b723c 100644
--- a/pjsip/include/pjsip-simple/presence.h
+++ b/pjsip/include/pjsip-simple/presence.h
@@ -103,6 +103,8 @@ typedef struct pjsip_pres_status pjsip_pres_status;
* @param dlg The underlying dialog to use.
* @param user_cb Pointer to callbacks to receive presence subscription
* events.
+ * @param options Option flags. Currently only PJSIP_EVSUB_NO_EVENT_ID
+ * is recognized.
* @param p_evsub Pointer to receive the presence subscription
* session.
*
@@ -110,6 +112,7 @@ typedef struct pjsip_pres_status pjsip_pres_status;
*/
PJ_DECL(pj_status_t) pjsip_pres_create_uac( pjsip_dialog *dlg,
const pjsip_evsub_user *user_cb,
+ unsigned options,
pjsip_evsub **p_evsub );
@@ -265,6 +268,77 @@ PJ_DECL(pj_status_t) pjsip_pres_set_status( pjsip_evsub *sub,
/**
+ * This is a utility function to create PIDF message body from PJSIP
+ * presence status (pjsip_pres_status).
+ *
+ * @param pool The pool to allocate memory for the message body.
+ * @param status Presence status to be converted into PIDF message
+ * body.
+ * @param entity The entity ID, which normally is equal to the
+ * presentity ID publishing this presence info.
+ * @param p_body Pointer to receive the SIP message body.
+ *
+ * @return PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjsip_pres_create_pidf( pj_pool_t *pool,
+ const pjsip_pres_status *status,
+ const pj_str_t *entity,
+ pjsip_msg_body **p_body );
+
+
+/**
+ * This is a utility function to create X-PIDF message body from PJSIP
+ * presence status (pjsip_pres_status).
+ *
+ * @param pool The pool to allocate memory for the message body.
+ * @param status Presence status to be converted into X-PIDF message
+ * body.
+ * @param entity The entity ID, which normally is equal to the
+ * presentity ID publishing this presence info.
+ * @param p_body Pointer to receive the SIP message body.
+ *
+ * @return PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjsip_pres_create_xpidf(pj_pool_t *pool,
+ const pjsip_pres_status *status,
+ const pj_str_t *entity,
+ pjsip_msg_body **p_body );
+
+
+
+/**
+ * This is a utility function to parse PIDF body into PJSIP presence status.
+ *
+ * @param rdata The incoming SIP message containing the PIDF body.
+ * @param pool Pool to allocate memory to copy the strings into
+ * the presence status structure.
+ * @param status The presence status to be initialized.
+ *
+ * @return PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjsip_pres_parse_pidf(pjsip_rx_data *rdata,
+ pj_pool_t *pool,
+ pjsip_pres_status *status);
+
+
+
+/**
+ * This is a utility function to parse X-PIDF body into PJSIP presence status.
+ *
+ * @param rdata The incoming SIP message containing the X-PIDF body.
+ * @param pool Pool to allocate memory to copy the strings into
+ * the presence status structure.
+ * @param status The presence status to be initialized.
+ *
+ * @return PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjsip_pres_parse_xpidf(pjsip_rx_data *rdata,
+ pj_pool_t *pool,
+ pjsip_pres_status *status);
+
+
+
+/**
* @}
*/
diff --git a/pjsip/include/pjsip-simple/publish.h b/pjsip/include/pjsip-simple/publish.h
index 141bbf6a..bebc4d97 100644
--- a/pjsip/include/pjsip-simple/publish.h
+++ b/pjsip/include/pjsip-simple/publish.h
@@ -16,14 +16,16 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef __PJSIP_SIMPLE_PRESENCE_H__
-#define __PJSIP_SIMPLE_PRESENCE_H__
+#ifndef __PJSIP_SIMPLE_PUBLISH_H__
+#define __PJSIP_SIMPLE_PUBLISH_H__
/**
* @file publish.h
* @brief SIP Extension for Event State Publication (PUBLISH, RFC 3903)
*/
+#include <pjsip/sip_util.h>
+
PJ_BEGIN_DECL
@@ -38,6 +40,11 @@ PJ_BEGIN_DECL
Extension for Event State Publication (PUBLISH) as defined by RFC 3856.
*/
+/**
+ * The SIP PUBLISH method constant.
+ */
+extern const pjsip_method pjsip_publish_method;
+
/*****************************************************************************
* @defgroup PJSIP_SIMPLE_PUBLISH_CLIENT SIP Event State Publication Client
@@ -77,11 +84,22 @@ struct pjsip_publishc_cbparam
typedef void pjsip_publishc_cb(struct pjsip_publishc_cbparam *param);
+/**
+ * Initialize client publication module.
+ *
+ * @param endpt SIP endpoint.
+ *
+ * @return PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjsip_publishc_init_module(pjsip_endpoint *endpt);
+
+
/**
* Create client publication structure.
*
* @param endpt Endpoint, used to allocate pool from.
+ * @param options Option flags.
* @param token Opaque data to be associated with the client publication.
* @param cb Pointer to callback function to receive publication status.
* @param p_pubc Pointer to receive client publication structure.
@@ -89,6 +107,7 @@ typedef void pjsip_publishc_cb(struct pjsip_publishc_cbparam *param);
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjsip_publishc_create( pjsip_endpoint *endpt,
+ unsigned options,
void *token,
pjsip_publishc_cb *cb,
pjsip_publishc **p_pubc);
@@ -248,5 +267,5 @@ PJ_DECL(pj_status_t) pjsip_publishc_send(pjsip_publishc *pubc,
PJ_END_DECL
-#endif /* __PJSIP_SIMPLE_PRESENCE_H__ */
+#endif /* __PJSIP_SIMPLE_PUBLISH_H__ */