]> git.saurik.com Git - apple/syslog.git/blob - libsystem_asl.tproj/include/asl_core.h
syslog-385.tar.gz
[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 #include <TargetConditionals.h>
33
34 #define streq(A, B) (strcmp(A, B) == 0)
35 #define strneq(A, B) (strcmp(A, B) != 0)
36
37 #define streq_len(A, B, C) (strncmp(A, B, C) == 0)
38 #define strneq_len(A, B, C) (strncmp(A, B, C) != 0)
39
40 #define strcaseeq(A, B) (strcasecmp(A, B) == 0)
41 #define strcaseneq(A, B) (strcasecmp(A, B) != 0)
42
43 #define strcaseeq_len(A, B, C) (strncasecmp(A, B, C) == 0)
44 #define strcaseneq_len(A, B, C) (strcasecmp(A, B, C) != 0)
45
46 typedef uint32_t ASL_STATUS;
47
48 #define ASL_STATUS_OK 0
49 #define ASL_STATUS_INVALID_ARG 1
50 #define ASL_STATUS_INVALID_STORE 2
51 #define ASL_STATUS_INVALID_STRING 3
52 #define ASL_STATUS_INVALID_ID 4
53 #define ASL_STATUS_INVALID_MESSAGE 5
54 #define ASL_STATUS_NOT_FOUND 6
55 #define ASL_STATUS_READ_FAILED 7
56 #define ASL_STATUS_WRITE_FAILED 8
57 #define ASL_STATUS_NO_MEMORY 9
58 #define ASL_STATUS_ACCESS_DENIED 10
59 #define ASL_STATUS_READ_ONLY 11
60 #define ASL_STATUS_WRITE_ONLY 12
61 #define ASL_STATUS_MATCH_FAILED 13
62 #define ASL_STATUS_NO_RECORDS 14
63 #define ASL_STATUS_INVALID_TYPE 15
64 #define ASL_STATUS_FAILED 9999
65
66 #define ASL_REF_NULL 0xffffffffffffffffLL
67
68 #define ASL_MSG_FLAG_READ_UID_SET 0x0001
69 #define ASL_MSG_FLAG_READ_GID_SET 0x0002
70 #define ASL_MSG_FLAG_SEARCH_MATCH 0x8000
71 #define ASL_MSG_FLAG_SEARCH_CLEAR 0x7fff
72
73 #define ASL_QUERY_MATCH_SLOW 0x00000000
74 #define ASL_QUERY_MATCH_MSG_ID 0x00000001
75 #define ASL_QUERY_MATCH_TIME 0x00000002
76 #define ASL_QUERY_MATCH_NANO 0x00000004
77 #define ASL_QUERY_MATCH_LEVEL 0x00000008
78 #define ASL_QUERY_MATCH_PID 0x00000010
79 #define ASL_QUERY_MATCH_UID 0x00000020
80 #define ASL_QUERY_MATCH_GID 0x00000040
81 #define ASL_QUERY_MATCH_RUID 0x00000080
82 #define ASL_QUERY_MATCH_RGID 0x00000100
83 #define ASL_QUERY_MATCH_REF_PID 0x00000200
84 #define ASL_QUERY_MATCH_HOST 0x00000400
85 #define ASL_QUERY_MATCH_SENDER 0x00000800
86 #define ASL_QUERY_MATCH_SMUUID 0x00001000
87 #define ASL_QUERY_MATCH_FACILITY 0x00002000
88 #define ASL_QUERY_MATCH_MESSAGE 0x00004000
89 #define ASL_QUERY_MATCH_REF_PROC 0x00008000
90 #define ASL_QUERY_MATCH_SESSION 0x00010000
91 #define ASL_QUERY_MATCH_TRUE 0x80000000
92 #define ASL_QUERY_MATCH_FALSE 0x40000000
93 #define ASL_QUERY_MATCH_ERROR 0x20000000
94
95 #define ASL_SERVICE_NAME "com.apple.system.logger"
96
97 #define ASL_PLACE_DATABASE 0
98 #define ASL_PLACE_ARCHIVE 1
99
100 #if TARGET_OS_SIMULATOR
101 #define ASL_PLACE_DATABASE_DEFAULT asl_filesystem_path(ASL_PLACE_DATABASE)
102 #define ASL_PLACE_ARCHIVE_DEFAULT asl_filesystem_path(ASL_PLACE_ARCHIVE)
103 #else
104 #define ASL_PLACE_DATABASE_DEFAULT "/var/log/asl"
105 #define ASL_PLACE_ARCHIVE_DEFAULT "/var/log/asl.archive"
106 #endif
107
108 mach_port_t asl_core_get_service_port(int reset) __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));
109
110 uint32_t asl_core_string_hash(const char *str, uint32_t len) __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));
111 const char *asl_core_error(uint32_t code) __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));
112 const char *asl_core_level_to_string(uint32_t level) __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));
113 uint32_t asl_core_check_access(int32_t msgu, int32_t msgg, int32_t readu, int32_t readg, uint16_t flags) __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));
114 uint64_t asl_core_htonq(uint64_t n) __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));
115 uint64_t asl_core_ntohq(uint64_t n)__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));
116 uint64_t asl_core_new_msg_id(uint64_t start) __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));
117 char *asl_core_encode_buffer(const char *in, uint32_t len) __API_DEPRECATED("os_log(3) has replaced asl(3)", macosx(10.7,10.12), ios(5.0,10.0), watchos(2.0,3.0), tvos(9.0,10.0));
118 int32_t asl_core_decode_buffer(const char *in, char **buf, uint32_t *len) __API_DEPRECATED("os_log(3) has replaced asl(3)", macosx(10.7,10.12), ios(5.0,10.0), watchos(2.0,3.0), tvos(9.0,10.0));
119
120 time_t asl_core_parse_time(const char *in, uint32_t *tlen) __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));
121 size_t asl_core_str_to_size(char *s) __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));
122 time_t asl_core_str_to_time(char *s, uint32_t def_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));
123 void asl_core_time_to_str(time_t s, char *str, size_t len) __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));
124
125 const char *asl_filesystem_path(uint32_t place) __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));
126
127 #endif /* __ASL_CORE_H__ */