Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Private Attributes
nsZeroTerminatedCertArray Class Reference
Inheritance diagram for nsZeroTerminatedCertArray:
Inheritance graph
[legend]
Collaboration diagram for nsZeroTerminatedCertArray:
Collaboration graph
[legend]

List of all members.

Public Types

enum  CalledFromType { calledFromList, calledFromObject }

Public Member Functions

 nsZeroTerminatedCertArray ()
 ~nsZeroTerminatedCertArray ()
void virtualDestroyNSSReference ()
void destructorSafeDestroyNSSReference ()
PRBool allocate (PRUint32 count)
void set (PRUint32 i, CERTCertificate *c)
CERTCertificate * get (PRUint32 i)
CERTCertificate ** getRawArray ()
void shutdown (CalledFromType calledFrom)
PRBool isAlreadyShutDown ()

Private Attributes

CERTCertificate ** mCerts
PLArenaPoolmPoolp
PRUint32 mSize

Detailed Description

Definition at line 404 of file nsCMS.cpp.


Member Enumeration Documentation

Enumerator:
calledFromList 
calledFromObject 

Definition at line 270 of file nsNSSShutDown.h.


Constructor & Destructor Documentation

Definition at line 407 of file nsCMS.cpp.

Definition at line 412 of file nsCMS.cpp.

Here is the call graph for this function:


Member Function Documentation

Definition at line 445 of file nsCMS.cpp.

  {
    // only allow allocation once
    if (mPoolp)
      return PR_FALSE;
  
    mSize = count;

    if (!mSize)
      return PR_FALSE;
  
    mPoolp = PORT_NewArena(1024);
    if (!mPoolp)
      return PR_FALSE;

    mCerts = (CERTCertificate**)PORT_ArenaZAlloc(
      mPoolp, (count+1)*sizeof(CERTCertificate*));

    if (!mCerts)
      return PR_FALSE;

    // null array, including zero termination
    for (PRUint32 i = 0; i < count+1; i++) {
      mCerts[i] = nsnull;
    }

    return PR_TRUE;
  }

Here is the call graph for this function:

Definition at line 427 of file nsCMS.cpp.

  {
    if (isAlreadyShutDown())
      return;

    if (mCerts)
    {
      for (PRUint32 i=0; i < mSize; i++) {
        if (mCerts[i]) {
          CERT_DestroyCertificate(mCerts[i]);
        }
      }
    }

    if (mPoolp)
      PORT_FreeArena(mPoolp, PR_FALSE);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

CERTCertificate* nsZeroTerminatedCertArray::get ( PRUint32  i) [inline]

Definition at line 490 of file nsCMS.cpp.

  {
    nsNSSShutDownPreventionLock locker;
    if (isAlreadyShutDown())
      return nsnull;

    if (i >= mSize)
      return nsnull;
    
    return CERT_DupCertificate(mCerts[i]);
  }

Here is the call graph for this function:

CERTCertificate** nsZeroTerminatedCertArray::getRawArray ( ) [inline]

Definition at line 502 of file nsCMS.cpp.

  {
    nsNSSShutDownPreventionLock locker;
    if (isAlreadyShutDown())
      return nsnull;

    return mCerts;
  }

Here is the call graph for this function:

Definition at line 298 of file nsNSSShutDown.h.

{ return mAlreadyShutDown; }

Here is the caller graph for this function:

void nsZeroTerminatedCertArray::set ( PRUint32  i,
CERTCertificate *  c 
) [inline]

Definition at line 474 of file nsCMS.cpp.

  {
    nsNSSShutDownPreventionLock locker;
    if (isAlreadyShutDown())
      return;

    if (i >= mSize)
      return;
    
    if (mCerts[i]) {
      CERT_DestroyCertificate(mCerts[i]);
    }
    
    mCerts[i] = CERT_DupCertificate(c);
  }

Here is the call graph for this function:

void nsNSSShutDownObject::shutdown ( CalledFromType  calledFrom) [inline, inherited]

Definition at line 285 of file nsNSSShutDown.h.

  {
    if (!mAlreadyShutDown) {
      if (calledFromObject == calledFrom) {
        nsNSSShutDownList::forget(this);
      }
      if (calledFromList == calledFrom) {
        virtualDestroyNSSReference();
      }
      mAlreadyShutDown = PR_TRUE;
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Implements nsNSSShutDownObject.

Definition at line 422 of file nsCMS.cpp.

Here is the call graph for this function:


Member Data Documentation

CERTCertificate** nsZeroTerminatedCertArray::mCerts [private]

Definition at line 512 of file nsCMS.cpp.

Definition at line 513 of file nsCMS.cpp.

Definition at line 514 of file nsCMS.cpp.


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