+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 cleanup_interval; // interval between regular cleanups (in seconds)
+ 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 l2tpsecret[64];
+
+ char radiussecret[64];
+ int radius_accounting;
+ in_addr_t radiusserver[MAXRADSERVER]; // radius servers
+ uint16_t radiusport[MAXRADSERVER]; // radius base ports
+ uint8_t numradiusservers; // radius server count
+ short num_radfds; // Number of radius filehandles allocated
+
+ in_addr_t default_dns1, default_dns2;
+
+ unsigned long rl_rate; // default throttle rate
+ int num_tbfs; // number of throttle buckets
+
+ int save_state;
+ 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 target_uid;
+ 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
+
+ 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_tunnels; // How many tunnels we're yet to receive from the master.
+ int cluster_highest_sessionid;
+ int cluster_highest_tunnelid;
+ clockt cluster_last_hb; // Last time we saw a heartbeat from the master.
+ int cluster_num_changes; // Number of changes queued.
+
+ 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.
+
+#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, IP, MAC };
+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;
+