summaryrefslogtreecommitdiff
path: root/accel-pppd/include
diff options
context:
space:
mode:
Diffstat (limited to 'accel-pppd/include')
-rw-r--r--accel-pppd/include/ap_session.h108
-rw-r--r--accel-pppd/include/events.h25
2 files changed, 121 insertions, 12 deletions
diff --git a/accel-pppd/include/ap_session.h b/accel-pppd/include/ap_session.h
new file mode 100644
index 00000000..681d05fb
--- /dev/null
+++ b/accel-pppd/include/ap_session.h
@@ -0,0 +1,108 @@
+#ifndef __AP_SESSION_H__
+#define __AP_SESSION_H__
+
+#define AP_SESSIONID_LEN 16
+#define AP_IFNAME_LEN 10
+
+#define AP_STATE_STARTING 1
+#define AP_STATE_ACTIVE 2
+#define AP_STATE_FINISHING 3
+
+#define TERM_USER_REQUEST 1
+#define TERM_SESSION_TIMEOUT 2
+#define TERM_ADMIN_RESET 3
+#define TERM_USER_ERROR 4
+#define TERM_NAS_ERROR 5
+#define TERM_NAS_REQUEST 6
+#define TERM_NAS_REBOOT 7
+#define TERM_AUTH_ERROR 8
+#define TERM_LOST_CARRIER 9
+
+#define CTRL_TYPE_PPTP 1
+#define CTRL_TYPE_L2TP 2
+#define CTRL_TYPE_PPPOE 3
+#define CTRL_TYPE_IPOE 4
+
+#define MPPE_UNSET -2
+#define MPPE_ALLOW -1
+#define MPPE_DENY 0
+#define MPPE_PREFER 1
+#define MPPE_REQUIRE 2
+
+struct ap_session;
+
+struct ap_ctrl
+{
+ struct triton_context_t *ctx;
+ int type;
+ const char *name;
+ int max_mtu;
+ int mppe;
+ char *calling_station_id;
+ char *called_station_id;
+ void (*started)(struct ap_session*);
+ void (*finished)(struct ap_session *);
+ void (*terminate)(struct ap_session *, int hard);
+};
+
+struct ap_private
+{
+ struct list_head entry;
+ void *key;
+};
+
+struct ap_session
+{
+ struct list_head entry;
+
+ int state;
+ char *chan_name;
+ char ifname[AP_IFNAME_LEN];
+ int unit_idx;
+ int ifindex;
+ char sessionid[AP_SESSIONID_LEN+1];
+ time_t start_time;
+ time_t stop_time;
+ char *username;
+ struct ipv4db_item_t *ipv4;
+ struct ipv6db_item_t *ipv6;
+ char *ipv4_pool_name;
+ char *ipv6_pool_name;
+
+ struct ap_ctrl *ctrl;
+
+ int terminating:1;
+ int terminated:1;
+ int terminate_cause;
+
+ struct list_head pd_list;
+};
+
+struct ap_session_stat
+{
+ unsigned int active;
+ unsigned int starting;
+ unsigned int finishing;
+};
+
+
+extern pthread_rwlock_t ses_lock;
+extern struct list_head ses_list;
+extern int ap_shutdown;
+extern int sock_fd; // internet socket for ioctls
+extern int sock6_fd; // internet socket for ioctls
+extern int urandom_fd;
+extern struct ap_session_stat ap_session_stat;
+
+void ap_session_init(struct ap_session *ses);
+int ap_session_starting(struct ap_session *ses);
+void ap_session_finished(struct ap_session *ses);
+void ap_session_terminate(struct ap_session *ses, int cause, int hard);
+void ap_session_activate(struct ap_session *ses);
+
+void ap_session_ifup(struct ap_session *ses);
+void ap_session_ifdown(struct ap_session *ses);
+
+void ap_shutdown_soft(void);
+
+#endif
diff --git a/accel-pppd/include/events.h b/accel-pppd/include/events.h
index 5d6fea7e..ca04d757 100644
--- a/accel-pppd/include/events.h
+++ b/accel-pppd/include/events.h
@@ -4,19 +4,19 @@
#include <stdint.h>
#include <netinet/in.h>
-#define EV_PPP_STARTING 1
-#define EV_PPP_STARTED 2
-#define EV_PPP_FINISHING 3
-#define EV_PPP_FINISHED 4
-#define EV_PPP_AUTHORIZED 5
+#define EV_SES_STARTING 1
+#define EV_SES_STARTED 2
+#define EV_SES_FINISHING 3
+#define EV_SES_FINISHED 4
+#define EV_SES_AUTHORIZED 5
#define EV_CTRL_STARTING 6
#define EV_CTRL_STARTED 7
#define EV_CTRL_FINISHED 8
-#define EV_PPP_PRE_UP 9
-#define EV_PPP_ACCT_START 10
+#define EV_SES_PRE_UP 9
+#define EV_SES_ACCT_START 10
#define EV_CONFIG_RELOAD 11
-#define EV_PPP_AUTH_FAILED 12
-#define EV_PPP_PRE_FINISHED 13
+#define EV_SES_AUTH_FAILED 12
+#define EV_SES_PRE_FINISHED 13
#define EV_IP_CHANGED 100
#define EV_SHAPER 101
#define EV_MPPE_KEYS 102
@@ -24,11 +24,12 @@
#define EV_RADIUS_ACCESS_ACCEPT 200
#define EV_RADIUS_COA 201
+struct ap_session;
struct ppp_t;
struct rad_packet_t;
struct ev_radius_t
{
- struct ppp_t *ppp;
+ struct ap_session *ses;
struct rad_packet_t *request;
struct rad_packet_t *reply;
int res;
@@ -45,13 +46,13 @@ struct ev_mppe_keys_t
struct ev_shaper_t
{
- struct ppp_t *ppp;
+ struct ap_session *ses;
const char *val;
};
struct ev_dns_t
{
- struct ppp_t *ppp;
+ struct ap_session *ses;
in_addr_t dns1;
in_addr_t dns2;
};