l2tpd: move logging into own file
This commit is contained in:
parent
e6b5f61938
commit
923f4c9f1c
|
@ -8,7 +8,7 @@ CFLAGS += $(EXTRA_CFLAGS)
|
|||
|
||||
all: l2tpd test_connect
|
||||
|
||||
l2tpd: l2tpd.o l2tpd_fsm.o l2tpd_data.o l2tpd_packet.o l2tpd_socket.c l2tpd_lapd.c crc32.c
|
||||
l2tpd: l2tpd.o l2tpd_fsm.o l2tpd_data.o l2tpd_packet.o l2tpd_socket.c l2tpd_lapd.c l2tpd_logging.c crc32.c
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test_connect: test_connect.o
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "l2tpd_fsm.h"
|
||||
#include "l2tpd_packet.h"
|
||||
#include "l2tpd_lapd.h"
|
||||
#include "l2tpd_logging.h"
|
||||
#include "l2tpd_socket.h"
|
||||
|
||||
struct l2tpd_instance *l2i;
|
||||
|
@ -74,26 +75,14 @@ static int l2tpd_instance_start(struct l2tpd_instance *li)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* default categories */
|
||||
static struct log_info_cat l2tp_categories[] = {
|
||||
[DL2TP] = {
|
||||
.name = "DL2TP",
|
||||
.description = "L2TP logging messages",
|
||||
.enabled = 1, .loglevel = LOGL_DEBUG,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct log_info l2tp_log_info = {
|
||||
.cat = l2tp_categories,
|
||||
.num_cat = ARRAY_SIZE(l2tp_categories),
|
||||
};
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int rc;
|
||||
struct log_target *stderr_target;
|
||||
|
||||
void *tall_l2tp_ctx = talloc_named_const(NULL, 0, "l2tpd");
|
||||
|
||||
l2tpd_log_init();
|
||||
|
||||
/* register fsms */
|
||||
osmo_fsm_register(&l2tp_cc_fsm);
|
||||
osmo_fsm_register(&l2tp_ic_fsm);
|
||||
|
@ -113,11 +102,6 @@ int main(int argc, char **argv)
|
|||
if (rc < 0)
|
||||
exit(1);
|
||||
|
||||
log_init(&l2tp_log_info, NULL);
|
||||
stderr_target = log_target_create_stderr();
|
||||
log_add_target(stderr_target);
|
||||
log_set_print_filename(stderr_target, 0);
|
||||
|
||||
l2tp_socket_init(&l2i->rsl_oml.state, l2i->cfg.rsl_oml_path, 100, DL2TP);
|
||||
l2tp_socket_init(&l2i->trau.state, l2i->cfg.trau_path, 100, DL2TP);
|
||||
l2tp_socket_init(&l2i->pgsl.state, l2i->cfg.pgsl_path, 100, DL2TP);
|
||||
|
|
|
@ -109,10 +109,6 @@ struct l2tpd_instance {
|
|||
} cfg;
|
||||
};
|
||||
|
||||
enum {
|
||||
DL2TP,
|
||||
};
|
||||
|
||||
extern struct l2tpd_instance *l2i;
|
||||
|
||||
extern void l2tpd_explicit_ack_cb(void *data);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "l2tpd_packet.h"
|
||||
#include "l2tpd_data.h"
|
||||
#include "l2tpd_fsm.h"
|
||||
#include "l2tpd_logging.h"
|
||||
|
||||
#define S(x) (1 << (x))
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "l2tpd_lapd.h"
|
||||
#include "l2tpd_packet.h"
|
||||
#include "l2tpd_socket.h"
|
||||
#include "l2tpd_logging.h"
|
||||
|
||||
/* lapd and ehdlc differs in the first 16 bit
|
||||
* lapd saves tei, sapi, c/r bit, ea1, ea2 bit
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
#include <osmocom/core/application.h>
|
||||
#include <osmocom/core/logging.h>
|
||||
#include <osmocom/core/utils.h>
|
||||
|
||||
|
||||
#include "l2tpd_logging.h"
|
||||
|
||||
/* default categories */
|
||||
static struct log_info_cat l2tpd_categories[] = {
|
||||
[DL2TP] = {
|
||||
.name = "DL2TP",
|
||||
.description = "L2TP logging messages",
|
||||
.enabled = 1, .loglevel = LOGL_DEBUG,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct log_info l2tpd_log_info = {
|
||||
.cat = l2tpd_categories,
|
||||
.num_cat = ARRAY_SIZE(l2tpd_categories),
|
||||
};
|
||||
|
||||
void l2tpd_log_init()
|
||||
{
|
||||
osmo_init_logging(&l2tpd_log_info);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
|
||||
enum {
|
||||
DL2TP,
|
||||
Debug_LastEntry,
|
||||
};
|
||||
|
||||
void l2tpd_log_init();
|
|
@ -19,6 +19,7 @@
|
|||
#include "l2tpd_data.h"
|
||||
#include "l2tpd_fsm.h"
|
||||
#include "l2tpd_lapd.h"
|
||||
#include "l2tpd_logging.h"
|
||||
#include "crc32.h"
|
||||
|
||||
/***********************************************************************
|
||||
|
|
Loading…
Reference in New Issue