1
2
3 #include <libmisc/misc.h>
4 #include <libdev/packet_dev.h>
5 #include <libdev/status_dev.h>
6 #include <libdev/packet_client.h>
7 #include <link/link_pass.h>
8 #include <link/link_headers.h>
9 #include <link/neighbor.h>
10 #include <link/linkstats.h>
11 #include <emrun/emrun.h>
12
13
14 #define MAX_SLE_NEIGHBORS 64
15 #define RAMPUP_PACKETS 3 /* number of packets before conn is calculated */
16 #define PACKETS_PER_SECOND_CALC 10
17
18 #define DEFAULT_ALPHA 0.10
19 #define DEFAULT_INIT_RNP 1.25
20
21
22 typedef struct sle_history {
23 if_id_t if_id;
24 conn_t conn; /* calculated values */
25 int num_packets; /* for ramp up */
26 int valid; /* for ramp up as well... set to 1 after 3 packets received */
27 int prev_seq;
28 float rnp;
29 float rnp2;
30 struct timeval last_heard;
31
32 /* For the logging */
33 FILE* log;
34
35 /* array containing counts of missing packets between the last
36 hist_size packets */
37 int* missing; /* hogs mem... use queue or something later */
38
39 /* add time stamps for each seq number too? later? */
40 } sle_history_t;
41
42
43 typedef struct sle_state {
44 link_pass_ctx_t *pass_ctx;
45 status_context_t *status_ctx;
46 int create_ls_dev;
47 int hist_size; /* size of seqs array in sle_history*/
48 float alpha; /* for ewma on rnp */
49 float alpha2; /* for ewma on rnp2 */
50 float initrnp; /* for setting rnp's for ewma */
51
52 int use_metric; /* this tells us which metric to have in the binary
53 status device interface */
54
55 int loging_on; /* is super loging on */
56 char log_dir[PATH_MAX]; /* the base directory to output to */
57
58 /* used for calculate packets per second (calculated in printable) */
59 int last_packets[PACKETS_PER_SECOND_CALC];
60 int last_packet_index;
61
62 /* Each contains the history for a different node */
63 /* hogs memory... turn into hashtable/queue later */
64 sle_history_t histories[MAX_SLE_NEIGHBORS];
65
66 /* global seq for outgoing packets */
67 uint8_t last_seq;
68 } sle_state_t;
69
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.