]>
Commit | Line | Data |
---|---|---|
81582353 A |
1 | /* |
2 | * Copyright (c) 2009-2012 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> | |
5222c21d A |
28 | #include <xpc/xpc.h> |
29 | #include <asl.h> | |
f3df4c03 | 30 | #include <asl_string.h> |
81582353 | 31 | #include <asl_core.h> |
f3df4c03 | 32 | #include <asl_object.h> |
81582353 A |
33 | |
34 | #define IndexNull ((uint32_t)-1) | |
35 | ||
5222c21d A |
36 | #define ASL_MSG_PAGE_DATA_SIZE 220 |
37 | ||
38 | #define ASL_MSG_KVO_COUNT 30 | |
39 | // ASL_MSG_KVO_QUERY_SLOTS = ASL_MSG_KVO_COUNT / 3; | |
40 | #define ASL_MSG_KVO_QUERY_SLOTS 10 | |
41 | // ASL_MSG_KVO_MSG_SLOTS = ASL_MSG_KVO_COUNT / 2; | |
42 | #define ASL_MSG_KVO_MSG_SLOTS 15 | |
81582353 A |
43 | |
44 | #define ASL_MSG_OFFSET_MASK 0x3fff | |
45 | #define ASL_MSG_KV_MASK 0xc000 | |
46 | #define ASL_MSG_KV_INLINE 0x0000 | |
47 | #define ASL_MSG_KV_DICT 0x8000 | |
48 | #define ASL_MSG_KV_EXTERN 0x4000 | |
49 | ||
50 | #define ASL_MSG_SLOT_FREE 0xffff | |
51 | ||
52 | #define ASL_STD_KEY_BASE 0x8000 | |
53 | #define ASL_STD_KEY_TIME 0x8001 | |
54 | #define ASL_STD_KEY_NANO 0x8002 | |
55 | #define ASL_STD_KEY_HOST 0x8003 | |
56 | #define ASL_STD_KEY_SENDER 0x8004 | |
57 | #define ASL_STD_KEY_FACILITY 0x8005 | |
58 | #define ASL_STD_KEY_PID 0x8006 | |
59 | #define ASL_STD_KEY_UID 0x8007 | |
60 | #define ASL_STD_KEY_GID 0x8008 | |
61 | #define ASL_STD_KEY_LEVEL 0x8009 | |
62 | #define ASL_STD_KEY_MESSAGE 0x800a | |
63 | #define ASL_STD_KEY_READ_UID 0x800b | |
64 | #define ASL_STD_KEY_READ_GID 0x800c | |
65 | #define ASL_STD_KEY_SESSION 0x800d | |
66 | #define ASL_STD_KEY_REF_PID 0x800e | |
67 | #define ASL_STD_KEY_REF_PROC 0x800f | |
68 | #define ASL_STD_KEY_MSG_ID 0x8010 | |
69 | #define ASL_STD_KEY_EXPIRE 0x8011 | |
70 | #define ASL_STD_KEY_OPTION 0x8012 | |
f3df4c03 A |
71 | #define ASL_STD_KEY_FREE_NOTE 0x8013 |
72 | #define ASL_STD_KEY_LAST ASL_STD_KEY_FREE_NOTE | |
81582353 A |
73 | |
74 | #define ASL_MT_KEY_BASE 0x8100 | |
75 | #define ASL_MT_KEY_DOMAIN 0x8101 | |
76 | #define ASL_MT_KEY_SCOPE 0x8102 | |
77 | #define ASL_MT_KEY_RESULT 0x8103 | |
78 | #define ASL_MT_KEY_SIG 0x8104 | |
79 | #define ASL_MT_KEY_SIG2 0x8105 | |
80 | #define ASL_MT_KEY_SIG3 0x8106 | |
81 | #define ASL_MT_KEY_SUCCESS 0x8107 | |
82 | #define ASL_MT_KEY_UUID 0x8108 | |
83 | #define ASL_MT_KEY_VAL 0x8109 | |
84 | #define ASL_MT_KEY_VAL2 0x810a | |
85 | #define ASL_MT_KEY_VAL3 0x810b | |
86 | #define ASL_MT_KEY_VAL4 0x810c | |
87 | #define ASL_MT_KEY_VAL5 0x810d | |
88 | #define ASL_MT_KEY_LAST ASL_MT_KEY_VAL5 | |
89 | ||
90 | #define ASL_PRIVATE_KEY_BASE 0x8200 | |
91 | ||
92 | typedef struct asl_msg_s | |
93 | { | |
f3df4c03 A |
94 | uint32_t asl_type; //ASL OBJECT HEADER |
95 | int32_t refcount; //ASL OBJECT HEADER | |
81582353 A |
96 | uint32_t count; |
97 | uint32_t data_size; | |
f3df4c03 | 98 | uint64_t mem_size; |
81582353 | 99 | struct asl_msg_s *next; |
5222c21d A |
100 | #ifndef __LP64__ |
101 | uint32_t pad; | |
102 | #endif | |
103 | uint16_t kvo[ASL_MSG_KVO_COUNT]; | |
81582353 A |
104 | char data[ASL_MSG_PAGE_DATA_SIZE]; |
105 | } asl_msg_t; | |
106 | ||
f3df4c03 | 107 | __BEGIN_DECLS |
81582353 | 108 | |
f3df4c03 | 109 | const asl_jump_table_t *asl_msg_jump_table(void); |
81582353 | 110 | |
f3df4c03 | 111 | /* new/retain/release */ |
af7d442c A |
112 | asl_msg_t *asl_msg_new(uint32_t type) __API_DEPRECATED("os_log(3) has replaced asl(3)", macosx(10.7,10.12), ios(4.3,10.0), watchos(2.0,3.0), tvos(9.0,10.0)); |
113 | asl_msg_t *asl_msg_retain(asl_msg_t *msg) __API_DEPRECATED("os_log(3) has replaced asl(3)", macosx(10.7,10.12), ios(4.3,10.0), watchos(2.0,3.0), tvos(9.0,10.0)); | |
114 | void asl_msg_release(asl_msg_t *msg) __API_DEPRECATED("os_log(3) has replaced asl(3)", macosx(10.7,10.12), ios(4.3,10.0), watchos(2.0,3.0), tvos(9.0,10.0)); | |
81582353 | 115 | |
af7d442c A |
116 | int asl_msg_set_key_val(asl_msg_t *msg, const char *key, const char *val) __API_DEPRECATED("os_log(3) has replaced asl(3)", macosx(10.7,10.12), ios(4.3,10.0), watchos(2.0,3.0), tvos(9.0,10.0)); |
117 | int asl_msg_set_key_val_op(asl_msg_t *msg, const char *key, const char *val, uint32_t op) __API_DEPRECATED("os_log(3) has replaced asl(3)", macosx(10.7,10.12), ios(4.3,10.0), watchos(2.0,3.0), tvos(9.0,10.0)); | |
118 | void asl_msg_unset(asl_msg_t *msg, const char *key) __API_DEPRECATED("os_log(3) has replaced asl(3)", macosx(10.7,10.12), ios(4.3,10.0), watchos(2.0,3.0), tvos(9.0,10.0)); | |
119 | void asl_msg_unset_index(asl_msg_t *msg, uint32_t n) __API_DEPRECATED("os_log(3) has replaced asl(3)", macosx(10.10,10.12), ios(7.0,10.0), watchos(2.0,3.0), tvos(9.0,10.0)); | |
81582353 | 120 | |
af7d442c A |
121 | asl_msg_t *asl_msg_copy(asl_msg_t *msg) __API_DEPRECATED("os_log(3) has replaced asl(3)", macosx(10.8,10.12), ios(5.1,10.0), watchos(2.0,3.0), tvos(9.0,10.0)); |
122 | asl_msg_t *asl_msg_merge(asl_msg_t *target, asl_msg_t *msg) __API_DEPRECATED("os_log(3) has replaced asl(3)", macosx(10.8,10.12), ios(5.1,10.0), watchos(2.0,3.0), tvos(9.0,10.0)); | |
81582353 | 123 | |
af7d442c A |
124 | int asl_msg_lookup(asl_msg_t *msg, const char *key, const char **valout, uint16_t *opout) __API_DEPRECATED("os_log(3) has replaced asl(3)", macosx(10.7,10.12), ios(4.3,10.0), watchos(2.0,3.0), tvos(9.0,10.0)); |
125 | uint32_t asl_msg_fetch(asl_msg_t *msg, uint32_t n, const char **keyout, const char **valout, uint16_t *opout) __API_DEPRECATED("os_log(3) has replaced asl(3)", macosx(10.7,10.12), ios(4.3,10.0), watchos(2.0,3.0), tvos(9.0,10.0)); | |
126 | const char *asl_msg_get_val_for_key(asl_msg_t *msg, const char *key) __API_DEPRECATED("os_log(3) has replaced asl(3)", macosx(10.10,10.12), ios(7.0,10.0), watchos(2.0,3.0), tvos(9.0,10.0)); | |
81582353 | 127 | |
af7d442c A |
128 | uint32_t asl_msg_type(asl_msg_t *msg) __API_DEPRECATED("os_log(3) has replaced asl(3)", macosx(10.7,10.12), ios(4.3,10.0), watchos(2.0,3.0), tvos(9.0,10.0)); |
129 | uint32_t asl_msg_count(asl_msg_t *msg) __API_DEPRECATED("os_log(3) has replaced asl(3)", macosx(10.7,10.12), ios(4.3,10.0), watchos(2.0,3.0), tvos(9.0,10.0)); | |
81582353 | 130 | |
af7d442c A |
131 | char *asl_msg_to_string(asl_msg_t *in, uint32_t *len) __API_DEPRECATED("os_log(3) has replaced asl(3)", macosx(10.4,10.12), ios(2.0,10.0), watchos(2.0,3.0), tvos(9.0,10.0)); |
132 | asl_msg_t *asl_msg_from_string(const char *buf) __API_DEPRECATED("os_log(3) has replaced asl(3)", macosx(10.8,10.12), ios(7.0,10.0), watchos(2.0,3.0), tvos(9.0,10.0)); | |
81582353 | 133 | |
af7d442c | 134 | char *asl_format_message(asl_msg_t *msg, const char *msg_fmt, const char *time_fmt, uint32_t text_encoding, uint32_t *outlen) __API_DEPRECATED("os_log(3) has replaced asl(3)", macosx(10.5,10.12), ios(2.0,10.0), watchos(2.0,3.0), tvos(9.0,10.0)); |
81582353 | 135 | |
af7d442c A |
136 | asl_string_t *asl_msg_to_string_raw(uint32_t encoding, asl_msg_t *msg, const char *tfmt) __API_DEPRECATED("os_log(3) has replaced asl(3)", macosx(10.8,10.12), ios(5.1,10.0), watchos(2.0,3.0), tvos(9.0,10.0)); |
137 | asl_string_t * asl_string_append_asl_msg(asl_string_t *str, asl_msg_t *msg) __API_DEPRECATED("os_log(3) has replaced asl(3)", macosx(10.10,10.12), ios(7.0,10.0), watchos(2.0,3.0), tvos(9.0,10.0)); | |
f3df4c03 | 138 | |
af7d442c | 139 | int asl_msg_cmp(asl_msg_t *a, asl_msg_t *b) __API_DEPRECATED("os_log(3) has replaced asl(3)", macosx(10.10,10.12), ios(7.0,10.0), watchos(2.0,3.0), tvos(9.0,10.0)); |
f3df4c03 | 140 | |
5222c21d A |
141 | void _asl_log_args_to_xpc(asl_object_t client, asl_object_t msg, xpc_object_t dict); //TODO: ADD AVAILABLITY INFO |
142 | ||
f3df4c03 | 143 | __END_DECLS |
81582353 A |
144 | |
145 | #endif /* __ASL_MSG_H__ */ |