]> git.saurik.com Git - apple/syslog.git/blob - libsystem_asl.tproj/include/asl_core.h
3b29a4a606b6239debe43a201e65165db9d90503
[apple/syslog.git] / libsystem_asl.tproj / include / asl_core.h
1 #ifndef __ASL_CORE_H__
2 #define __ASL_CORE_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 #include <time.h>
30 #include <mach/mach.h>
31 #include <Availability.h>
32
33 typedef uint32_t ASL_STATUS;
34
35 #define ASL_STATUS_OK 0
36 #define ASL_STATUS_INVALID_ARG 1
37 #define ASL_STATUS_INVALID_STORE 2
38 #define ASL_STATUS_INVALID_STRING 3
39 #define ASL_STATUS_INVALID_ID 4
40 #define ASL_STATUS_INVALID_MESSAGE 5
41 #define ASL_STATUS_NOT_FOUND 6
42 #define ASL_STATUS_READ_FAILED 7
43 #define ASL_STATUS_WRITE_FAILED 8
44 #define ASL_STATUS_NO_MEMORY 9
45 #define ASL_STATUS_ACCESS_DENIED 10
46 #define ASL_STATUS_READ_ONLY 11
47 #define ASL_STATUS_WRITE_ONLY 12
48 #define ASL_STATUS_MATCH_FAILED 13
49 #define ASL_STATUS_NO_RECORDS 14
50 #define ASL_STATUS_INVALID_TYPE 15
51 #define ASL_STATUS_FAILED 9999
52
53 #define ASL_REF_NULL 0xffffffffffffffffLL
54
55 #define ASL_MSG_FLAG_READ_UID_SET 0x0001
56 #define ASL_MSG_FLAG_READ_GID_SET 0x0002
57 #define ASL_MSG_FLAG_SEARCH_MATCH 0x8000
58 #define ASL_MSG_FLAG_SEARCH_CLEAR 0x7fff
59
60 #define ASL_QUERY_MATCH_SLOW 0x00000000
61 #define ASL_QUERY_MATCH_MSG_ID 0x00000001
62 #define ASL_QUERY_MATCH_TIME 0x00000002
63 #define ASL_QUERY_MATCH_NANO 0x00000004
64 #define ASL_QUERY_MATCH_LEVEL 0x00000008
65 #define ASL_QUERY_MATCH_PID 0x00000010
66 #define ASL_QUERY_MATCH_UID 0x00000020
67 #define ASL_QUERY_MATCH_GID 0x00000040
68 #define ASL_QUERY_MATCH_RUID 0x00000080
69 #define ASL_QUERY_MATCH_RGID 0x00000100
70 #define ASL_QUERY_MATCH_REF_PID 0x00000200
71 #define ASL_QUERY_MATCH_HOST 0x00000400
72 #define ASL_QUERY_MATCH_SENDER 0x00000800
73 #define ASL_QUERY_MATCH_SMUUID 0x00001000
74 #define ASL_QUERY_MATCH_FACILITY 0x00002000
75 #define ASL_QUERY_MATCH_MESSAGE 0x00004000
76 #define ASL_QUERY_MATCH_REF_PROC 0x00008000
77 #define ASL_QUERY_MATCH_SESSION 0x00010000
78 #define ASL_QUERY_MATCH_TRUE 0x80000000
79 #define ASL_QUERY_MATCH_FALSE 0x40000000
80 #define ASL_QUERY_MATCH_ERROR 0x20000000
81
82 #define ASL_SERVICE_NAME "com.apple.system.logger"
83
84 #define ASL_PLACE_DATABASE 0
85 #define ASL_PLACE_ARCHIVE 1
86
87 #define ASL_PLACE_DATABASE_DEFAULT "/var/log/asl"
88 #define ASL_PLACE_ARCHIVE_DEFAULT "/var/log/asl.archive"
89
90 mach_port_t asl_core_get_service_port(int reset) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_0);
91
92 uint32_t asl_core_string_hash(const char *str, uint32_t len) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
93 const char *asl_core_error(uint32_t code) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
94 const char *asl_core_level_to_string(uint32_t level) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_0);
95 uint32_t asl_core_check_access(int32_t msgu, int32_t msgg, int32_t readu, int32_t readg, uint16_t flags) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
96 uint64_t asl_core_htonq(uint64_t n) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
97 uint64_t asl_core_ntohq(uint64_t n)__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
98 uint64_t asl_core_new_msg_id(uint64_t start) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
99 char *asl_core_encode_buffer(const char *in, uint32_t len) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0);
100 int32_t asl_core_decode_buffer(const char *in, char **buf, uint32_t *len) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0);
101
102 time_t asl_core_parse_time(const char *in, uint32_t *tlen) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_0);
103
104 const char *asl_filesystem_path(uint32_t place) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_0);
105
106 #endif /* __ASL_CORE_H__ */