Importing all of DRL, including ulogd and all of its files.
[distributedratelimiting.git] / drl / raterouter.h
diff --git a/drl/raterouter.h b/drl/raterouter.h
new file mode 100644 (file)
index 0000000..28c6c7f
--- /dev/null
@@ -0,0 +1,81 @@
+/* See the DRL-LICENSE file for this file's software license. */
+
+#ifndef _RATEROUTER_H_
+#define _RATEROUTER_H_
+
+#define _XOPEN_SOURCE 600 /* for pthread_rwlock_t */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <netinet/in_systm.h>
+#include <netinet/in.h>
+#include <netinet/ip.h>
+#include <netinet/tcp.h>
+#include <netinet/udp.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <sys/un.h>
+#include <sys/poll.h>
+
+#include <arpa/inet.h>
+#include <time.h>
+#include <signal.h>
+#include <math.h>
+#include <limits.h>
+
+#include <pthread.h>
+#include <unistd.h>
+
+#include <netdb.h>
+#include <ifaddrs.h>  /* defines getifaddrs */
+#include <string.h>
+
+enum policies { POLICY_GRD = 1, POLICY_FPS = 2 };
+enum commfabrics { COMM_MESH = 1, COMM_GOSSIP = 2 };
+enum accountings { ACT_STANDARD = 1, ACT_SAMPLEHOLD = 2, ACT_SIMPLE = 3 };
+
+/* The comm library also has definitions for comfabrics. This prevents us
+ * from defining them twice. */
+#define COMM_DEFS
+
+/* global constants */
+#define IDENT_CLEAN_INTERVAL 5 /* in seconds */
+#define LIMITER_LISTEN_PORT 9001
+
+/**
+ * The weight percentage increase that must occur before FPS does increase
+ * dampening.
+ */
+#define LARGE_INCREASE_PERCENTAGE (0.05)
+
+/**
+ * Below this rate, a limiter is basically treated as idle, and its limit is
+ * raised to allow for increases should the limiter suddenly become active.
+ *
+ * This is used for FPS only.  See estimate.c
+ */
+#define FLOW_START_THRESHOLD (4096)
+
+/**
+ * All fields come from the ip protocol header.
+ *
+ * 1 byte for the protocol.
+ * 4 bytes for the source ip.
+ * 4 bytes for the destination ip.
+ * 2 bytes for the source port.
+ * 2 bytes for the destination port.
+ *
+ * 4+4+2+2+1 = 13.
+ */
+#define FLOWKEYSIZE (13)
+
+/* forward declare some structs */
+struct limiter;
+struct identity;
+
+/* prototypes for threaded processing DRL model */
+void handle_estimation(void *arg);
+
+#endif