Changeset 2162 for pjproject/trunk
- Timestamp:
- Jul 21, 2008 6:12:51 PM (16 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r2150 r2162 2001 2001 { 2002 2002 /** 2003 * Arbitrary user data to be associated with the newly created account. 2004 * Application may set this later with #pjsua_acc_set_user_data() and 2005 * retrieve it with #pjsua_acc_get_user_data(). 2006 */ 2007 void *user_data; 2008 2009 /** 2003 2010 * Account priority, which is used to control the order of matching 2004 2011 * incoming/outgoing requests. The higher the number means the higher … … 2395 2402 pj_bool_t is_default, 2396 2403 pjsua_acc_id *p_acc_id); 2404 2405 /** 2406 * Set arbitrary data to be associated with the account. 2407 * 2408 * @param acc_id The account ID. 2409 * @param user_data User/application data. 2410 * 2411 * @return PJ_SUCCESS on success, or the appropriate error code. 2412 */ 2413 PJ_DECL(pj_status_t) pjsua_acc_set_user_data(pjsua_acc_id acc_id, 2414 void *user_data); 2415 2416 2417 /** 2418 * Retrieve arbitrary data associated with the account. 2419 * 2420 * @param acc_id The account ID. 2421 * 2422 * @return The user data. In the case where the account ID is 2423 * not valid, NULL is returned. 2424 */ 2425 PJ_DECL(void*) pjsua_acc_get_user_data(pjsua_acc_id acc_id); 2426 2397 2427 2398 2428 /** … … 3360 3390 pj_bool_t subscribe; 3361 3391 3392 /** 3393 * Specify arbitrary application data to be associated with with 3394 * the buddy object. 3395 */ 3396 void *user_data; 3397 3362 3398 } pjsua_buddy_config; 3363 3399 … … 3519 3555 3520 3556 /** 3557 * Find the buddy ID with the specified URI. 3558 * 3559 * @param uri The buddy URI. 3560 * 3561 * @return The buddy ID, or PJSUA_INVALID_ID if not found. 3562 */ 3563 PJ_DECL(pjsua_buddy_id) pjsua_buddy_find(const pj_str_t *uri); 3564 3565 3566 /** 3521 3567 * Get detailed buddy info. 3522 3568 * … … 3534 3580 PJ_DECL(pj_status_t) pjsua_buddy_get_info(pjsua_buddy_id buddy_id, 3535 3581 pjsua_buddy_info *info); 3582 3583 /** 3584 * Set the user data associated with the buddy object. 3585 * 3586 * @param buddy_id The buddy identification. 3587 * @param user_data Arbitrary application data to be associated with 3588 * the buddy object. 3589 * 3590 * @return PJ_SUCCESS on success, or the appropriate error code. 3591 */ 3592 PJ_DECL(pj_status_t) pjsua_buddy_set_user_data(pjsua_buddy_id buddy_id, 3593 void *user_data); 3594 3595 3596 /** 3597 * Get the user data associated with the budy object. 3598 * 3599 * @param buddy_id The buddy identification. 3600 * 3601 * @return The application data. 3602 */ 3603 PJ_DECL(void*) pjsua_buddy_get_user_data(pjsua_buddy_id buddy_id); 3604 3536 3605 3537 3606 /** -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h
r2150 r2162 165 165 pj_pool_t *pool; /**< Pool for this buddy. */ 166 166 unsigned index; /**< Buddy index. */ 167 void *user_data; /**< Application data. */ 167 168 pj_str_t uri; /**< Buddy URI. */ 168 169 pj_str_t contact; /**< Contact learned from subscrp. */ -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
r2142 r2162 160 160 } 161 161 162 163 162 /* Save the user and domain part. These will be used when finding an 164 163 * account for incoming requests. … … 383 382 384 383 return pjsua_acc_add(&cfg, is_default, p_acc_id); 384 } 385 386 387 /* 388 * Set arbitrary data to be associated with the account. 389 */ 390 PJ_DEF(pj_status_t) pjsua_acc_set_user_data(pjsua_acc_id acc_id, 391 void *user_data) 392 { 393 PJ_ASSERT_RETURN(acc_id>=0 && acc_id<(int)PJ_ARRAY_SIZE(pjsua_var.acc), 394 PJ_EINVAL); 395 PJ_ASSERT_RETURN(pjsua_var.acc[acc_id].valid, PJ_EINVALIDOP); 396 397 PJSUA_LOCK(); 398 399 pjsua_var.acc[acc_id].cfg.user_data = user_data; 400 401 PJSUA_UNLOCK(); 402 403 return PJ_SUCCESS; 404 } 405 406 407 /* 408 * Retrieve arbitrary data associated with the account. 409 */ 410 PJ_DEF(void*) pjsua_acc_get_user_data(pjsua_acc_id acc_id) 411 { 412 PJ_ASSERT_RETURN(acc_id>=0 && acc_id<(int)PJ_ARRAY_SIZE(pjsua_var.acc), 413 NULL); 414 PJ_ASSERT_RETURN(pjsua_var.acc[acc_id].valid, NULL); 415 416 return pjsua_var.acc[acc_id].cfg.user_data; 385 417 } 386 418 -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c
r2150 r2162 71 71 72 72 /* 73 * Find buddy. 74 */ 75 PJ_DEF(pjsua_buddy_id) pjsua_buddy_find(const pj_str_t *uri_str) 76 { 77 pj_str_t input; 78 pj_pool_t *pool; 79 pjsip_uri *uri; 80 pjsua_buddy_id buddy_id; 81 82 pool = pjsua_pool_create("buddyfind", 512, 512); 83 pj_strdup_with_null(pool, &input, uri_str); 84 85 uri = pjsip_parse_uri(pool, input.ptr, input.slen, 0); 86 if (!uri) 87 buddy_id = PJSUA_INVALID_ID; 88 else 89 buddy_id = pjsua_find_buddy(uri); 90 91 pj_pool_release(pool); 92 93 return buddy_id; 94 } 95 96 97 /* 73 98 * Check if buddy ID is valid. 74 99 */ … … 191 216 } 192 217 218 /* 219 * Set the user data associated with the buddy object. 220 */ 221 PJ_DEF(pj_status_t) pjsua_buddy_set_user_data( pjsua_buddy_id buddy_id, 222 void *user_data) 223 { 224 PJ_ASSERT_RETURN(buddy_id>=0 && 225 buddy_id<(int)PJ_ARRAY_SIZE(pjsua_var.buddy), 226 PJ_EINVAL); 227 228 PJSUA_LOCK(); 229 230 pjsua_var.buddy[buddy_id].user_data = user_data; 231 232 PJSUA_UNLOCK(); 233 234 return PJ_SUCCESS; 235 } 236 237 238 /* 239 * Get the user data associated with the budy object. 240 */ 241 PJ_DEF(void*) pjsua_buddy_get_user_data(pjsua_buddy_id buddy_id) 242 { 243 void *user_data; 244 245 PJ_ASSERT_RETURN(buddy_id>=0 && 246 buddy_id<(int)PJ_ARRAY_SIZE(pjsua_var.buddy), 247 NULL); 248 249 PJSUA_LOCK(); 250 251 user_data = pjsua_var.buddy[buddy_id].user_data; 252 253 PJSUA_UNLOCK(); 254 255 return user_data; 256 } 257 193 258 194 259 /* … … 289 354 if (pjsua_var.buddy[index].port == 0) 290 355 pjsua_var.buddy[index].port = 5060; 356 357 /* Save user data */ 358 pjsua_var.buddy[index].user_data = (void*)cfg->user_data; 291 359 292 360 if (p_buddy_id)
Note: See TracChangeset
for help on using the changeset viewer.