1#ifndef __ASL_OBJECT_H__
2#define __ASL_OBJECT_H__
3
4/*
5 * Copyright (c) 2007-2012 Apple Inc.  All rights reserved.
6 *
7 * @APPLE_LICENSE_HEADER_START@
8 *
9 * This file contains Original Code and/or Modifications of Original Code
10 * as defined in and that are subject to the Apple Public Source License
11 * Version 2.0 (the 'License'). You may not use this file except in
12 * compliance with the License. Please obtain a copy of the License at
13 * http://www.opensource.apple.com/apsl/ and read it before using this
14 * file.
15 *
16 * The Original Code and all software distributed under the License are
17 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
18 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
19 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
21 * Please see the License for the specific language governing rights and
22 * limitations under the License.
23 *
24 * @APPLE_LICENSE_HEADER_END@
25 */
26
27#include <stdlib.h>
28#include <stdint.h>
29
30/* generic object pointer */
31typedef struct _asl_object_s
32{
33	uint32_t asl_type;	//ASL OBJECT HEADER
34	int32_t refcount;	//ASL OBJECT HEADER
35	char asl_data[];
36} asl_object_private_t;
37
38#define ASL_OBJECT_HEADER_SIZE 8
39
40typedef struct asl_jump_table_s
41{
42	asl_object_private_t * (*alloc)(uint32_t type);
43	void (*dealloc)(asl_object_private_t *obj);
44	int (*set_key_val_op)(asl_object_private_t *obj, const char *key, const char *val, uint16_t op);
45	void (*unset_key)(asl_object_private_t *obj, const char *key);
46	int (*get_val_op_for_key)(asl_object_private_t *obj, const char *key, const char **val, uint16_t *op);
47	int (*get_key_val_op_at_index)(asl_object_private_t *obj, size_t n, const char **key, const char **val, uint16_t *op);
48	size_t (*count)(asl_object_private_t *obj);
49	asl_object_private_t *(*next)(asl_object_private_t *obj);
50	asl_object_private_t *(*prev)(asl_object_private_t *obj);
51	asl_object_private_t *(*get_object_at_index)(asl_object_private_t *obj, size_t n);
52	void (*set_iteration_index)(asl_object_private_t *obj, size_t n);
53	void (*remove_object_at_index)(asl_object_private_t *obj, size_t n);
54	void (*append)(asl_object_private_t *obj, asl_object_private_t *newobj);
55	void (*prepend)(asl_object_private_t *obj, asl_object_private_t *newobj);
56	asl_object_private_t *(*search)(asl_object_private_t *obj, asl_object_private_t *query);
57	asl_object_private_t *(*match)(asl_object_private_t *obj, asl_object_private_t *querylist, size_t *last, size_t start, size_t count, uint32_t duration, int32_t dir);
58} asl_jump_table_t;
59
60__BEGIN_DECLS
61
62int asl_object_set_key_val_op(asl_object_private_t *obj, const char *key, const char *val, uint16_t op);
63void asl_object_unset_key(asl_object_private_t *obj, const char *key);
64int asl_object_get_key_value_op(asl_object_private_t *obj, const char *key, const char **val, uint16_t *op);
65size_t asl_object_count(asl_object_private_t *obj);
66asl_object_private_t *asl_object_next(asl_object_private_t *obj);
67asl_object_private_t *asl_object_prev(asl_object_private_t *obj);
68asl_object_private_t *asl_object_get_object_at_index(asl_object_private_t *obj, size_t n);
69void asl_object_set_iteration_index(asl_object_private_t *obj, size_t n);
70void asl_object_remove_object_at_index(asl_object_private_t *obj, size_t n);
71void asl_object_append(asl_object_private_t *obj, asl_object_private_t *newobj);
72void asl_object_prepend(asl_object_private_t *obj, asl_object_private_t *newobj);
73asl_object_private_t *asl_object_search(asl_object_private_t *obj, asl_object_private_t *query);
74asl_object_private_t *asl_object_match(asl_object_private_t *obj, asl_object_private_t *querylist, size_t *last, size_t start, size_t count, uint32_t duration, int32_t dir);
75
76__END_DECLS
77
78#endif /* __ASL_OBJECT_H__ */
79