]>
Commit | Line | Data |
---|---|---|
b16a592a A |
1 | /* |
2 | * Copyright (c) 2004 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
02b408bf A |
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. | |
b16a592a A |
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, | |
02b408bf A |
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. | |
b16a592a A |
20 | * |
21 | * @APPLE_LICENSE_HEADER_END@ | |
22 | */ | |
23 | ||
24 | #ifndef __DAEMON_H__ | |
25 | #define __DAEMON_H__ | |
26 | ||
27 | #include <stdio.h> | |
28 | #include <sys/types.h> | |
29 | #include <sys/queue.h> | |
30 | #include <time.h> | |
31 | #include <asl.h> | |
32 | #include <asl_private.h> | |
33 | #include <notify.h> | |
34 | ||
35 | #define _PATH_PIDFILE "/var/run/syslog.pid" | |
36 | #define _PATH_ASL_IN "/var/run/asl_input" | |
37 | #define _PATH_ASL_PRUNE "/var/run/asl_prune" | |
38 | #define _PATH_ASL_OUT "/var/log/asl.log" | |
39 | #define _PATH_SYSLOG_CONF "/etc/syslog.conf" | |
40 | #define _PATH_SYSLOG_IN "/var/run/syslog" | |
41 | #define _PATH_KLOG "/dev/klog" | |
42 | #define _PATH_MODULE_LIB "/usr/lib/asl" | |
43 | ||
44 | struct module_list | |
45 | { | |
46 | char *name; | |
47 | void *module; | |
48 | int (*init)(void); | |
49 | int (*reset)(void); | |
50 | int (*close)(void); | |
51 | TAILQ_ENTRY(module_list) entries; | |
52 | }; | |
53 | ||
54 | int aslevent_init(void); | |
55 | int aslevent_fdsets(fd_set *, fd_set *, fd_set *); | |
56 | void aslevent_handleevent(fd_set, fd_set, fd_set, char *); | |
57 | void aslmark(void); | |
58 | ||
59 | char *get_line_from_file(FILE *f); | |
60 | ||
61 | int asldebug(const char *, ...); | |
62 | int asl_log_string(const char *str); | |
63 | ||
64 | char *asl_msg_to_string(asl_msg_t *msg, uint32_t *len); | |
65 | asl_msg_t *asl_msg_from_string(const char *buf); | |
66 | int asl_msg_cmp(asl_msg_t *a, asl_msg_t *b); | |
67 | time_t asl_parse_time(const char *str); | |
68 | ||
69 | typedef asl_msg_t *(*aslreadfn)(int); | |
70 | typedef char *(*aslwritefn)(const char *, int); | |
71 | typedef char *(*aslexceptfn)(int); | |
72 | typedef int (*aslsendmsgfn)(asl_msg_t *msg, const char *outid); | |
73 | ||
74 | int aslevent_addfd(int fd, aslreadfn, aslwritefn, aslexceptfn); | |
75 | int aslevent_removefd(int fd); | |
76 | int aslevent_addmatch(asl_msg_t *query, char *outid); | |
77 | ||
78 | int aslevent_addoutput(aslsendmsgfn, const char *outid); | |
79 | ||
80 | int asl_syslog_faciliy_name_to_num(const char *fac); | |
81 | const char *asl_syslog_faciliy_num_to_name(int num); | |
82 | asl_msg_t *asl_syslog_input_convert(const char *in, int len, char *rhost, int flag); | |
83 | int asl_prune(asl_msg_t *pq); | |
84 | ||
85 | /* notify SPI */ | |
86 | uint32_t notify_get_state(int token, int *state); | |
87 | uint32_t notify_set_state(int token, int state); | |
88 | uint32_t notify_register_plain(const char *name, int *out_token); | |
89 | ||
90 | #endif /* __DAEMON_H__ */ |