Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Functions | Variables
errormap.c File Reference
#include <nspr.h>
#include <ssl.h>
#include <ldap.h>
#include <ldap_ssl.h>
#include "secerr.h"
#include "sslerr.h"
#include "sslerrstrs.h"
#include "secerrstrs.h"
#include "prerrstrs.h"

Go to the source code of this file.

Classes

struct  tuple_str

Defines

#define NS_DIRECTORY   1
#define ER2(a, b)   {a, b},
#define ER3(a, b, c)   {a, c},

Typedefs

typedef struct tuple_str

Functions

static const char * SECU_Strerror (PRErrorCode errNum)
const char *LDAP_CALL ldapssl_err2string (const int prerrno)

Variables

const tuple_str errStrings []
const PRInt32 numStrings = sizeof(errStrings) / sizeof(tuple_str)

Class Documentation

struct tuple_str

Definition at line 105 of file errormap.c.

Class Members
CK_RV errNum
PRErrorCode errNum
const char * errString

Define Documentation

#define ER2 (   a,
  b 
)    {a, b},

Definition at line 112 of file errormap.c.

#define ER3 (   a,
  b,
  c 
)    {a, c},

Definition at line 113 of file errormap.c.

Definition at line 103 of file errormap.c.


Typedef Documentation

typedef struct tuple_str

Definition at line 110 of file errormap.c.


Function Documentation

Definition at line 74 of file errormap.c.

{
    const char       *s;

    if (( s = SECU_Strerror( (PRErrorCode)prerrno )) == NULL ) {
       s = "unknown";
    }

    return( s );
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const char * SECU_Strerror ( PRErrorCode  errNum) [static]

Definition at line 147 of file errormap.c.

                                  {
    PRInt32 low  = 0;
    PRInt32 high = numStrings - 1;
    PRInt32 i;
    PRErrorCode num;
    static int initDone;

    /* make sure table is in ascending order.
     * binary search depends on it.
     */
    if (!initDone) {
       PRErrorCode lastNum = 0x80000000;
       for (i = low; i <= high; ++i) {
           num = errStrings[i].errNum;
           if (num <= lastNum) {

/*
 * XXXceb
 * We aren't handling out of sequence errors.
 */


#if 0
#ifdef NS_DIRECTORY
              LDAPDebug( LDAP_DEBUG_ANY,
                     "sequence error in error strings at item %d\n"
                     "error %d (%s)\n",
                     i, lastNum, errStrings[i-1].errString );
              LDAPDebug( LDAP_DEBUG_ANY,
                     "should come after \n"
                     "error %d (%s)\n",
                     num, errStrings[i].errString, 0 );
#else /* NS_DIRECTORY */
              fprintf(stderr, 
"sequence error in error strings at item %d\n"
"error %d (%s)\n"
"should come after \n"
"error %d (%s)\n",
                      i, lastNum, errStrings[i-1].errString, 
                     num, errStrings[i].errString);
#endif /* NS_DIRECTORY */
#endif /* 0 */
           }
           lastNum = num;
       }
       initDone = 1;
    }

    /* Do binary search of table. */
    while (low + 1 < high) {
       i = (low + high) / 2;
       num = errStrings[i].errNum;
       if (errNum == num) 
           return errStrings[i].errString;
        if (errNum < num)
           high = i;
       else 
           low = i;
    }
    if (errNum == errStrings[low].errNum)
       return errStrings[low].errString;
    if (errNum == errStrings[high].errNum)
       return errStrings[high].errString;
    return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 118 of file errormap.c.

Definition at line 138 of file errormap.c.