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 <asl.h>
28#include <stdint.h>
29#include <sys/socket.h>
30#include <sys/un.h>
31#include <sys/time.h>
32#include <netinet/in.h>
33#include <arpa/inet.h>
34#include <Availability.h>
35#include <os/object.h>
36#include <os/object_private.h>
37
38#define streq(A, B) (strcmp(A, B) == 0)
39#define strcaseeq(A, B) (strcasecmp(A, B) == 0)
40
41#define ASL_QUERY_OP_NULL          0x00000
42
43#define ASLMANAGER_SERVICE_NAME "com.apple.aslmanager"
44#define NOTIFY_SYSTEM_MASTER "com.apple.system.syslog.master"
45#define NOTIFY_SYSTEM_ASL_FILTER "com.apple.system.syslog.asl_filter"
46#define NOTIFY_PREFIX_SYSTEM "com.apple.system.syslog"
47#define NOTIFY_PREFIX_USER "user.syslog"
48#define NOTIFY_RC "com.apple.asl.remote"
49
50#define ASL_OPT_IGNORE "ignore"
51#define ASL_OPT_STORE "store"
52#define ASL_OPT_CONTROL "control"
53
54/* File and Store Open Option */
55#define ASL_OPT_OPEN_READ   0x80000000
56
57#define ASL_STORE_LOCATION_FILE 0
58#define ASL_STORE_LOCATION_MEMORY 1
59
60#define ASL_OPT_SYSLOG_LEGACY  0x00010000
61
62#define ASL_KEY_FREE_NOTE "ASLFreeNotify"
63
64/*
65 * Private types
66 */
67#define ASL_TYPE_STRING       6
68#define ASL_TYPE_COUNT        7
69
70/* SPI to enable ASL filter tunneling using asl_set_filter() */
71#define ASL_FILTER_MASK_TUNNEL   0x100
72
73#define NOQUOTA_FILE_PATH "/etc/asl/.noquota"
74
75__BEGIN_DECLS
76
77int asl_store_location() __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
78char *asl_remote_notify_name() __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
79int asl_syslog_faciliy_name_to_num(const char *name) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
80const char *asl_syslog_faciliy_num_to_name(int n) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
81int asl_trigger_aslmanager(void) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_0);
82int asl_get_filter(asl_object_t client, int *local, int *master, int *remote, int *active) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
83
84/* EXCLUSIVLY FOR USE BY DEV TOOLS */
85/* DO NOT USE THIS INTERFACE OTHERWISE */
86
87uint32_t asl_store_match_timeout(void *ignored, void *query_v1, void **result_v1, uint64_t *last_id, uint64_t start_id, uint32_t count, int32_t direction, uint32_t usec) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_0);
88
89__END_DECLS
90
91
92#endif /* __ASL_PRIVATE_H__ */
93