Ignore:
Timestamp:
Jan 18, 2008 8:14:17 PM (16 years ago)
Author:
nanang
Message:

Ticket #452:
Updated errno.h & .c to accomodate SRTP Transport & libsrtp error code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/users/nanang/pjmedia/src/pjmedia/errno.c

    r1700 r1710  
    2424#endif 
    2525 
     26#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     27    pj_str_t srtp_transport_getliberrstr(int err); 
     28#endif 
    2629 
    2730 
     
    144147 
    145148    /* SRTP transport errors: */ 
    146     PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPREQSECTP,   "Secure transport required in SDP media descriptor" ), 
    147     PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPAMBIGUEANS, "SDP contains ambigue answer" ), 
    148      
     149    PJ_BUILD_ERR( PJMEDIA_SRTP_ECRYPTONOTMATCH, "SRTP crypto-suite name not match the offerer tag" ), 
     150    PJ_BUILD_ERR( PJMEDIA_SRTP_EINKEYLEN,       "Invalid SRTP key length for specific crypto" ), 
     151    PJ_BUILD_ERR( PJMEDIA_SRTP_ENOTSUPCRYPTO,   "Unsupported SRTP crypto-suite" ), 
     152    PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPAMBIGUEANS,  "SRTP SDP contains ambigue answer" ), 
     153    PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPDUPCRYPTOTAG,"Duplicated SRTP crypto tag" ), 
     154    PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPINCRYPTO,    "Invalid SRTP crypto attribute" ), 
     155    PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPINCRYPTOTAG, "Invalid SRTP crypto tag" ), 
     156    PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPINTRANSPORT, "Invalid SDP media transport for SRTP" ), 
     157    PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPREQCRYPTO,   "SRTP crypto attribute required in SDP" ), 
     158    PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPREQSECTP,    "Secure transport required in SDP media descriptor" ) 
    149159}; 
    150160 
     
    165175    /* See if the error comes from PortAudio. */ 
    166176#if PJMEDIA_SOUND_IMPLEMENTATION==PJMEDIA_SOUND_PORTAUDIO_SOUND 
    167     if (statcode >= PJMEDIA_ERRNO_FROM_PORTAUDIO(paNotInitialized) && 
    168         statcode <  PJMEDIA_ERRNO_FROM_PORTAUDIO(paNotInitialized + 10000)) 
     177    if (statcode >= PJMEDIA_PORTAUDIO_ERRNO_START && 
     178        statcode <= PJMEDIA_PORTAUDIO_ERRNO_END) 
    169179    { 
    170180 
    171         int pa_err = statcode - PJMEDIA_ERRNO_FROM_PORTAUDIO(0); 
     181        //int pa_err = statcode - PJMEDIA_ERRNO_FROM_PORTAUDIO(0); 
     182        int pa_err = PJMEDIA_PORTAUDIO_ERRNO_START - statcode; 
    172183        pj_str_t msg; 
    173184         
     
    181192    } else  
    182193#endif  /* PJMEDIA_SOUND_IMPLEMENTATION */ 
     194 
     195#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     196    /* LIBSRTP error */ 
     197    if (statcode >= PJMEDIA_LIBSRTP_ERRNO_START && 
     198        statcode <  PJMEDIA_LIBSRTP_ERRNO_END) 
     199    { 
     200        int err = statcode - PJMEDIA_PORTAUDIO_ERRNO_START; 
     201        pj_str_t msg; 
     202         
     203        msg = srtp_transport_getliberrstr(err); 
     204 
     205        errstr.ptr = buf; 
     206        pj_strncpy_with_null(&errstr, &msg, bufsize); 
     207        return errstr; 
     208     
     209    } else 
     210#endif 
     211     
     212    /* PJMEDIA error */ 
    183213    if (statcode >= PJMEDIA_ERRNO_START &&  
    184                statcode < PJMEDIA_ERRNO_START + PJ_ERRNO_SPACE_SIZE) 
     214               statcode < PJMEDIA_ERRNO_END) 
    185215    { 
    186216        /* Find the error in the table. 
     
    217247 
    218248        }  
    219     } 
    220  
     249    }  
    221250#endif  /* PJ_HAS_ERROR_STRING */ 
    222251 
Note: See TracChangeset for help on using the changeset viewer.