Annotation of embedaddon/coova-chilli/src/session.h, revision 1.1.1.1
1.1 misho 1: /*
2: * chilli - A Wireless LAN Access Point Controller
3: * Copyright (C) 2003, 2004, 2005 Mondru AB.
4: * Copyright (c) 2006-2007 David Bird <david@coova.com>
5: *
6: * The contents of this file may be used under the terms of the GNU
7: * General Public License Version 2, provided that the above copyright
8: * notice and this permission notice is included in all copies or
9: * substantial portions of the software.
10: *
11: */
12:
13: #ifndef _SESSION_H
14: #define _SESSION_H
15:
16: #include "limits.h"
17: #include "garden.h"
18:
19: #define SESSION_PASS_THROUGH_MAX 8
20:
21: struct session_params {
22: uint8_t url[REDIR_USERURLSIZE];
23: uint8_t filteridbuf[256];
24: uint8_t filteridlen;
25: uint8_t routeidx;
26: uint32_t bandwidthmaxup;
27: uint32_t bandwidthmaxdown;
28: uint64_t maxinputoctets;
29: uint64_t maxoutputoctets;
30: uint64_t maxtotaloctets;
31: uint64_t sessiontimeout;
32: uint32_t idletimeout;
33: uint16_t interim_interval; /* Seconds. 0 = No interim accounting */
34: time_t sessionterminatetime;
35:
36: #define REQUIRE_UAM_AUTH (1<<0)
37: #define REQUIRE_UAM_SPLASH (1<<1)
38: #define REQUIRE_REDIRECT (1<<2)
39: #define IS_UAM_REAUTH (1<<3)
40: uint8_t flags;
41:
42: pass_through pass_throughs[SESSION_PASS_THROUGH_MAX];
43: uint32_t pass_through_count;
44: } __attribute__((packed));
45:
46:
47: struct redir_state {
48:
49: char username[REDIR_USERNAMESIZE];
50: char userurl[REDIR_USERURLSIZE];
51:
52: uint8_t uamchal[REDIR_MD5LEN];
53:
54: uint8_t classbuf[RADIUS_ATTR_VLEN];
55: size_t classlen;
56:
57: uint8_t statebuf[RADIUS_ATTR_VLEN];
58: unsigned char statelen;
59:
60: } __attribute__((packed));
61:
62: struct session_state {
63: struct redir_state redir;
64:
65: int authenticated; /* 1 if user was authenticated */
66:
67: char sessionid[REDIR_SESSIONID_LEN]; /* Accounting session ID */
68:
69: time_t start_time;
70: time_t interim_time;
71:
72: time_t last_time; /* Last time a packet was received or sent */
73: time_t uamtime;
74:
75: uint64_t input_packets;
76: uint64_t output_packets;
77: uint64_t input_octets;
78: uint64_t output_octets;
79: uint32_t terminate_cause;
80: uint32_t session_id;
81:
82: #ifdef LEAKY_BUCKET
83: /* Leaky bucket */
84: uint64_t bucketup;
85: uint64_t bucketdown;
86: uint64_t bucketupsize;
87: uint64_t bucketdownsize;
88: #endif
89:
90: } __attribute__((packed));
91:
92:
93: int session_json_fmt(struct session_state *state,
94: struct session_params *params,
95: bstring json, int init);
96:
97: int session_redir_json_fmt(bstring json, char *userurl, char *redirurl, uint8_t *hismac);
98:
99: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>