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