diff options
| author | Kozlov Dmitry <xeb@mail.ru> | 2012-01-18 14:41:48 +0400 |
|---|---|---|
| committer | Kozlov Dmitry <xeb@mail.ru> | 2012-01-18 14:41:48 +0400 |
| commit | 85d6a2b6522d667cbc4ed329afd2d22866efd9b5 (patch) | |
| tree | 55e9a02d41f479077454ea610ae90dc0934385ca /accel-pppd/extra/logwtmp.c | |
| parent | bf09c2eed598d00f50ccce86672c7b1d93af5358 (diff) | |
| download | accel-ppp-85d6a2b6522d667cbc4ed329afd2d22866efd9b5.tar.gz accel-ppp-85d6a2b6522d667cbc4ed329afd2d22866efd9b5.zip | |
implemented logwtmp
Diffstat (limited to 'accel-pppd/extra/logwtmp.c')
| -rw-r--r-- | accel-pppd/extra/logwtmp.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/accel-pppd/extra/logwtmp.c b/accel-pppd/extra/logwtmp.c new file mode 100644 index 0000000..5848102 --- /dev/null +++ b/accel-pppd/extra/logwtmp.c @@ -0,0 +1,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); |
