Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Attributes
nsHttpAuthIdentity Class Reference

#include <nsHttpAuthCache.h>

List of all members.

Public Member Functions

 nsHttpAuthIdentity ()
 nsHttpAuthIdentity (const PRUnichar *domain, const PRUnichar *user, const PRUnichar *password)
 ~nsHttpAuthIdentity ()
const PRUnicharDomain () const
const PRUnicharUser () const
const PRUnicharPassword () const
nsresult Set (const PRUnichar *domain, const PRUnichar *user, const PRUnichar *password)
nsresult Set (const nsHttpAuthIdentity &other)
void Clear ()
PRBool Equals (const nsHttpAuthIdentity &other) const
PRBool IsEmpty () const

Private Attributes

PRUnicharmUser
PRUnicharmPass
PRUnicharmDomain

Detailed Description

Definition at line 62 of file nsHttpAuthCache.h.


Constructor & Destructor Documentation

Definition at line 65 of file nsHttpAuthCache.h.

nsHttpAuthIdentity::nsHttpAuthIdentity ( const PRUnichar domain,
const PRUnichar user,
const PRUnichar password 
) [inline]

Definition at line 71 of file nsHttpAuthCache.h.

Here is the call graph for this function:

Definition at line 78 of file nsHttpAuthCache.h.

    {
        Clear();
    }

Here is the call graph for this function:


Member Function Documentation

Definition at line 313 of file nsHttpAuthCache.cpp.

{
    if (mUser) {
        free(mUser);
        mUser = nsnull;
        mPass = nsnull;
        mDomain = nsnull;
    }
}

Here is the caller graph for this function:

Definition at line 83 of file nsHttpAuthCache.h.

{ return mDomain; }

Here is the caller graph for this function:

Definition at line 324 of file nsHttpAuthCache.cpp.

{
    // we could probably optimize this with a single loop, but why bother?
    return StrEquivalent(mUser, ident.mUser) &&
           StrEquivalent(mPass, ident.mPass) &&
           StrEquivalent(mDomain, ident.mDomain);
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsHttpAuthIdentity::IsEmpty ( void  ) const [inline]

Definition at line 94 of file nsHttpAuthCache.h.

{ return !mUser; }

Here is the caller graph for this function:

Definition at line 85 of file nsHttpAuthCache.h.

{ return mPass; }

Here is the caller graph for this function:

nsresult nsHttpAuthIdentity::Set ( const PRUnichar domain,
const PRUnichar user,
const PRUnichar password 
)

Definition at line 273 of file nsHttpAuthCache.cpp.

{
    PRUnichar *newUser, *newPass, *newDomain;

    int domainLen = domain ? nsCRT::strlen(domain) : 0;
    int userLen   = user   ? nsCRT::strlen(user)   : 0;
    int passLen   = pass   ? nsCRT::strlen(pass)   : 0; 

    int len = userLen + 1 + passLen + 1 + domainLen + 1;
    newUser = (PRUnichar *) malloc(len * sizeof(PRUnichar));
    if (!newUser)
        return NS_ERROR_OUT_OF_MEMORY;

    if (user)
        memcpy(newUser, user, userLen * sizeof(PRUnichar));
    newUser[userLen] = 0;

    newPass = &newUser[userLen + 1];
    if (pass)
        memcpy(newPass, pass, passLen * sizeof(PRUnichar));
    newPass[passLen] = 0;

    newDomain = &newPass[passLen + 1];
    if (domain)
        memcpy(newDomain, domain, domainLen * sizeof(PRUnichar));
    newDomain[domainLen] = 0;

    // wait until the end to clear member vars in case input params
    // reference our members!
    if (mUser)
        free(mUser);
    mUser = newUser;
    mPass = newPass;
    mDomain = newDomain;
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 90 of file nsHttpAuthCache.h.

{ return Set(other.mDomain, other.mUser, other.mPass); }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 84 of file nsHttpAuthCache.h.

{ return mUser; }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 100 of file nsHttpAuthCache.h.

Definition at line 99 of file nsHttpAuthCache.h.

Definition at line 98 of file nsHttpAuthCache.h.


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