aboutsummaryrefslogtreecommitdiff
path: root/syslogd
diff options
context:
space:
mode:
Diffstat (limited to 'syslogd')
-rw-r--r--syslogd/Makemodule.am5
-rw-r--r--syslogd/logfile.c3
-rw-r--r--syslogd/proto.c2
-rw-r--r--syslogd/proto.h35
-rw-r--r--syslogd/syslogd.c (renamed from syslogd/main.c)8
-rw-r--r--syslogd/syslogd.h (renamed from syslogd/backend.h)36
6 files changed, 38 insertions, 51 deletions
diff --git a/syslogd/Makemodule.am b/syslogd/Makemodule.am
index d954769..022946b 100644
--- a/syslogd/Makemodule.am
+++ b/syslogd/Makemodule.am
@@ -1,6 +1,5 @@
-usyslogd_SOURCES = syslogd/main.c
-usyslogd_SOURCES += syslogd/logfile.c syslogd/backend.h
-usyslogd_SOURCES += syslogd/proto.c syslogd/proto.h
+usyslogd_SOURCES = syslogd/syslogd.c syslogd/syslogd.h
+usyslogd_SOURCES += syslogd/proto.c syslogd/logfile.c
usyslogd_CPPFLAGS = $(AM_CPPFLAGS)
usyslogd_CFLAGS = $(AM_CFLAGS)
usyslogd_LDFLAGS = $(AM_LDFLAGS)
diff --git a/syslogd/logfile.c b/syslogd/logfile.c
index 513b027..ec82d0c 100644
--- a/syslogd/logfile.c
+++ b/syslogd/logfile.c
@@ -24,8 +24,7 @@
#include <fcntl.h>
#include <errno.h>
-#include "backend.h"
-#include "config.h"
+#include "syslogd.h"
#include "util.h"
diff --git a/syslogd/proto.c b/syslogd/proto.c
index 8a285dd..0851ced 100644
--- a/syslogd/proto.c
+++ b/syslogd/proto.c
@@ -20,7 +20,7 @@
#include <ctype.h>
#include <time.h>
-#include "proto.h"
+#include "syslogd.h"
static const char *months[] = {
"Jan", "Feb", "Mar", "Apr",
diff --git a/syslogd/proto.h b/syslogd/proto.h
deleted file mode 100644
index c64c9e1..0000000
--- a/syslogd/proto.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* SPDX-License-Identifier: GPL-3.0-or-later */
-/*
- * Copyright (C) 2018 - David Oberhollenzer
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-#ifndef PROTO_H
-#define PROTO_H
-
-#include <sys/types.h>
-#include <time.h>
-
-typedef struct {
- int facility;
- int level;
- time_t timestamp;
- pid_t pid;
- const char *ident;
- const char *message;
-} syslog_msg_t;
-
-int syslog_msg_parse(syslog_msg_t *msg, char *str);
-
-#endif /* PROTO_H */
diff --git a/syslogd/main.c b/syslogd/syslogd.c
index e2cc804..03f4b55 100644
--- a/syslogd/main.c
+++ b/syslogd/syslogd.c
@@ -29,16 +29,10 @@
#include <pwd.h>
#include <grp.h>
-#include "backend.h"
-#include "proto.h"
+#include "syslogd.h"
#include "util.h"
-#define SYSLOG_SOCKET PREFIXPATH "/dev/log"
-#define SYSLOG_PATH PREFIXPATH "/var/log"
-#define DEFAULT_USER "syslogd"
-#define DEFAULT_GROUP "syslogd"
-
#define GPL_URL "https://gnu.org/licenses/gpl.html"
diff --git a/syslogd/backend.h b/syslogd/syslogd.h
index 5880ee3..47fc31c 100644
--- a/syslogd/backend.h
+++ b/syslogd/syslogd.h
@@ -15,10 +15,35 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-#ifndef LOGFILE_H
-#define LOGFILE_H
+#ifndef SYSLOGD_H
+#define SYSLOGD_H
+
+
+#include <sys/types.h>
+#include <time.h>
+
+#include "config.h"
+
+
+#define SYSLOG_SOCKET PREFIXPATH "/dev/log"
+#define SYSLOG_PATH PREFIXPATH "/var/log"
+#define DEFAULT_USER "syslogd"
+#define DEFAULT_GROUP "syslogd"
+
+
+/*
+ encapsulates the split up data from a message received
+ through the local syslog socket.
+ */
+typedef struct {
+ int facility;
+ int level;
+ time_t timestamp;
+ pid_t pid;
+ const char *ident;
+ const char *message;
+} syslog_msg_t;
-#include "proto.h"
enum {
/*
@@ -55,5 +80,10 @@ typedef struct log_backend_t {
extern log_backend_t *logmgr;
+/*
+ Parse a message string received from the syslog socket and produce
+ a split up representation for the message.
+ */
+int syslog_msg_parse(syslog_msg_t *msg, char *str);
#endif /* LOGFILE_H */