summaryrefslogtreecommitdiff
path: root/accel-pppd/extra/logwtmp.c
blob: 5848102e0ba4f46443ac7c0ab8f7c3d0c27df35a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <utmp.h>

#include "ppp.h"
#include "events.h"
#include "triton.h"
#include "log.h"

#include "memdebug.h"


static void ev_ppp_started(struct ppp_t *ppp)
{
	logwtmp(ppp->ifname, ppp->username, ppp->ctrl->calling_station_id);
}

static void ev_ppp_finished(struct ppp_t *ppp)
{
	logwtmp(ppp->ifname, "", "");
}

static void init(void)
{
	triton_event_register_handler(EV_PPP_STARTED, (triton_event_func)ev_ppp_started);
	triton_event_register_handler(EV_PPP_FINISHED, (triton_event_func)ev_ppp_finished);
}

DEFINE_INIT(200, init);