2
* (C) 2006 by Pablo Neira Ayuso <pablo@netfilter.org>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
#include "us-conntrack.h"
25
static void lifetime_add(struct us_conntrack *u, void *data)
27
long *lifetime = data;
30
gettimeofday(&tv, NULL);
32
*lifetime = tv.tv_sec;
35
static void lifetime_update(struct us_conntrack *u, void *data)
39
static void lifetime_destroy(struct us_conntrack *u, void *data)
43
static int lifetime_dump(struct us_conntrack *u,
48
long *lifetime = data;
51
if (type == NFCT_O_XML)
54
gettimeofday(&tv, NULL);
56
return sprintf(buf, " [active since %lds]", tv.tv_sec - *lifetime);
59
struct cache_feature lifetime_feature = {
62
.update = lifetime_update,
63
.destroy = lifetime_destroy,