Changeset 448


Ignore:
Timestamp:
May 16, 2006 1:20:00 PM (18 years ago)
Author:
bennylp
Message:

Rearrange transaction statefull stuffs in SIP so that it will not be linked when transaction is disabled

Location:
pjproject/trunk
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/build/Samples-vc.mak

    r439 r448  
    3636 
    3737 
    38 SAMPLES = $(BINDIR)\simpleua.exe $(BINDIR)\playfile.exe $(BINDIR)\playsine.exe\ 
    39           $(BINDIR)\confsample.exe $(BINDIR)\sndinfo.exe \ 
    40           $(BINDIR)\level.exe $(BINDIR)\recfile.exe  \ 
    41           $(BINDIR)\resampleplay.exe $(BINDIR)\siprtp.exe \ 
     38SAMPLES = $(BINDIR)\confsample.exe \ 
     39          $(BINDIR)\level.exe \ 
     40          $(BINDIR)\playfile.exe \ 
     41          $(BINDIR)\playsine.exe\ 
     42          $(BINDIR)\recfile.exe  \ 
     43          $(BINDIR)\resampleplay.exe \ 
     44          $(BINDIR)\simpleua.exe \ 
     45          $(BINDIR)\siprtp.exe \ 
     46          $(BINDIR)\sipstateless.exe \ 
     47          $(BINDIR)\sndinfo.exe \ 
    4248          $(BINDIR)\streamutil.exe 
    4349 
  • pjproject/trunk/pjsip-apps/build/Samples.mak

    r438 r448  
    3939BINDIR := ../bin/samples 
    4040 
    41 SAMPLES := simpleua playfile playsine confsample sndinfo level recfile resampleplay \ 
    42            siprtp streamutil 
     41SAMPLES := confsample \ 
     42           level \ 
     43           playfile \ 
     44           playsine \ 
     45           recfile \ 
     46           resampleplay \ 
     47           simpleua \ 
     48           siprtp \ 
     49           sipstateless \ 
     50           sndinfo \ 
     51           streamutil 
    4352 
    4453EXES := $(foreach file, $(SAMPLES), $(BINDIR)/$(file)-$(TARGET)$(HOST_EXE)) 
  • pjproject/trunk/pjsip-apps/build/samples.dsp

    r437 r448  
    123123# Begin Source File 
    124124 
     125SOURCE=..\src\samples\sipstateless.c 
     126# End Source File 
     127# Begin Source File 
     128 
    125129SOURCE=..\src\samples\sndinfo.c 
    126130# End Source File 
  • pjproject/trunk/pjsip-apps/src/samples/streamutil.c

    r412 r448  
    7575    pj_status_t status; 
    7676 
     77#if defined(PJMEDIA_HAS_G711_CODEC) && PJMEDIA_HAS_G711_CODEC!=0 
    7778    status = pjmedia_codec_g711_init(med_endpt); 
    7879    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 
    79  
     80#endif 
     81 
     82#if defined(PJMEDIA_HAS_GSM_CODEC) && PJMEDIA_HAS_GSM_CODEC!=0 
    8083    status = pjmedia_codec_gsm_init(med_endpt); 
    8184    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 
    82  
     85#endif 
     86 
     87#if defined(PJMEDIA_HAS_SPEEX_CODEC) && PJMEDIA_HAS_SPEEX_CODEC!=0 
    8388    status = pjmedia_codec_speex_init(med_endpt, 0, -1, -1); 
    8489    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 
    85  
     90#endif 
     91 
     92#if defined(PJMEDIA_HAS_L16_CODEC) && PJMEDIA_HAS_L16_CODEC!=0 
    8693    status = pjmedia_codec_l16_init(med_endpt, 0); 
    8794    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 
     95#endif 
    8896 
    8997    return PJ_SUCCESS; 
  • pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c

    r368 r448  
    104104pj_status_t pjsip_tel_uri_subsys_init(void); 
    105105 
    106 /* Defined in sip_util_statefull.c */ 
    107 extern pjsip_module mod_stateful_util; 
    108  
    109106 
    110107/* Specifies whether error subsystem has been registered to pjlib. */ 
     
    487484    pj_list_init(&endpt->cap_hdr); 
    488485 
    489     /* Register mod_stateful_util module (sip_util_statefull.c) */ 
    490     status = pjsip_endpt_register_module(endpt, &mod_stateful_util); 
    491     if (status != PJ_SUCCESS) 
    492         goto on_error; 
    493486 
    494487    /* Done. */ 
  • pjproject/trunk/pjsip/src/pjsip/sip_transaction.c

    r315 r448  
    3838#define TSX_TRACE_(expr) 
    3939#endif 
     40 
     41 
     42/* Defined in sip_util_statefull.c */ 
     43extern pjsip_module mod_stateful_util; 
    4044 
    4145 
     
    466470    } 
    467471 
     472    /* Register mod_stateful_util module (sip_util_statefull.c) */ 
     473    status = pjsip_endpt_register_module(endpt, &mod_stateful_util); 
     474    if (status != PJ_SUCCESS) { 
     475        return status; 
     476    } 
     477 
    468478    return PJ_SUCCESS; 
    469479} 
  • pjproject/trunk/pjsip/src/pjsip/sip_util.c

    r266 r448  
    12581258 
    12591259/* 
    1260  * Send response statefully. 
    1261  */ 
    1262 PJ_DEF(pj_status_t) pjsip_endpt_respond(  pjsip_endpoint *endpt, 
    1263                                           pjsip_module *tsx_user, 
    1264                                           pjsip_rx_data *rdata, 
    1265                                           int st_code, 
    1266                                           const pj_str_t *st_text, 
    1267                                           const pjsip_hdr *hdr_list, 
    1268                                           const pjsip_msg_body *body, 
    1269                                           pjsip_transaction **p_tsx ) 
    1270 { 
    1271     pj_status_t status; 
    1272     pjsip_tx_data *tdata; 
    1273     pjsip_transaction *tsx; 
    1274  
    1275     /* Validate arguments. */ 
    1276     PJ_ASSERT_RETURN(endpt && rdata, PJ_EINVAL); 
    1277  
    1278     if (p_tsx) *p_tsx = NULL; 
    1279  
    1280     /* Create response message */ 
    1281     status = pjsip_endpt_create_response( endpt, rdata, st_code, st_text,  
    1282                                           &tdata); 
    1283     if (status != PJ_SUCCESS) 
    1284         return status; 
    1285  
    1286     /* Add the message headers, if any */ 
    1287     if (hdr_list) { 
    1288         const pjsip_hdr *hdr = hdr_list->next; 
    1289         while (hdr != hdr_list) { 
    1290             pjsip_msg_add_hdr( tdata->msg, pjsip_hdr_clone(tdata->pool, hdr) ); 
    1291             hdr = hdr->next; 
    1292         } 
    1293     } 
    1294  
    1295     /* Add the message body, if any. */ 
    1296     if (body) { 
    1297         tdata->msg->body = pjsip_msg_body_clone( tdata->pool, body ); 
    1298         if (tdata->msg->body == NULL) { 
    1299             pjsip_tx_data_dec_ref(tdata); 
    1300             return status; 
    1301         } 
    1302     } 
    1303  
    1304     /* Create UAS transaction. */ 
    1305     status = pjsip_tsx_create_uas(tsx_user, rdata, &tsx); 
    1306     if (status != PJ_SUCCESS) { 
    1307         pjsip_tx_data_dec_ref(tdata); 
    1308         return status; 
    1309     } 
    1310  
    1311     /* Feed the request to the transaction. */ 
    1312     pjsip_tsx_recv_msg(tsx, rdata); 
    1313  
    1314     /* Send the message. */ 
    1315     status = pjsip_tsx_send_msg(tsx, tdata); 
    1316     if (status != PJ_SUCCESS) { 
    1317         pjsip_tx_data_dec_ref(tdata); 
    1318     } else if (p_tsx) { 
    1319         *p_tsx = tsx; 
    1320     } 
    1321  
    1322     return status; 
    1323 } 
    1324  
    1325  
    1326 /* 
    13271260 * Get the event string from the event ID. 
    13281261 */ 
  • pjproject/trunk/pjsip/src/pjsip/sip_util_statefull.c

    r230 r448  
    9090    PJ_ASSERT_RETURN(endpt && tdata && (timeout==-1 || timeout>0), PJ_EINVAL); 
    9191 
     92    /* Check that transaction layer module is registered to endpoint */ 
     93    PJ_ASSERT_RETURN(mod_stateful_util.id != -1, PJ_EINVALIDOP); 
     94 
     95 
    9296    status = pjsip_tsx_create_uac(&mod_stateful_util, tdata, &tsx); 
    9397    if (status != PJ_SUCCESS) { 
     
    106110} 
    107111 
     112 
     113/* 
     114 * Send response statefully. 
     115 */ 
     116PJ_DEF(pj_status_t) pjsip_endpt_respond(  pjsip_endpoint *endpt, 
     117                                          pjsip_module *tsx_user, 
     118                                          pjsip_rx_data *rdata, 
     119                                          int st_code, 
     120                                          const pj_str_t *st_text, 
     121                                          const pjsip_hdr *hdr_list, 
     122                                          const pjsip_msg_body *body, 
     123                                          pjsip_transaction **p_tsx ) 
     124{ 
     125    pj_status_t status; 
     126    pjsip_tx_data *tdata; 
     127    pjsip_transaction *tsx; 
     128 
     129    /* Validate arguments. */ 
     130    PJ_ASSERT_RETURN(endpt && rdata, PJ_EINVAL); 
     131 
     132    if (p_tsx) *p_tsx = NULL; 
     133 
     134    /* Create response message */ 
     135    status = pjsip_endpt_create_response( endpt, rdata, st_code, st_text,  
     136                                          &tdata); 
     137    if (status != PJ_SUCCESS) 
     138        return status; 
     139 
     140    /* Add the message headers, if any */ 
     141    if (hdr_list) { 
     142        const pjsip_hdr *hdr = hdr_list->next; 
     143        while (hdr != hdr_list) { 
     144            pjsip_msg_add_hdr( tdata->msg, pjsip_hdr_clone(tdata->pool, hdr) ); 
     145            hdr = hdr->next; 
     146        } 
     147    } 
     148 
     149    /* Add the message body, if any. */ 
     150    if (body) { 
     151        tdata->msg->body = pjsip_msg_body_clone( tdata->pool, body ); 
     152        if (tdata->msg->body == NULL) { 
     153            pjsip_tx_data_dec_ref(tdata); 
     154            return status; 
     155        } 
     156    } 
     157 
     158    /* Create UAS transaction. */ 
     159    status = pjsip_tsx_create_uas(tsx_user, rdata, &tsx); 
     160    if (status != PJ_SUCCESS) { 
     161        pjsip_tx_data_dec_ref(tdata); 
     162        return status; 
     163    } 
     164 
     165    /* Feed the request to the transaction. */ 
     166    pjsip_tsx_recv_msg(tsx, rdata); 
     167 
     168    /* Send the message. */ 
     169    status = pjsip_tsx_send_msg(tsx, tdata); 
     170    if (status != PJ_SUCCESS) { 
     171        pjsip_tx_data_dec_ref(tdata); 
     172    } else if (p_tsx) { 
     173        *p_tsx = tsx; 
     174    } 
     175 
     176    return status; 
     177} 
     178 
     179 
Note: See TracChangeset for help on using the changeset viewer.