1
0
Fork 0
mirror of https://github.com/pygos/init.git synced 2024-05-17 03:06:13 +02:00

usyslogd: minor header restructuring/file structure cleanup

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
This commit is contained in:
David Oberhollenzer 2018-08-19 13:37:42 +02:00
parent 325f919847
commit 73404a09d4
6 changed files with 38 additions and 51 deletions

View file

@ -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)

View file

@ -24,8 +24,7 @@
#include <fcntl.h>
#include <errno.h>
#include "backend.h"
#include "config.h"
#include "syslogd.h"
#include "util.h"

View file

@ -20,7 +20,7 @@
#include <ctype.h>
#include <time.h>
#include "proto.h"
#include "syslogd.h"
static const char *months[] = {
"Jan", "Feb", "Mar", "Apr",

View file

@ -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 */

View file

@ -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"

View file

@ -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 */