Path: blob/main/crypto/heimdal/base/heimbasepriv.h
34859 views
/*1* Copyright (c) 2010 Kungliga Tekniska Högskolan2* (Royal Institute of Technology, Stockholm, Sweden).3* All rights reserved.4*5* Portions Copyright (c) 2010 Apple Inc. All rights reserved.6*7* Redistribution and use in source and binary forms, with or without8* modification, are permitted provided that the following conditions9* are met:10*11* 1. Redistributions of source code must retain the above copyright12* notice, this list of conditions and the following disclaimer.13*14* 2. Redistributions in binary form must reproduce the above copyright15* notice, this list of conditions and the following disclaimer in the16* documentation and/or other materials provided with the distribution.17*18* 3. Neither the name of the Institute nor the names of its contributors19* may be used to endorse or promote products derived from this software20* without specific prior written permission.21*22* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND23* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE24* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE25* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE26* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL27* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS28* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)29* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT30* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY31* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF32* SUCH DAMAGE.33*/3435typedef void (*heim_type_init)(void *);36typedef heim_object_t (*heim_type_copy)(void *);37typedef int (*heim_type_cmp)(void *, void *);38typedef unsigned long (*heim_type_hash)(void *);3940typedef struct heim_type_data *heim_type_t;4142enum {43HEIM_TID_NUMBER = 0,44HEIM_TID_NULL = 1,45HEIM_TID_BOOL = 2,46HEIM_TID_TAGGED_UNUSED2 = 3,47HEIM_TID_TAGGED_UNUSED3 = 4,48HEIM_TID_TAGGED_UNUSED4 = 5,49HEIM_TID_TAGGED_UNUSED5 = 6,50HEIM_TID_TAGGED_UNUSED6 = 7,51HEIM_TID_MEMORY = 128,52HEIM_TID_ARRAY = 129,53HEIM_TID_DICT = 130,54HEIM_TID_STRING = 131,55HEIM_TID_AUTORELEASE = 132,56HEIM_TID_USER = 2555758};5960struct heim_type_data {61heim_tid_t tid;62const char *name;63heim_type_init init;64heim_type_dealloc dealloc;65heim_type_copy copy;66heim_type_cmp cmp;67heim_type_hash hash;68};6970heim_type_t _heim_get_isa(heim_object_t);7172heim_type_t73_heim_create_type(const char *name,74heim_type_init init,75heim_type_dealloc dealloc,76heim_type_copy copy,77heim_type_cmp cmp,78heim_type_hash hash);7980heim_object_t81_heim_alloc_object(heim_type_t type, size_t size);8283heim_tid_t84_heim_type_get_tid(heim_type_t type);8586/* tagged tid */87extern struct heim_type_data _heim_null_object;88extern struct heim_type_data _heim_bool_object;89extern struct heim_type_data _heim_number_object;90extern struct heim_type_data _heim_string_object;919293