]>
git.saurik.com Git - apple/syslog.git/blob - libsystem_asl.tproj/include/asl_msg.h
2 * Copyright (c) 2009-2012 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
28 #include <asl_string.h>
30 #include <asl_object.h>
32 #define IndexNull ((uint32_t)-1)
34 #define ASL_MSG_PAGE_DATA_SIZE 830
35 #define ASL_MSG_PAGE_SLOTS 25
37 #define ASL_MSG_OFFSET_MASK 0x3fff
38 #define ASL_MSG_KV_MASK 0xc000
39 #define ASL_MSG_KV_INLINE 0x0000
40 #define ASL_MSG_KV_DICT 0x8000
41 #define ASL_MSG_KV_EXTERN 0x4000
43 #define ASL_MSG_SLOT_FREE 0xffff
45 #define ASL_STD_KEY_BASE 0x8000
46 #define ASL_STD_KEY_TIME 0x8001
47 #define ASL_STD_KEY_NANO 0x8002
48 #define ASL_STD_KEY_HOST 0x8003
49 #define ASL_STD_KEY_SENDER 0x8004
50 #define ASL_STD_KEY_FACILITY 0x8005
51 #define ASL_STD_KEY_PID 0x8006
52 #define ASL_STD_KEY_UID 0x8007
53 #define ASL_STD_KEY_GID 0x8008
54 #define ASL_STD_KEY_LEVEL 0x8009
55 #define ASL_STD_KEY_MESSAGE 0x800a
56 #define ASL_STD_KEY_READ_UID 0x800b
57 #define ASL_STD_KEY_READ_GID 0x800c
58 #define ASL_STD_KEY_SESSION 0x800d
59 #define ASL_STD_KEY_REF_PID 0x800e
60 #define ASL_STD_KEY_REF_PROC 0x800f
61 #define ASL_STD_KEY_MSG_ID 0x8010
62 #define ASL_STD_KEY_EXPIRE 0x8011
63 #define ASL_STD_KEY_OPTION 0x8012
64 #define ASL_STD_KEY_FREE_NOTE 0x8013
65 #define ASL_STD_KEY_LAST ASL_STD_KEY_FREE_NOTE
67 #define ASL_MT_KEY_BASE 0x8100
68 #define ASL_MT_KEY_DOMAIN 0x8101
69 #define ASL_MT_KEY_SCOPE 0x8102
70 #define ASL_MT_KEY_RESULT 0x8103
71 #define ASL_MT_KEY_SIG 0x8104
72 #define ASL_MT_KEY_SIG2 0x8105
73 #define ASL_MT_KEY_SIG3 0x8106
74 #define ASL_MT_KEY_SUCCESS 0x8107
75 #define ASL_MT_KEY_UUID 0x8108
76 #define ASL_MT_KEY_VAL 0x8109
77 #define ASL_MT_KEY_VAL2 0x810a
78 #define ASL_MT_KEY_VAL3 0x810b
79 #define ASL_MT_KEY_VAL4 0x810c
80 #define ASL_MT_KEY_VAL5 0x810d
81 #define ASL_MT_KEY_LAST ASL_MT_KEY_VAL5
83 #define ASL_PRIVATE_KEY_BASE 0x8200
85 typedef struct asl_msg_s
87 uint32_t asl_type
; //ASL OBJECT HEADER
88 int32_t refcount
; //ASL OBJECT HEADER
92 struct asl_msg_s
*next
;
93 uint16_t key
[ASL_MSG_PAGE_SLOTS
];
94 uint16_t val
[ASL_MSG_PAGE_SLOTS
];
95 uint16_t op
[ASL_MSG_PAGE_SLOTS
];
96 char data
[ASL_MSG_PAGE_DATA_SIZE
];
101 const asl_jump_table_t
*asl_msg_jump_table(void);
103 /* new/retain/release */
104 asl_msg_t
*asl_msg_new(uint32_t type
) __OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_4_3
);
105 asl_msg_t
*asl_msg_retain(asl_msg_t
*msg
) __OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_4_3
);
106 void asl_msg_release(asl_msg_t
*msg
) __OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_4_3
);
108 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
);
109 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
);
110 void asl_msg_unset(asl_msg_t
*msg
, const char *key
) __OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_4_3
);
111 void asl_msg_unset_index(asl_msg_t
*msg
, uint32_t n
) __OSX_AVAILABLE_STARTING(__MAC_10_10
, __IPHONE_7_0
);
113 asl_msg_t
*asl_msg_copy(asl_msg_t
*msg
) __OSX_AVAILABLE_STARTING(__MAC_10_8
, __IPHONE_5_1
);
114 asl_msg_t
*asl_msg_merge(asl_msg_t
*target
, asl_msg_t
*msg
) __OSX_AVAILABLE_STARTING(__MAC_10_8
, __IPHONE_5_1
);
116 int asl_msg_lookup(asl_msg_t
*msg
, const char *key
, const char **valout
, uint16_t *opout
) __OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_4_3
);
117 uint32_t asl_msg_fetch(asl_msg_t
*msg
, uint32_t n
, const char **keyout
, const char **valout
, uint16_t *opout
) __OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_4_3
);
118 const char *asl_msg_get_val_for_key(asl_msg_t
*msg
, const char *key
) __OSX_AVAILABLE_STARTING(__MAC_10_10
, __IPHONE_7_0
);
120 uint32_t asl_msg_type(asl_msg_t
*msg
) __OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_4_3
);
121 uint32_t asl_msg_count(asl_msg_t
*msg
) __OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_4_3
);
123 char *asl_msg_to_string(asl_msg_t
*in
, uint32_t *len
) __OSX_AVAILABLE_STARTING(__MAC_10_4
, __IPHONE_2_0
);
124 asl_msg_t
*asl_msg_from_string(const char *buf
) __OSX_AVAILABLE_STARTING(__MAC_10_8
, __IPHONE_7_0
);
126 char *asl_format_message(asl_msg_t
*msg
, const char *msg_fmt
, const char *time_fmt
, uint32_t text_encoding
, uint32_t *outlen
) __OSX_AVAILABLE_STARTING(__MAC_10_5
, __IPHONE_2_0
);
128 asl_string_t
*asl_msg_to_string_raw(uint32_t encoding
, asl_msg_t
*msg
, const char *tfmt
) __OSX_AVAILABLE_STARTING(__MAC_10_8
, __IPHONE_5_1
);
129 asl_string_t
* asl_string_append_asl_msg(asl_string_t
*str
, asl_msg_t
*msg
) __OSX_AVAILABLE_STARTING(__MAC_10_10
, __IPHONE_7_0
);
131 int asl_msg_cmp(asl_msg_t
*a
, asl_msg_t
*b
) __OSX_AVAILABLE_STARTING(__MAC_10_10
, __IPHONE_7_0
);
135 #endif /* __ASL_MSG_H__ */