Ignore:
Timestamp:
Jan 23, 2008 8:39:07 PM (16 years ago)
Author:
bennylp
Message:

Ticket #61: Implement SRTP support in PJMEDIA and PJSUA-LIB, and updated applications because of the changes. This is a major modification back ported from SRTP branch. See ticket #61 for changelog detail of this commit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/errno.c

    r1639 r1735  
    2424#endif 
    2525 
     26#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     27    const char* get_libsrtp_errstr(int err); 
     28#endif 
    2629 
    2730 
     
    142145    PJ_BUILD_ERR( PJMEDIA_ESNDINDEVID,      "Invalid sound device ID" ), 
    143146    PJ_BUILD_ERR( PJMEDIA_ESNDINSAMPLEFMT,  "Invalid sample format for sound device" ), 
     147 
     148#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     149    /* SRTP transport errors: */ 
     150    PJ_BUILD_ERR( PJMEDIA_SRTP_ECRYPTONOTMATCH, "SRTP crypto-suite name not match the offerer tag" ), 
     151    PJ_BUILD_ERR( PJMEDIA_SRTP_EINKEYLEN,       "Invalid SRTP key length for specific crypto" ), 
     152    PJ_BUILD_ERR( PJMEDIA_SRTP_ENOTSUPCRYPTO,   "Unsupported SRTP crypto-suite" ), 
     153    PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPAMBIGUEANS,  "SRTP SDP contains ambigue answer" ), 
     154    PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPDUPCRYPTOTAG,"Duplicated SRTP crypto tag" ), 
     155    PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPINCRYPTO,    "Invalid SRTP crypto attribute" ), 
     156    PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPINCRYPTOTAG, "Invalid SRTP crypto tag" ), 
     157    PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPINTRANSPORT, "Invalid SDP media transport for SRTP" ), 
     158    PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPREQCRYPTO,   "SRTP crypto attribute required" ), 
     159    PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPREQSECTP,    "Secure transport required in SDP media descriptor" ) 
     160#endif 
     161 
    144162}; 
    145163 
     
    160178    /* See if the error comes from PortAudio. */ 
    161179#if PJMEDIA_SOUND_IMPLEMENTATION==PJMEDIA_SOUND_PORTAUDIO_SOUND 
    162     if (statcode >= PJMEDIA_ERRNO_FROM_PORTAUDIO(paNotInitialized) && 
    163         statcode <  PJMEDIA_ERRNO_FROM_PORTAUDIO(paNotInitialized + 10000)) 
     180    if (statcode >= PJMEDIA_PORTAUDIO_ERRNO_START && 
     181        statcode <= PJMEDIA_PORTAUDIO_ERRNO_END) 
    164182    { 
    165183 
    166         int pa_err = statcode - PJMEDIA_ERRNO_FROM_PORTAUDIO(0); 
     184        //int pa_err = statcode - PJMEDIA_ERRNO_FROM_PORTAUDIO(0); 
     185        int pa_err = PJMEDIA_PORTAUDIO_ERRNO_START - statcode; 
    167186        pj_str_t msg; 
    168187         
     
    176195    } else  
    177196#endif  /* PJMEDIA_SOUND_IMPLEMENTATION */ 
     197 
     198#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     199    /* LIBSRTP error */ 
     200    if (statcode >= PJMEDIA_LIBSRTP_ERRNO_START && 
     201        statcode <  PJMEDIA_LIBSRTP_ERRNO_END) 
     202    { 
     203        int err = statcode - PJMEDIA_PORTAUDIO_ERRNO_START; 
     204        pj_str_t msg; 
     205         
     206        msg = pj_str((char*)get_libsrtp_errstr(err)); 
     207 
     208        pj_strncpy_with_null(&errstr, &msg, bufsize); 
     209        return errstr; 
     210     
     211    } else 
     212#endif 
     213     
     214    /* PJMEDIA error */ 
    178215    if (statcode >= PJMEDIA_ERRNO_START &&  
    179                statcode < PJMEDIA_ERRNO_START + PJ_ERRNO_SPACE_SIZE) 
     216               statcode < PJMEDIA_ERRNO_END) 
    180217    { 
    181218        /* Find the error in the table. 
     
    212249 
    213250        }  
    214     } 
    215  
     251    }  
    216252#endif  /* PJ_HAS_ERROR_STRING */ 
    217253 
Note: See TracChangeset for help on using the changeset viewer.