1 /* See the DRL-LICENSE file for this file's software license. */
6 #define _XOPEN_SOURCE 600 /* for pthread_rwlock_t */
10 #include <netinet/in_systm.h>
11 #include <netinet/in.h>
12 #include <netinet/ip.h>
13 #include <netinet/tcp.h>
14 #include <netinet/udp.h>
16 #include <sys/types.h>
17 #include <sys/socket.h>
22 #include <arpa/inet.h>
32 #include <ifaddrs.h> /* defines getifaddrs */
35 enum policies { POLICY_GRD = 1, POLICY_FPS = 2 };
36 enum commfabrics { COMM_MESH = 1, COMM_GOSSIP = 2 };
37 enum accountings { ACT_STANDARD = 1, ACT_SAMPLEHOLD = 2, ACT_SIMPLE = 3, ACT_MULTIPLE = 4 };
38 enum dampenings { DAMPEN_NONE = 0, DAMPEN_TEST = 1, DAMPEN_FAILED = 2, DAMPEN_PASSED = 3, DAMPEN_SKIP = 4 };
39 enum memberships { SWIM = 1, ZOOKEEPER = 2 };
40 enum failure_behaviors { PANIC = 1, QUORUM = 2 };
42 /* The comm library also has definitions for comfabrics. This prevents us
43 * from defining them twice. */
46 /* global constants */
47 #define IDENT_CLEAN_INTERVAL 5 /* in seconds */
49 #define LIMITER_LISTEN_PORT 9001
52 * The weight percentage increase that must occur before FPS does increase
55 #define LARGE_INCREASE_PERCENTAGE (0.05)
58 * Below this rate, a limiter is basically treated as idle, and its limit is
59 * raised to allow for increases should the limiter suddenly become active.
61 * This is used for FPS only. See estimate.c
63 #define FLOW_START_THRESHOLD (10000)
65 #define CLOSE_ENOUGH (0.90)
67 #define GRD_BIG_DROP (0.90)
70 * All fields come from the ip protocol header.
72 * 1 byte for the protocol.
73 * 4 bytes for the source ip.
74 * 4 bytes for the destination ip.
75 * 2 bytes for the source port.
76 * 2 bytes for the destination port.
80 #define FLOWKEYSIZE (13)
82 /* Causes each identity to track every flow in two tables. One table is as
83 * specified in the config file. The second is a standard table with
84 * "perfect" accounting so that we can compare the two. Turn this off for
85 * any type of production setting. */
86 //#define SHADOW_ACCTING
88 /* Turn this on to simulate network partitions.
89 * Turn off for production settings. */
90 #define ALLOW_PARTITION
92 /* forward declare some structs */
96 /* prototypes for threaded processing DRL model */
97 void handle_estimation(void *arg);