]>
Commit | Line | Data |
---|---|---|
1f2f436a A |
1 | /* |
2 | * Copyright (c) 2009-2010 Apple Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * This file contains Original Code and/or Modifications of Original Code | |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. Please obtain a copy of the License at | |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
11 | * file. | |
12 | * | |
13 | * The Original Code and all software distributed under the License are | |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
18 | * Please see the License for the specific language governing rights and | |
19 | * limitations under the License. | |
20 | * | |
21 | * @APPLE_LICENSE_HEADER_END@ | |
22 | */ | |
23 | ||
24 | #ifndef __ASL_MSG_H__ | |
25 | #define __ASL_MSG_H__ | |
26 | ||
27 | #include <stdint.h> | |
28 | ||
29 | #define IndexNull ((uint32_t)-1) | |
30 | ||
31 | #define ASL_MSG_PAGE_DATA_SIZE 800 | |
32 | #define ASL_MSG_PAGE_SLOTS 24 | |
33 | ||
34 | #define ASL_MSG_OFFSET_MASK 0x3fff | |
35 | #define ASL_MSG_KV_MASK 0xc000 | |
36 | #define ASL_MSG_KV_INLINE 0x0000 | |
37 | #define ASL_MSG_KV_DICT 0x8000 | |
38 | #define ASL_MSG_KV_EXTERN 0x4000 | |
39 | ||
40 | #define ASL_MSG_SLOT_FREE 0xffff | |
41 | ||
42 | #define ASL_STD_KEY_BASE 0x8000 | |
43 | #define ASL_STD_KEY_TIME 0x8001 | |
44 | #define ASL_STD_KEY_NANO 0x8002 | |
45 | #define ASL_STD_KEY_HOST 0x8003 | |
46 | #define ASL_STD_KEY_SENDER 0x8004 | |
47 | #define ASL_STD_KEY_FACILITY 0x8005 | |
48 | #define ASL_STD_KEY_PID 0x8006 | |
49 | #define ASL_STD_KEY_UID 0x8007 | |
50 | #define ASL_STD_KEY_GID 0x8008 | |
51 | #define ASL_STD_KEY_LEVEL 0x8009 | |
52 | #define ASL_STD_KEY_MESSAGE 0x800a | |
53 | #define ASL_STD_KEY_READ_UID 0x800b | |
54 | #define ASL_STD_KEY_READ_GID 0x800c | |
55 | #define ASL_STD_KEY_SESSION 0x800d | |
56 | #define ASL_STD_KEY_REF_PID 0x800e | |
57 | #define ASL_STD_KEY_REF_PROC 0x800f | |
58 | #define ASL_STD_KEY_MSG_ID 0x8010 | |
59 | #define ASL_STD_KEY_EXPIRE 0x8011 | |
60 | #define ASL_STD_KEY_OPTION 0x8012 | |
61 | #define ASL_STD_KEY_LAST ASL_STD_KEY_OPTION | |
62 | ||
63 | #define ASL_MT_KEY_BASE 0x8100 | |
64 | #define ASL_MT_KEY_DOMAIN 0x8101 | |
65 | #define ASL_MT_KEY_SCOPE 0x8102 | |
66 | #define ASL_MT_KEY_RESULT 0x8103 | |
67 | #define ASL_MT_KEY_SIG 0x8104 | |
68 | #define ASL_MT_KEY_SIG2 0x8105 | |
69 | #define ASL_MT_KEY_SIG3 0x8106 | |
70 | #define ASL_MT_KEY_SUCCESS 0x8107 | |
71 | #define ASL_MT_KEY_UUID 0x8108 | |
72 | #define ASL_MT_KEY_VAL 0x8109 | |
73 | #define ASL_MT_KEY_VAL2 0x810a | |
74 | #define ASL_MT_KEY_VAL3 0x810b | |
75 | #define ASL_MT_KEY_VAL4 0x810c | |
76 | #define ASL_MT_KEY_VAL5 0x810d | |
77 | #define ASL_MT_KEY_LAST ASL_MT_KEY_VAL5 | |
78 | ||
79 | #define ASL_PRIVATE_KEY_BASE 0x8200 | |
80 | ||
81 | #define ASL_MSG_TYPE_AUX_0 0 | |
82 | ||
83 | typedef struct | |
84 | { | |
85 | const char *level; | |
86 | const char *time; | |
87 | const char *nano; | |
88 | const char *host; | |
89 | const char *sender; | |
90 | const char *facility; | |
91 | const char *pid; | |
92 | const char *uid; | |
93 | const char *gid; | |
94 | const char *message; | |
95 | const char *option; | |
96 | const char *auxtitle; | |
97 | const char *auxuti; | |
98 | const char *auxurl; | |
99 | } asl_msg_aux_0_t; | |
100 | ||
101 | typedef struct | |
102 | { | |
103 | uint32_t type; | |
104 | union | |
105 | { | |
106 | asl_msg_aux_0_t *aux0; | |
107 | } data; | |
108 | } asl_msg_aux_t; | |
109 | ||
110 | typedef struct asl_msg_s | |
111 | { | |
112 | uint32_t type; | |
113 | int32_t refcount; | |
114 | uint32_t count; | |
115 | uint32_t data_size; | |
116 | void *aux; | |
117 | struct asl_msg_s *next; | |
118 | uint16_t key[ASL_MSG_PAGE_SLOTS]; | |
119 | uint16_t val[ASL_MSG_PAGE_SLOTS]; | |
120 | uint32_t op[ASL_MSG_PAGE_SLOTS]; | |
121 | char data[ASL_MSG_PAGE_DATA_SIZE]; | |
122 | } asl_msg_t; | |
123 | ||
124 | asl_msg_t *asl_msg_new(uint32_t type) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); | |
125 | asl_msg_t *asl_msg_retain(asl_msg_t *msg) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); | |
126 | void asl_msg_release(asl_msg_t *msg) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); | |
127 | ||
128 | int asl_msg_set_key_val(asl_msg_t *msg, const char *key, const char *val) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); | |
129 | int asl_msg_set_key_val_op(asl_msg_t *msg, const char *key, const char *val, uint32_t op) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); | |
130 | void asl_msg_unset(asl_msg_t *msg, const char *key) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); | |
131 | ||
132 | int asl_msg_lookup(asl_msg_t *msg, const char *key, const char **valout, uint32_t *opout) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); | |
133 | uint32_t asl_msg_fetch(asl_msg_t *msg, uint32_t n, const char **keyout, const char **valout, uint32_t *opout) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); | |
134 | ||
135 | uint32_t asl_msg_type(asl_msg_t *msg) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); | |
136 | uint32_t asl_msg_count(asl_msg_t *msg) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); | |
137 | ||
138 | #endif /* __ASL_MSG_H__ */ |