andre@0: /* This Source Code Form is subject to the terms of the Mozilla Public andre@0: * License, v. 2.0. If a copy of the MPL was not distributed with this andre@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ andre@0: /* andre@0: * pkix_pl_object.h andre@0: * andre@0: * Object Construction, Destruction and Callback Definitions andre@0: * andre@0: */ andre@0: andre@0: #ifndef _PKIX_PL_OBJECT_H andre@0: #define _PKIX_PL_OBJECT_H andre@0: andre@0: #include "pkix_pl_common.h" andre@0: andre@0: #ifdef __cplusplus andre@0: extern "C" { andre@0: #endif andre@0: andre@0: /* andre@0: * Object Implementation Notes: andre@0: * andre@0: * Allocating a new object creates an object header and a block of andre@0: * uninitialized user data. A pointer to this uninitialized data is andre@0: * returned to the user. The structure looks as follows: andre@0: * andre@0: * +--------------------+ andre@0: * | MAGIC HEADER | andre@0: * | (object header) | andre@0: * +--------------------+ andre@0: * | user data | -- pointer returned from PKIX_PL_Object_Alloc andre@0: * +--------------------+ andre@0: * andre@0: * Object operations receive a pointer to raw user data as an argument. andre@0: * The macro HEADER(object) returns a pointer to the object header. andre@0: * An assertion then verifies that the first field is the MAGIC_HEADER. andre@0: */ andre@0: andre@0: /* PKIX_PL_Object Structure Definition */ andre@0: struct PKIX_PL_ObjectStruct { andre@0: PRUint64 magicHeader; andre@0: PKIX_UInt32 type; andre@0: PKIX_Int32 references; andre@0: PRLock *lock; andre@0: PKIX_PL_String *stringRep; andre@0: PKIX_UInt32 hashcode; andre@0: PKIX_Boolean hashcodeCached; andre@0: }; andre@0: andre@0: /* see source file for function documentation */ andre@0: andre@0: PKIX_Error * andre@0: pkix_pl_Object_RetrieveEqualsCallback( andre@0: PKIX_PL_Object *object, andre@0: PKIX_PL_EqualsCallback *equalsCallback, andre@0: void *plContext); andre@0: andre@0: extern PKIX_Boolean initializing; andre@0: extern PKIX_Boolean initialized; andre@0: andre@0: #ifdef PKIX_USER_OBJECT_TYPE andre@0: andre@0: extern PRLock *classTableLock; andre@0: andre@0: #endif andre@0: andre@0: extern pkix_ClassTable_Entry systemClasses[PKIX_NUMTYPES]; andre@0: andre@0: PKIX_Error * andre@0: pkix_pl_Object_RegisterSelf(void *plContext); andre@0: andre@0: #ifdef __cplusplus andre@0: } andre@0: #endif andre@0: andre@0: #endif /* _PKIX_PL_OBJECT_H */