Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Friends
nsHostRecord Class Reference

nsHostRecord - ref counted object type stored in host resolver cache. More...

#include <nsHostResolver.h>

Inheritance diagram for nsHostRecord:
Inheritance graph
[legend]
Collaboration diagram for nsHostRecord:
Collaboration graph
[legend]

List of all members.

Public Member Functions

PRBool HasResult () const

Static Public Member Functions

static
NS_DECL_REFCOUNTED_THREADSAFE
nsresult 
Create (const nsHostKey *key, nsHostRecord **record)

Public Attributes

PRAddrInfoaddr_info
PRNetAddraddr
PRUint32 expiration
const char * host
PRUint16 flags
PRUint16 af

Private Member Functions

 ~nsHostRecord ()

Private Attributes

PRCList callbacks
PRBool resolving

Friends

class nsHostResolver

Detailed Description

nsHostRecord - ref counted object type stored in host resolver cache.

Definition at line 78 of file nsHostResolver.h.


Constructor & Destructor Documentation

Definition at line 186 of file nsHostResolver.cpp.

{
    if (addr_info)
        PR_FreeAddrInfo(addr_info);
    if (addr)
        free(addr);
}

Member Function Documentation

nsresult nsHostRecord::Create ( const nsHostKey key,
nsHostRecord **  record 
) [static]

Definition at line 160 of file nsHostResolver.cpp.

{
    size_t hostLen = strlen(key->host) + 1;
    size_t size = hostLen + sizeof(nsHostRecord);

    nsHostRecord *rec = (nsHostRecord*) ::operator new(size);
    if (!rec)
        return NS_ERROR_OUT_OF_MEMORY;

    rec->host = ((char *) rec) + sizeof(nsHostRecord);
    rec->flags = RES_KEY_FLAGS(key->flags);
    rec->af = key->af;

    rec->_refc = 1; // addref
    rec->addr_info = nsnull;
    rec->addr = nsnull;
    rec->expiration = NowInMinutes();
    rec->resolving = PR_FALSE;
    PR_INIT_CLIST(rec);
    PR_INIT_CLIST(&rec->callbacks);
    memcpy((char *) rec->host, key->host, hostLen);

    *result = rec;
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsHostRecord::HasResult ( ) const [inline]

Definition at line 99 of file nsHostResolver.h.

{ return (addr_info || addr) != nsnull; }

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class nsHostResolver [friend]

Definition at line 102 of file nsHostResolver.h.


Member Data Documentation

Definition at line 96 of file nsHostResolver.h.

Definition at line 95 of file nsHostResolver.h.

PRUint16 nsHostKey::af [inherited]

Definition at line 72 of file nsHostResolver.h.

PRCList nsHostRecord::callbacks [private]

Definition at line 104 of file nsHostResolver.h.

Definition at line 97 of file nsHostResolver.h.

Definition at line 71 of file nsHostResolver.h.

const char* nsHostKey::host [inherited]

Definition at line 70 of file nsHostResolver.h.

Definition at line 106 of file nsHostResolver.h.


The documentation for this class was generated from the following files: