diff options
author | Benny Prijono <bennylp@teluu.com> | 2008-07-21 18:12:51 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2008-07-21 18:12:51 +0000 |
commit | d96688e27a0e7d8c06ac3e399718a217daf6994e (patch) | |
tree | 3cbc487e7d28cf7d64f354aaeab6a4fb3967c606 /pjsip/include | |
parent | 76dabd42483b801576cfaa1f0d907e11dbf32c40 (diff) |
Ticket #576: Added user data in pjsua account and buddy
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2162 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/include')
-rw-r--r-- | pjsip/include/pjsua-lib/pjsua.h | 69 | ||||
-rw-r--r-- | pjsip/include/pjsua-lib/pjsua_internal.h | 1 |
2 files changed, 70 insertions, 0 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h index 326f5306..0d6322ea 100644 --- a/pjsip/include/pjsua-lib/pjsua.h +++ b/pjsip/include/pjsua-lib/pjsua.h @@ -2000,6 +2000,13 @@ PJ_DECL(pj_status_t) pjsua_transport_close( pjsua_transport_id id, typedef struct pjsua_acc_config { /** + * Arbitrary user data to be associated with the newly created account. + * Application may set this later with #pjsua_acc_set_user_data() and + * retrieve it with #pjsua_acc_get_user_data(). + */ + void *user_data; + + /** * Account priority, which is used to control the order of matching * incoming/outgoing requests. The higher the number means the higher * the priority is, and the account will be matched first. @@ -2396,6 +2403,29 @@ PJ_DECL(pj_status_t) pjsua_acc_add_local(pjsua_transport_id tid, pjsua_acc_id *p_acc_id); /** + * Set arbitrary data to be associated with the account. + * + * @param acc_id The account ID. + * @param user_data User/application data. + * + * @return PJ_SUCCESS on success, or the appropriate error code. + */ +PJ_DECL(pj_status_t) pjsua_acc_set_user_data(pjsua_acc_id acc_id, + void *user_data); + + +/** + * Retrieve arbitrary data associated with the account. + * + * @param acc_id The account ID. + * + * @return The user data. In the case where the account ID is + * not valid, NULL is returned. + */ +PJ_DECL(void*) pjsua_acc_get_user_data(pjsua_acc_id acc_id); + + +/** * Delete an account. This will unregister the account from the SIP server, * if necessary, and terminate server side presence subscriptions associated * with this account. @@ -3359,6 +3389,12 @@ typedef struct pjsua_buddy_config */ pj_bool_t subscribe; + /** + * Specify arbitrary application data to be associated with with + * the buddy object. + */ + void *user_data; + } pjsua_buddy_config; @@ -3518,6 +3554,16 @@ PJ_DECL(pj_status_t) pjsua_enum_buddies(pjsua_buddy_id ids[], unsigned *count); /** + * Find the buddy ID with the specified URI. + * + * @param uri The buddy URI. + * + * @return The buddy ID, or PJSUA_INVALID_ID if not found. + */ +PJ_DECL(pjsua_buddy_id) pjsua_buddy_find(const pj_str_t *uri); + + +/** * Get detailed buddy info. * * @param buddy_id The buddy identification. @@ -3535,6 +3581,29 @@ PJ_DECL(pj_status_t) pjsua_buddy_get_info(pjsua_buddy_id buddy_id, pjsua_buddy_info *info); /** + * Set the user data associated with the buddy object. + * + * @param buddy_id The buddy identification. + * @param user_data Arbitrary application data to be associated with + * the buddy object. + * + * @return PJ_SUCCESS on success, or the appropriate error code. + */ +PJ_DECL(pj_status_t) pjsua_buddy_set_user_data(pjsua_buddy_id buddy_id, + void *user_data); + + +/** + * Get the user data associated with the budy object. + * + * @param buddy_id The buddy identification. + * + * @return The application data. + */ +PJ_DECL(void*) pjsua_buddy_get_user_data(pjsua_buddy_id buddy_id); + + +/** * Add new buddy to the buddy list. If presence subscription is enabled * for this buddy, this function will also start the presence subscription * session immediately. diff --git a/pjsip/include/pjsua-lib/pjsua_internal.h b/pjsip/include/pjsua-lib/pjsua_internal.h index 7245469c..7e913969 100644 --- a/pjsip/include/pjsua-lib/pjsua_internal.h +++ b/pjsip/include/pjsua-lib/pjsua_internal.h @@ -164,6 +164,7 @@ typedef struct pjsua_buddy { pj_pool_t *pool; /**< Pool for this buddy. */ unsigned index; /**< Buddy index. */ + void *user_data; /**< Application data. */ pj_str_t uri; /**< Buddy URI. */ pj_str_t contact; /**< Contact learned from subscrp. */ pj_str_t name; /**< Buddy name. */ |