Ignore:
Timestamp:
Feb 24, 2010 5:43:34 AM (12 years ago)
Author:
nanang
Message:

Ticket #1032:

  • Initial version of server domain name verification:
    • Updated SSL certificate info, especially identities info
    • Updated verification mechanism as in the specifications in ticket desc.
    • Added server domain name info in pjsip_tx_data.
    • Added alternative API for acquiring transport and creating transport of transport factory to include pjsip_tx_data param.
    • Server identity match criteria:
      • full host name match
      • wild card not accepted
      • if identity is URI, it must be SIP/SIPS URI
  • Initial version of transport state notifications:
    • Added new API to set transport state callback in PJSIP and PJSUA.
    • Defined states: connected/disconnected, accepted/rejected, verification errors.
  • Minors:
    • Updated SSL socket test: dump verification result, test of requiring client cert, and few minors.
    • Updated test cert to include subjectAltName extensions.
    • Added SSL certificate dump function.
    • Updated max number of socket async operations in Symbian sample apps (RSocketServ::Connect()) to 32 (was default 8).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_transport_tcp.c

    r3035 r3106  
    166166    host_port->port = pj_sockaddr_get_port(addr); 
    167167} 
     168 
     169 
     170static void tcp_init_shutdown(struct tcp_transport *tcp, pj_status_t status) 
     171{ 
     172    pjsip_tp_state_callback *state_cb; 
     173 
     174    if (tcp->close_reason == PJ_SUCCESS) 
     175        tcp->close_reason = status; 
     176 
     177    if (tcp->base.is_shutdown) 
     178        return; 
     179 
     180    /* Notify application of transport disconnected state */ 
     181    state_cb = pjsip_tpmgr_get_status_cb(tcp->base.tpmgr); 
     182    if (state_cb) { 
     183        pjsip_transport_state_info state_info; 
     184 
     185        pj_bzero(&state_info, sizeof(state_info)); 
     186        state_info.status = tcp->close_reason; 
     187        (*state_cb)(&tcp->base, PJSIP_TP_STATE_DISCONNECTED, &state_info); 
     188    } 
     189 
     190    /* We can not destroy the transport since high level objects may 
     191     * still keep reference to this transport. So we can only  
     192     * instruct transport manager to gracefully start the shutdown 
     193     * procedure for this transport. 
     194     */ 
     195    pjsip_transport_shutdown(&tcp->base); 
     196} 
     197 
    168198 
    169199/* 
     
    922952    struct tcp_transport *tcp; 
    923953    char addr[PJ_INET6_ADDRSTRLEN+10]; 
     954    pjsip_tp_state_callback *state_cb; 
    924955    pj_status_t status; 
    925956 
     
    967998                pj_gettimeofday(&tcp->last_activity); 
    968999            } 
     1000 
     1001            /* Notify application of transport state accepted */ 
     1002            state_cb = pjsip_tpmgr_get_status_cb(tcp->base.tpmgr); 
     1003            if (state_cb) { 
     1004                pjsip_transport_state_info state_info; 
     1005             
     1006                pj_bzero(&state_info, sizeof(state_info)); 
     1007                (*state_cb)(&tcp->base, PJSIP_TP_STATE_ACCEPTED, &state_info); 
     1008            } 
    9691009        } 
    9701010    } 
     
    10141054        status = (bytes_sent == 0) ? PJ_RETURN_OS_ERROR(OSERR_ENOTCONN) : 
    10151055                                     -bytes_sent; 
    1016         if (tcp->close_reason==PJ_SUCCESS) tcp->close_reason = status; 
    1017         pjsip_transport_shutdown(&tcp->base); 
     1056 
     1057        tcp_init_shutdown(tcp, status); 
    10181058 
    10191059        return PJ_FALSE; 
     
    11101150                if (status == PJ_SUCCESS)  
    11111151                    status = PJ_RETURN_OS_ERROR(OSERR_ENOTCONN); 
    1112                 if (tcp->close_reason==PJ_SUCCESS) tcp->close_reason = status; 
    1113                 pjsip_transport_shutdown(&tcp->base); 
     1152 
     1153                tcp_init_shutdown(tcp, status); 
    11141154            } 
    11151155        } 
     
    12001240        PJ_LOG(4,(tcp->base.obj_name, "TCP connection closed")); 
    12011241         
    1202         /* We can not destroy the transport since high level objects may 
    1203          * still keep reference to this transport. So we can only  
    1204          * instruct transport manager to gracefully start the shutdown 
    1205          * procedure for this transport. 
    1206          */ 
    1207         if (tcp->close_reason==PJ_SUCCESS)  
    1208             tcp->close_reason = status; 
    1209         pjsip_transport_shutdown(&tcp->base); 
     1242        tcp_init_shutdown(tcp, status); 
    12101243 
    12111244        return PJ_FALSE; 
     
    12291262    pj_sockaddr_in addr; 
    12301263    int addrlen; 
     1264 
     1265    pjsip_tp_state_callback *state_cb; 
    12311266 
    12321267    tcp = (struct tcp_transport*) pj_activesock_get_user_data(asock); 
     
    12531288        } 
    12541289 
    1255         /* We can not destroy the transport since high level objects may 
    1256          * still keep reference to this transport. So we can only  
    1257          * instruct transport manager to gracefully start the shutdown 
    1258          * procedure for this transport. 
    1259          */ 
    1260         if (tcp->close_reason==PJ_SUCCESS) tcp->close_reason = status; 
    1261         pjsip_transport_shutdown(&tcp->base); 
    1262         return PJ_FALSE; 
     1290        tcp_init_shutdown(tcp, status); 
    12631291    } 
    12641292 
     
    12941322    status = tcp_start_read(tcp); 
    12951323    if (status != PJ_SUCCESS) { 
    1296         /* We can not destroy the transport since high level objects may 
    1297          * still keep reference to this transport. So we can only  
    1298          * instruct transport manager to gracefully start the shutdown 
    1299          * procedure for this transport. 
    1300          */ 
    1301         if (tcp->close_reason==PJ_SUCCESS) tcp->close_reason = status; 
    1302         pjsip_transport_shutdown(&tcp->base); 
     1324        tcp_init_shutdown(tcp, status); 
    13031325        return PJ_FALSE; 
     1326    } 
     1327 
     1328    /* Notify application of transport state connected */ 
     1329    state_cb = pjsip_tpmgr_get_status_cb(tcp->base.tpmgr); 
     1330    if (state_cb) { 
     1331        pjsip_transport_state_info state_info; 
     1332     
     1333        pj_bzero(&state_info, sizeof(state_info)); 
     1334        (*state_cb)(&tcp->base, PJSIP_TP_STATE_CONNECTED, &state_info); 
    13041335    } 
    13051336 
     
    13591390        tcp_perror(tcp->base.obj_name,  
    13601391                   "Error sending keep-alive packet", status); 
    1361         pjsip_transport_shutdown(&tcp->base); 
     1392        tcp_init_shutdown(tcp, status); 
    13621393        return; 
    13631394    } 
Note: See TracChangeset for help on using the changeset viewer.