]> git.saurik.com Git - apple/libc.git/blob - gen/asl_private.h
989fb5b131759433aebac720bcf0119048199930
[apple/libc.git] / gen / asl_private.h
1 /*
2 * Copyright (c) 2007-2008 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * "Portions Copyright (c) 2007 Apple Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 1.0 (the 'License'). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
12 * this file.
13 *
14 * The Original Code and all software distributed under the License are
15 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
20 * under the License."
21 *
22 * @APPLE_LICENSE_HEADER_END@
23 */
24 #include <stdint.h>
25 #include <sys/socket.h>
26 #include <sys/un.h>
27 #include <netinet/in.h>
28 #include <arpa/inet.h>
29
30 #define _PATH_ASL_OUT "/var/log/asl.log"
31
32 #define ASL_QUERY_OP_NULL 0x00000
33
34 #define NOTIFY_SYSTEM_MASTER "com.apple.system.syslog.master"
35 #define NOTIFY_SYSTEM_ASL_FILTER "com.apple.system.syslog.asl_filter"
36 #define NOTIFY_PREFIX_SYSTEM "com.apple.system.syslog"
37 #define NOTIFY_PREFIX_USER "user.syslog"
38
39 #define ASL_MSG_FMT_RAW "raw"
40 #define ASL_MSG_FMT_STD "std"
41 #define ASL_MSG_FMT_BSD "bsd"
42 #define ASL_MSG_FMT_XML "xml"
43 #define ASL_MSG_FMT_MSG "msg"
44
45 #define ASL_TIME_FMT_SEC "sec"
46 #define ASL_TIME_FMT_UTC "utc"
47 #define ASL_TIME_FMT_LCL "lcl"
48
49 #define ASL_ENCODE_NONE 0
50 #define ASL_ENCODE_SAFE 1
51 #define ASL_ENCODE_VIS 2
52 #define ASL_ENCODE_ASL 3
53
54 #define ASL_KEY_REF_PID "RefPID"
55 #define ASL_KEY_REF_PROC "RefProc"
56
57 typedef struct __aslclient
58 {
59 uint32_t options;
60 struct sockaddr_un server;
61 int sock;
62 pid_t pid;
63 uid_t uid;
64 gid_t gid;
65 char *name;
66 char *facility;
67 uint32_t filter;
68 int notify_token;
69 int notify_master_token;
70 uint32_t fd_count;
71 int *fd_list;
72 char **fd_mfmt;
73 char **fd_tfmt;
74 uint32_t *fd_encoding;
75 uint32_t reserved1;
76 void *reserved2;
77 } asl_client_t;
78
79 typedef struct __aslmsg
80 {
81 uint32_t type;
82 uint32_t count;
83 char **key;
84 char **val;
85 uint32_t *op;
86 } asl_msg_t;
87
88 typedef struct __aslresponse
89 {
90 uint32_t count;
91 uint32_t curr;
92 asl_msg_t **msg;
93 } asl_search_result_t;
94
95
96 __BEGIN_DECLS
97
98 int asl_add_output(aslclient asl, int fd, const char *msg_fmt, const char *time_fmt, uint32_t text_encoding);
99 int asl_remove_output(aslclient asl, int fd);
100 char *asl_format_message(aslmsg msg, const char *msg_fmt, const char *time_fmt, uint32_t text_encoding, uint32_t *outlen);
101
102 __END_DECLS
103