Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Enumerations | Functions | Variables
nsHttp.cpp File Reference
#include "nsHttp.h"
#include "nsAutoLock.h"
#include "pldhash.h"
#include "nsCRT.h"
#include "nsHttpAtomList.h"

Go to the source code of this file.

Classes

struct  HttpHeapAtom

Defines

#define HTTP_ATOM(_name, _value)   nsHttpAtom nsHttp::_name = { _value };
#define HTTP_ATOM(_name, _value)   Unused_ ## _name,
#define HTTP_ATOM(_name, _value)   nsHttp::_name._val,

Enumerations

enum  { NUM_HTTP_ATOMS }

Functions

HttpHeapAtomNewHeapAtom (const char *value)
 StringHash (PLDHashTable *table, const void *key)
 StringCompare (PLDHashTable *table, const PLDHashEntryHdr *entry, const void *testKey)

Variables

static struct PLDHashTable = {0}
static struct HttpHeapAtomsHeapAtoms = nsnull
static PRLocksLock = nsnull
static const PLDHashTableOps ops
static const char kValidTokenMap [128]

Class Documentation

struct HttpHeapAtom

Definition at line 66 of file nsHttp.cpp.

Collaboration diagram for HttpHeapAtom:
Class Members
struct HttpHeapAtom * next
char value

Define Documentation

#define HTTP_ATOM (   _name,
  _value 
)    nsHttpAtom nsHttp::_name = { _value };

Definition at line 55 of file nsHttp.cpp.

#define HTTP_ATOM (   _name,
  _value 
)    Unused_ ## _name,

Definition at line 55 of file nsHttp.cpp.

#define HTTP_ATOM (   _name,
  _value 
)    nsHttp::_name._val,

Definition at line 55 of file nsHttp.cpp.


Enumeration Type Documentation

anonymous enum
Enumerator:
NUM_HTTP_ATOMS 

Definition at line 56 of file nsHttp.cpp.


Function Documentation

HttpHeapAtom* NewHeapAtom ( const char *  value)

Definition at line 76 of file nsHttp.cpp.

                               {
    int len = strlen(value);

    HttpHeapAtom *a =
        NS_REINTERPRET_CAST(HttpHeapAtom *, malloc(sizeof(*a) + len));
    if (!a)
        return nsnull;
    memcpy(a->value, value, len + 1);

    // add this heap atom to the list of all heap atoms
    a->next = sHeapAtoms;
    sHeapAtoms = a;

    return a;
}

Here is the call graph for this function:

StringCompare ( PLDHashTable table,
const PLDHashEntryHdr entry,
const void testKey 
)

Definition at line 103 of file nsHttp.cpp.

{
    const void *entryKey =
            NS_REINTERPRET_CAST(const PLDHashEntryStub *, entry)->key;

    return PL_strcasecmp(NS_REINTERPRET_CAST(const char *, entryKey),
                         NS_REINTERPRET_CAST(const char *, testKey)) == 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

StringHash ( PLDHashTable table,
const void key 
)

Definition at line 94 of file nsHttp.cpp.

{
    PLDHashNumber h = 0;
    for (const char *s = NS_REINTERPRET_CAST(const char*, key); *s; ++s)
        h = (h >> 28) ^ (h << 4) ^ nsCRT::ToLower(*s);
    return h;
}

Here is the call graph for this function:


Variable Documentation

const char kValidTokenMap[128] [static]
Initial value:
 {
    0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 

    0, 1, 0, 1, 1, 1, 1, 1, 
    0, 0, 1, 1, 0, 1, 1, 0, 
    1, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 0, 0, 0, 0, 0, 0, 

    0, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 1, 0, 0, 0, 1, 1, 

    1, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 1, 0, 1, 0, 1, 0  
}

Definition at line 232 of file nsHttp.cpp.

struct PLDHashTable = {0} [static]

Definition at line 71 of file nsHttp.cpp.

struct HttpHeapAtom* sHeapAtoms = nsnull [static]

Definition at line 72 of file nsHttp.cpp.

PRLock* sLock = nsnull [static]

Definition at line 73 of file nsHttp.cpp.