Ignore:
Timestamp:
Jun 6, 2006 6:40:40 PM (18 years ago)
Author:
bennylp
Message:

Another huge chunks of modifications in PJSUA API, too many things to mention!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_reg.c

    r487 r492  
    9696 * Get account info. 
    9797 */ 
    98 PJ_DEF(pj_status_t) pjsua_acc_get_info( unsigned acc_index, 
     98PJ_DEF(pj_status_t) pjsua_acc_get_info( pjsua_acc_id acc_index, 
    9999                                        pjsua_acc_info *info) 
    100100{ 
     
    102102    pjsua_acc_config *acc_cfg = &pjsua.config.acc_config[acc_index]; 
    103103 
    104     PJ_ASSERT_RETURN(acc_index < pjsua.config.acc_cnt, PJ_EINVAL); 
    105  
     104    PJ_ASSERT_RETURN(info != NULL, PJ_EINVAL); 
     105     
    106106    pj_memset(info, 0, sizeof(pjsua_acc_info)); 
    107107 
     108    PJ_ASSERT_RETURN(acc_index < (int)pjsua.config.acc_cnt,  
     109                     PJ_EINVAL); 
     110    PJ_ASSERT_RETURN(pjsua.acc[acc_index].valid, PJ_EINVALIDOP); 
     111 
     112     
    108113    info->index = acc_index; 
    109114    info->acc_id = acc_cfg->id; 
     
    115120        pj_strerror(acc->reg_last_err, info->buf, sizeof(info->buf)); 
    116121        info->status_text = pj_str(info->buf); 
    117     } else { 
     122    } else if (acc->reg_last_code) { 
    118123        info->status = acc->reg_last_code; 
    119124        info->status_text = *pjsip_get_status_text(acc->reg_last_code); 
     125    } else { 
     126        info->status = 0; 
     127        info->status_text = pj_str("In Progress"); 
    120128    } 
    121129     
     
    130138 
    131139 
     140PJ_DEF(pj_status_t) pjsua_acc_enum_info( pjsua_acc_info info[], 
     141                                         unsigned *count ) 
     142{ 
     143    unsigned i, c; 
     144 
     145    for (i=0, c=0; c<*count && i<PJ_ARRAY_SIZE(pjsua.acc); ++i) { 
     146        if (!pjsua.acc[i].valid) 
     147            continue; 
     148 
     149        pjsua_acc_get_info(i, &info[c]); 
     150        ++c; 
     151    } 
     152 
     153    *count = c; 
     154    return PJ_SUCCESS; 
     155} 
     156 
     157 
     158/** 
     159 * Enum accounts id. 
     160 */ 
     161PJ_DEF(pj_status_t) pjsua_acc_enum_id( pjsua_acc_id ids[], 
     162                                       unsigned *count ) 
     163{ 
     164    unsigned i, c; 
     165 
     166    for (i=0, c=0; c<*count && i<PJ_ARRAY_SIZE(pjsua.acc); ++i) { 
     167        if (!pjsua.acc[i].valid) 
     168            continue; 
     169        ids[c] = i; 
     170        ++c; 
     171    } 
     172 
     173    *count = c; 
     174    return PJ_SUCCESS; 
     175} 
     176 
     177 
    132178/* 
    133179 * Update registration. If renew is false, then unregistration will be performed. 
    134180 */ 
    135 PJ_DECL(pj_status_t) pjsua_acc_set_registration(unsigned acc_index, pj_bool_t renew) 
     181PJ_DECL(pj_status_t) pjsua_acc_set_registration(pjsua_acc_id acc_index,  
     182                                                pj_bool_t renew) 
    136183{ 
    137184    pj_status_t status = 0; 
    138185    pjsip_tx_data *tdata = 0; 
     186 
     187    PJ_ASSERT_RETURN(acc_index < (int)pjsua.config.acc_cnt,  
     188                     PJ_EINVAL); 
     189    PJ_ASSERT_RETURN(pjsua.acc[acc_index].valid, PJ_EINVALIDOP); 
    139190 
    140191    if (renew) { 
Note: See TracChangeset for help on using the changeset viewer.