-void processtap(u8 * buf, int len);
-void processcontrol(u8 * buf, int len, struct sockaddr_in *addr);
-int assign_ip_address(sessionidt s);
-void free_ip_address(sessionidt s);
-void snoop_send_packet(char *packet, u16 size);
-void dump_acct_info();
-void mainloop(void);
-#define log _log
-#ifndef log_hex
-#define log_hex(a,b,c,d) do{if (a <= config->debug) _log_hex(a,0,0,0,b,c,d);}while (0)
-#endif
-void _log(int level, ipt address, sessionidt s, tunnelidt t, const char *format, ...);
-void _log_hex(int level, ipt address, sessionidt s, tunnelidt t, const char *title, const char *data, int maxsize);
-void build_chap_response(char *challenge, u8 id, u16 challenge_length, char **challenge_response);
-int sessionsetup(tunnelidt t, sessionidt s, u8 routes);
-int cluster_send_session(int s);
-int cluster_send_tunnel(int t);
-int cluster_send_goodbye();
-void init_cli();
+void snoop_send_packet(char *packet, u16 size, ipt destination, u16 port);
+int ip_filter(u8 *buf, int len, u8 filter);
+int cmd_show_ipcache(struct cli_def *cli, char *command, char **argv, int argc);
+int cmd_show_hist_idle(struct cli_def *cli, char *command, char **argv, int argc);
+int cmd_show_hist_open(struct cli_def *cli, char *command, char **argv, int argc);
+
+#undef LOG
+#undef LOG_HEX
+#define LOG(D, s, t, f, ...) ({ if (D <= config->debug) _log(D, s, t, f, ## __VA_ARGS__); })
+#define LOG_HEX(D, t, d, s) ({ if (D <= config->debug) _log_hex(D, t, d, s); })
+
+void _log(int level, sessionidt s, tunnelidt t, const char *format, ...) __attribute__((format (printf, 4, 5)));
+void _log_hex(int level, const char *title, const char *data, int maxsize);
+
+int sessionsetup(tunnelidt t, sessionidt s);
+int run_plugins(int plugin_type, void *data);
+void rebuild_address_pool(void);
+void throttle_session(sessionidt s, int rate_in, int rate_out);
+int load_session(sessionidt, sessiont *);
+void become_master(void); // We're the master; kick off any required master initializations.
+
+
+// cli.c
+void init_cli(char *hostname);