]>
Commit | Line | Data |
---|---|---|
224c7076 | 1 | /* |
34e8f829 | 2 | * Copyright (c) 2007 Apple Inc. All rights reserved. |
224c7076 A |
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 | */ | |
3d9156a7 A |
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" | |
34e8f829 | 38 | #define NOTIFY_RC "com.apple.asl.remote" |
3d9156a7 | 39 | |
224c7076 A |
40 | #define ASL_MSG_FMT_RAW "raw" |
41 | #define ASL_MSG_FMT_STD "std" | |
42 | #define ASL_MSG_FMT_BSD "bsd" | |
43 | #define ASL_MSG_FMT_XML "xml" | |
44 | #define ASL_MSG_FMT_MSG "msg" | |
45 | ||
46 | #define ASL_TIME_FMT_SEC "sec" | |
47 | #define ASL_TIME_FMT_UTC "utc" | |
48 | #define ASL_TIME_FMT_LCL "lcl" | |
49 | ||
b5d655f7 A |
50 | #define ASL_ENCODE_NONE 0 |
51 | #define ASL_ENCODE_SAFE 1 | |
52 | #define ASL_ENCODE_VIS 2 | |
53 | #define ASL_ENCODE_ASL 3 | |
54 | ||
224c7076 A |
55 | #define ASL_KEY_REF_PID "RefPID" |
56 | #define ASL_KEY_REF_PROC "RefProc" | |
34e8f829 A |
57 | #define ASL_KEY_OPTION "ASLOption" |
58 | ||
59 | #define ASL_OPT_IGNORE "ignore" | |
60 | #define ASL_OPT_STORE "store" | |
224c7076 | 61 | |
511daa4c A |
62 | #define ASL_STORE_LOCATION_FILE 0 |
63 | #define ASL_STORE_LOCATION_MEMORY 1 | |
64 | ||
3d9156a7 A |
65 | typedef struct __aslclient |
66 | { | |
67 | uint32_t options; | |
68 | struct sockaddr_un server; | |
69 | int sock; | |
70 | pid_t pid; | |
71 | uid_t uid; | |
72 | gid_t gid; | |
73 | char *name; | |
74 | char *facility; | |
75 | uint32_t filter; | |
76 | int notify_token; | |
77 | int notify_master_token; | |
78 | uint32_t fd_count; | |
79 | int *fd_list; | |
224c7076 A |
80 | char **fd_mfmt; |
81 | char **fd_tfmt; | |
b5d655f7 | 82 | uint32_t *fd_encoding; |
3d9156a7 A |
83 | uint32_t reserved1; |
84 | void *reserved2; | |
85 | } asl_client_t; | |
86 | ||
87 | typedef struct __aslmsg | |
88 | { | |
89 | uint32_t type; | |
90 | uint32_t count; | |
91 | char **key; | |
92 | char **val; | |
93 | uint32_t *op; | |
94 | } asl_msg_t; | |
95 | ||
96 | typedef struct __aslresponse | |
97 | { | |
98 | uint32_t count; | |
99 | uint32_t curr; | |
100 | asl_msg_t **msg; | |
101 | } asl_search_result_t; | |
224c7076 A |
102 | |
103 | ||
104 | __BEGIN_DECLS | |
105 | ||
b5d655f7 | 106 | int asl_add_output(aslclient asl, int fd, const char *msg_fmt, const char *time_fmt, uint32_t text_encoding); |
224c7076 | 107 | int asl_remove_output(aslclient asl, int fd); |
b5d655f7 | 108 | char *asl_format_message(aslmsg msg, const char *msg_fmt, const char *time_fmt, uint32_t text_encoding, uint32_t *outlen); |
511daa4c | 109 | int asl_store_location(); |
224c7076 A |
110 | |
111 | __END_DECLS | |
112 |