1/*
2 * Copyright (c) 2007-2011 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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
11 * file.
12 *
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.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24#ifndef __ASL_PRIVATE_H__
25#define __ASL_PRIVATE_H__
26
27#include <stdint.h>
28#include <sys/socket.h>
29#include <sys/un.h>
30#include <netinet/in.h>
31#include <arpa/inet.h>
32#include "asl_file.h"
33#include "asl_msg.h"
34#include <Availability.h>
35
36#define ASL_QUERY_OP_NULL          0x00000
37
38#define ASLMANAGER_SERVICE_NAME "com.apple.aslmanager"
39#define NOTIFY_SYSTEM_MASTER "com.apple.system.syslog.master"
40#define NOTIFY_SYSTEM_ASL_FILTER "com.apple.system.syslog.asl_filter"
41#define NOTIFY_PREFIX_SYSTEM "com.apple.system.syslog"
42#define NOTIFY_PREFIX_USER "user.syslog"
43#define NOTIFY_RC "com.apple.asl.remote"
44
45#define ASL_OPT_IGNORE "ignore"
46#define ASL_OPT_STORE "store"
47
48#define ASL_STORE_LOCATION_FILE 0
49#define ASL_STORE_LOCATION_MEMORY 1
50
51#define ASL_OPT_SYSLOG_LEGACY  0x00010000
52
53#define ASL_KEY_SENDER_MACH_UUID "Sender_Mach_UUID"
54
55/* SPI to enable ASL filter tunneling using asl_set_filter() */
56#define ASL_FILTER_MASK_TUNNEL   0x100
57
58typedef struct
59{
60	int fd;
61	uint32_t encoding;
62	uint32_t filter;
63	char *mfmt;
64	char *tfmt;
65} asl_out_file_t;
66
67typedef struct __aslclient
68{
69	uint32_t options;
70	struct sockaddr_un server;
71	int sock;
72	pid_t pid;
73	uid_t uid;
74	gid_t gid;
75	char *name;
76	char *facility;
77	uint32_t filter;
78	int notify_token;
79	int notify_master_token;
80	uint32_t out_count;
81	asl_out_file_t *out_list;
82	asl_file_t *aslfile;
83	uint64_t aslfileid;
84	uint32_t reserved1;
85	void *reserved2;
86	int32_t refcount;
87} asl_client_t;
88
89__BEGIN_DECLS
90
91int asl_add_output(aslclient asl, int fd, const char *msg_fmt, const char *time_fmt, uint32_t text_encoding) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
92int asl_remove_output(aslclient asl, int fd) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
93int asl_store_location() __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
94int asl_get_filter(aslclient asl, int *local, int *master, int *remote, int *active) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
95char *asl_remote_notify_name() __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
96int asl_trigger_aslmanager(void) __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
97aslmsg _asl_server_control_query(void) __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
98
99__END_DECLS
100
101#endif /* __ASL_PRIVATE_H__ */
102