mirror of
https://github.com/kakwa/uts-server
synced 2025-07-04 12:37:08 +02:00
big code reorganization:
* split the rfc3161 and the http part * add a logger function * add a debugging logger function for the requests * add a specific handler for rfc3161 request
This commit is contained in:
parent
860fd9475e
commit
b27d676148
8 changed files with 212 additions and 70 deletions
|
@ -6,6 +6,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <syslog.h>
|
||||
#include "utils.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
void skeleton_daemon() {
|
||||
pid_t pid;
|
||||
|
@ -57,3 +58,21 @@ void skeleton_daemon() {
|
|||
/* Open the log file */
|
||||
openlog("firstdaemon", LOG_PID, LOG_DAEMON);
|
||||
}
|
||||
|
||||
void logger(int priority, char *fmt, ...) {
|
||||
FILE *stream;
|
||||
char *out;
|
||||
size_t len;
|
||||
stream = open_memstream(&out, &len);
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
vfprintf(stream, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
fflush(stream);
|
||||
fclose(stream);
|
||||
printf(out);
|
||||
syslog(priority, out);
|
||||
free(out);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue