+typedef struct
+{
+ int debug; // debugging level
+ time_t start_time; // time when l2tpns was started
+ char bandwidth[256]; // current bandwidth
+ char pid_file[256]; // file to write PID to on startup
+ int wrote_pid;
+ clockt current_time; // 1/10ths of a second since the process started.
+ // means that we can only run a given process
+ // for 13 years without re-starting!
+
+ char config_file[128];
+ int reload_config; // flag to re-read config (set by cli)
+ int multi_read_count; // amount of packets to read per fd in processing loop
+
+ char tundevice[10]; // tun device name
+ char log_filename[128];
+
+ char l2tp_secret[64]; // L2TP shared secret
+ int l2tp_mtu; // MTU of interface used for L2TP
+
+ char random_device[256]; // random device path, defaults to RANDOMDEVICE
+
+ int ppp_restart_time; // timeout for PPP restart
+ int ppp_max_configure; // max lcp configure requests to send
+ int ppp_max_failure; // max lcp configure naks to send
+
+ char radiussecret[64];
+ int radius_accounting;
+ int radius_interim;
+ in_addr_t radiusserver[MAXRADSERVER]; // radius servers
+ uint16_t radiusport[MAXRADSERVER]; // radius base ports
+ uint8_t numradiusservers; // radius server count
+
+ uint16_t radius_dae_port; // local port for radius dae
+
+ char radius_authtypes_s[32]; // list of valid authentication types (chap, pap) in order of preference
+ int radius_authtypes;
+ int radius_authprefer;
+
+ int allow_duplicate_users; // allow multiple logins with the same username
+ char guest_user[MAXUSER]; // allow multiple logins to guest account username
+
+ in_addr_t default_dns1, default_dns2;
+
+ unsigned long rl_rate; // default throttle rate
+ int num_tbfs; // number of throttle buckets
+
+ char accounting_dir[128];
+ in_addr_t bind_address;
+ in_addr_t peer_address;
+ int send_garp; // Set to true to garp for vip address on startup
+
+ int dump_speed;
+ char plugins[64][MAXPLUGINS];
+ char old_plugins[64][MAXPLUGINS];
+
+ int next_tbf; // Next HTB id available to use
+ int scheduler_fifo; // If the system has multiple CPUs, use FIFO scheduling
+ // policy for this process.
+ int lock_pages; // Lock pages into memory.
+ int icmp_rate; // Max number of ICMP unreachable per second to send
+ int max_packets; // DoS prevention: per session limit of packets/0.1s
+ char epdis_addr[20]; // MP Endpoint Discriminator address
+
+ in_addr_t cluster_address; // Multicast address of cluster.
+ // Send to this address to have everyone hear.
+ char cluster_interface[64]; // Which interface to listen for multicast on.
+ int cluster_iam_master; // Are we the cluster master???
+ int cluster_iam_uptodate; // Set if we've got a full set of state from the master.
+ in_addr_t cluster_master_address; // The network address of the cluster master.
+ // Zero if i am the cluster master.
+ int cluster_seq_number; // Sequence number of the next heartbeat we'll send out
+ // (or the seq number we're next expecting if we're a slave).
+ int cluster_undefined_sessions; // How many sessions we're yet to receive from the master.
+ int cluster_undefined_bundles; // How many bundles we're yet to receive from the master.
+ int cluster_undefined_tunnels; // How many tunnels we're yet to receive from the master.
+ int cluster_highest_sessionid;
+ int cluster_highest_bundleid;
+ int cluster_highest_tunnelid;
+ clockt cluster_last_hb; // Last time we saw a heartbeat from the master.
+ int cluster_last_hb_ver; // Heartbeat version last seen from master
+ int cluster_num_changes; // Number of changes queued.
+
+ int cluster_mcast_ttl; // TTL for multicast packets
+ int cluster_hb_interval; // How often to send a heartbeat.
+ int cluster_hb_timeout; // How many missed heartbeats trigger an election.
+ uint64_t cluster_table_version; // # state changes processed by cluster
+ int cluster_master_min_adv; // Master advertises routes while the number of up to date
+ // slaves is less than this value.
+
+ struct in6_addr ipv6_prefix; // Our IPv6 network pool.
+
+#ifdef BGP
+#define BGP_NUM_PEERS 2
+ uint16_t as_number;
+ struct {
+ char name[64];
+ uint16_t as;
+ int keepalive;
+ int hold;
+ } neighbour[BGP_NUM_PEERS];
+#endif
+} configt;
+
+enum config_typet { INT, STRING, UNSIGNED_LONG, SHORT, BOOL, IPv4, IPv6 };
+typedef struct
+{
+ char *key;
+ int offset;
+ int size;
+ enum config_typet type;
+} config_descriptt;
+
+typedef struct
+{
+ uint8_t op; // operation
+#define FILTER_PORT_OP_NONE 0 // all ports match
+#define FILTER_PORT_OP_EQ 1
+#define FILTER_PORT_OP_NEQ 2
+#define FILTER_PORT_OP_GT 3
+#define FILTER_PORT_OP_LT 4
+#define FILTER_PORT_OP_RANGE 5
+ uint16_t port; // port (host byte order)
+ uint16_t port2; // range
+} ip_filter_portt;
+
+typedef struct
+{
+ int action; // permit/deny
+#define FILTER_ACTION_DENY 1
+#define FILTER_ACTION_PERMIT 2
+ uint8_t proto; // protocol: IPPROTO_* (netinet/in.h)
+ in_addr_t src_ip; // source ip (network byte order)
+ in_addr_t src_wild;
+ ip_filter_portt src_ports;
+ in_addr_t dst_ip; // dest ip
+ in_addr_t dst_wild;
+ ip_filter_portt dst_ports;
+ uint8_t frag; // apply to non-initial fragments
+ uint8_t tcp_flag_op; // match type: any, all, established
+#define FILTER_FLAG_OP_ANY 1
+#define FILTER_FLAG_OP_ALL 2
+#define FILTER_FLAG_OP_EST 3
+ uint8_t tcp_sflags; // flags set
+ uint8_t tcp_cflags; // flags clear
+ uint32_t counter; // match count
+} ip_filter_rulet;
+
+#define TCP_FLAG_FIN 0x01
+#define TCP_FLAG_SYN 0x02
+#define TCP_FLAG_RST 0x04
+#define TCP_FLAG_PSH 0x08
+#define TCP_FLAG_ACK 0x10
+#define TCP_FLAG_URG 0x20
+
+#define MAXFILTER 32
+#define MAXFILTER_RULES 32
+typedef struct
+{
+ char name[32]; // ACL name
+ int extended; // type: 0 = standard, 1 = extended
+ ip_filter_rulet rules[MAXFILTER_RULES];
+ int used; // session ref count
+} ip_filtert;
+
+// CDN result/error codes
+#define CDN_NONE 0, 0
+#define CDN_TRY_ANOTHER 2, 7
+#define CDN_ADMIN_DISC 3, 0
+#define CDN_UNAVAILABLE 4, 0
+
+// RADIUS Acct-Terminate-Cause values
+#define TERM_USER_REQUEST 1
+#define TERM_LOST_CARRIER 2
+#define TERM_LOST_SERVICE 3
+#define TERM_IDLE_TIMEOUT 4
+#define TERM_SESSION_TIMEOUT 5
+#define TERM_ADMIN_RESET 6
+#define TERM_ADMIN_REBOOT 7
+#define TERM_PORT_ERROR 8
+#define TERM_NAS_ERROR 9
+#define TERM_NAS_REQUEST 10
+#define TERM_NAS_REBOOT 11
+#define TERM_PORT_UNNEEDED 12
+#define TERM_PORT_PREEMPTED 13
+#define TERM_PORT_SUSPENDED 14
+#define TERM_SERVICE_UNAVAILABLE 15
+#define TERM_CALLBACK 16
+#define TERM_USER_ERROR 17
+#define TERM_HOST_REQUEST 18
+#define TERM_SUPPLICANT_RESTART 19
+#define TERM_REAUTHENTICATION_FAILURE 20
+#define TERM_PORT_REINIT 21
+#define TERM_PORT_DISABLED 22
+