]> git.saurik.com Git - apple/syslog.git/blame_incremental - syslogd.tproj/daemon.h
syslog-13.tar.gz
[apple/syslog.git] / syslogd.tproj / daemon.h
... / ...
CommitLineData
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
45struct 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
55int aslevent_init(void);
56int aslevent_fdsets(fd_set *, fd_set *, fd_set *);
57void aslevent_handleevent(fd_set, fd_set, fd_set, char *);
58void aslmark(void);
59
60char *get_line_from_file(FILE *f);
61
62int asldebug(const char *, ...);
63int asl_log_string(const char *str);
64
65char *asl_msg_to_string(asl_msg_t *msg, uint32_t *len);
66asl_msg_t *asl_msg_from_string(const char *buf);
67int asl_msg_cmp(asl_msg_t *a, asl_msg_t *b);
68time_t asl_parse_time(const char *str);
69
70typedef asl_msg_t *(*aslreadfn)(int);
71typedef char *(*aslwritefn)(const char *, int);
72typedef char *(*aslexceptfn)(int);
73typedef int (*aslsendmsgfn)(asl_msg_t *msg, const char *outid);
74
75int aslevent_addfd(int fd, aslreadfn, aslwritefn, aslexceptfn);
76int aslevent_removefd(int fd);
77int aslevent_addmatch(asl_msg_t *query, char *outid);
78
79int aslevent_addoutput(aslsendmsgfn, const char *outid);
80
81int asl_syslog_faciliy_name_to_num(const char *fac);
82const char *asl_syslog_faciliy_num_to_name(int num);
83asl_msg_t *asl_syslog_input_convert(const char *in, int len, char *rhost, int flag);
84int asl_prune(asl_msg_t *pq);
85
86/* notify SPI */
87uint32_t notify_get_state(int token, int *state);
88uint32_t notify_set_state(int token, int state);
89uint32_t notify_register_plain(const char *name, int *out_token);
90
91#endif /* __DAEMON_H__ */