1 ///////////////////////////////////////////////////////////
3 ///////////////////////////////////////////////////////////
4 PRED [LFTA_LEGAL, COST HIGH]str_exists_substr[string, string];
5 PRED [LFTA_LEGAL, COST HIGH]str_compare[string,string];
6 PRED [LFTA_LEGAL, COST LOW] str_match_offset [uint,string,string];
7 PRED [LFTA_LEGAL, COST LOW] byte_match_offset [uint,uint,string];
9 ///////////////////////////////////////////////////////////
11 ///////////////////////////////////////////////////////////
14 ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (ullong,ullong);
15 ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (ullong,ullong);
16 uint FUN [LFTA_LEGAL, COST FREE] UMIN (uint,uint);
17 uint FUN [LFTA_LEGAL, COST FREE] UMAX (uint,uint);
19 IP FUN [LFTA_LEGAL, COST FREE] UMIN (IP,IP);
20 IP FUN [LFTA_LEGAL, COST FREE] UMAX (IP,IP);
22 ///////////////////////////////////////////////////////////
23 // conditional functions
24 ///////////////////////////////////////////////////////////
26 uint FUN [LFTA_LEGAL, COST FREE] EQ (uint, uint);
27 uint FUN [LFTA_LEGAL, COST FREE] GEQ (uint, uint);
28 uint FUN [LFTA_LEGAL, COST FREE] LEQ (uint, uint);
31 ///////////////////////////////////////////////////////////
32 // Function for regex matching
33 ///////////////////////////////////////////////////////////
36 uint FUN [LFTA_LEGAL, COST EXPENSIVE]
37 str_regex_match( string, string HANDLE);
38 uint FUN [LFTA_LEGAL, COST EXPENSIVE]
39 str_partial_regex_match( string, string HANDLE, uint);
40 string FUN [PARTIAL, COST EXPENSIVE] str_extract_regex( string, string HANDLE);
42 ///////////////////////////////////////////////////////////
44 ///////////////////////////////////////////////////////////
46 string FUN [LFTA_LEGAL,PARTIAL,COST FREE] str_truncate (string, uint);
48 ///////////////////////////////////////////////////////////
49 // Function for casting
50 ///////////////////////////////////////////////////////////
52 int FUN [LFTA_LEGAL,COST FREE] non_temporal(int);
53 uint FUN [LFTA_LEGAL,COST FREE] non_temporal(uint);
54 llong FUN [LFTA_LEGAL,COST FREE] non_temporal(llong);
55 ullong FUN [LFTA_LEGAL,COST FREE] non_temporal(ullong);
57 int FUN [LFTA_LEGAL,COST FREE]INT(uint);
58 int FUN [LFTA_LEGAL,COST FREE]INT(ullong);
59 int FUN [LFTA_LEGAL,COST FREE]INT(llong);
61 uint FUN [LFTA_LEGAL,COST FREE]UINT(int);
62 uint FUN [LFTA_LEGAL,COST FREE]UINT(ullong);
63 uint FUN [LFTA_LEGAL,COST FREE]UINT(llong);
64 uint FUN [LFTA_LEGAL,COST FREE]UINT(IP);
66 float FUN [LFTA_LEGAL,COST FREE] FLOAT(llong);
67 float FUN [LFTA_LEGAL,COST FREE] FLOAT(ullong);
68 float FUN [LFTA_LEGAL,COST FREE] FLOAT(int);
69 float FUN [LFTA_LEGAL,COST FREE] FLOAT(uint);
71 ullong FUN [LFTA_LEGAL,COST FREE]ULLONG(uint);
72 ullong FUN [LFTA_LEGAL,COST FREE]ULLONG(int);
75 ///////////////////////////////////////////////////////////
76 // Convert an IPv4 address
77 ///////////////////////////////////////////////////////////
80 uint FUN [PARTIAL,COST HIGH] strtoi(string);
81 IP FUN [PARTIAL,COST HIGH] strtoip(string);
83 // for constant strings - faster at runtime
84 uint FUN [LFTA_LEGAL,COST LOW] strtoi_c(string HANDLE);
85 IP FUN [LFTA_LEGAL,COST LOW] strtoip_c(string HANDLE);
88 ///////////////////////////////////////////////////////////
89 // Compute running sum
90 ///////////////////////////////////////////////////////////
94 ullong UDAF [RUNNING, SUBAGGR moving_sum_lfta, SUPERAGGR super_moving_sum_udaf ] moving_sum_udaf fstring12 (uint, uint);
96 uint EXTR moving_sum moving_sum_udaf moving_sum_extract (uint,uint);
97 uint FUN [COST LOW] moving_sum_extract(ullong);
99 float EXTR moving_sum_exp moving_sum_udaf moving_sum_extract_exp (uint,uint, float);
100 float FUN [COST LOW] moving_sum_extract_exp(ullong, float);
102 ullong UDAF [RUNNING] super_moving_sum_udaf fstring12 (ullong);
103 ullong UDAF moving_sum_lfta fstring8 (uint, uint);
106 ///////////////////////////////////////////////////////////
107 // Compute the average of
108 // all positive numbers
109 ///////////////////////////////////////////////////////////
111 float UDAF POSAVG fstring16(float);
114 ///////////////////////////////////////////////////////////
115 // Simple average example
116 ///////////////////////////////////////////////////////////
118 float EXTR extr_avg avg_udaf extr_avg_fcn (uint);
119 float FUN extr_avg_fcn (string);
120 string UDAF[SUBAGGR avg_udaf_lfta, SUPERAGGR avg_udaf_hfta] avg_udaf fstring12 (uint);
121 string UDAF avg_udaf_hfta fstring12 (string);
122 string UDAF avg_udaf_lfta fstring12 (uint);
124 ///////////////////////////////////////////////////////////
126 ///////////////////////////////////////////////////////////
128 fstring100 STATE smart_sampling_state;
129 int SFUN packet_count smart_sampling_state ();
130 float SFUN gamma smart_sampling_state ();
131 int SFUN do_clean_count smart_sampling_state ();
132 int SFUN init_threshold smart_sampling_state ();
133 int SFUN delay smart_sampling_state();
134 int SFUN newly_closed smart_sampling_state();
136 ///////////////////////////////////////////////////////////
137 // Manku Heavy Hitter
138 ///////////////////////////////////////////////////////////
141 fstring20 STATE manku_hh_state;
142 BOOL SFUN local_count manku_hh_state (UINT);
143 int SFUN current_bucket manku_hh_state ();
145 ///////////////////////////////////////////////////////////
146 // FIRST and LAST aggregation funciton
147 // Should be replaced by builtins
148 ///////////////////////////////////////////////////////////
150 uint UDAF [RUNNING, SUBAGGR FIRST_lfta, SUPERAGGR FIRST_hfta] FIRST uint (uint);
151 uint UDAF [RUNNING] FIRST_hfta uint (uint);
152 uint UDAF [RUNNING] FIRST_lfta uint (uint);
154 ullong UDAF [RUNNING, SUBAGGR FIRST_ULL_lfta, SUPERAGGR FIRST_ULL_hfta] FIRST ullong (ullong);
155 ullong UDAF [RUNNING] FIRST_ULL_hfta ullong (ullong);
156 ullong UDAF [RUNNING] FIRST_ULL_lfta ullong (ullong);
158 IP UDAF [RUNNING, SUBAGGR FIRST_lfta, SUPERAGGR FIRST_hfta] FIRST IP (IP);
159 IP UDAF [RUNNING] FIRST_hfta IP (IP);
160 IP UDAF [RUNNING] FIRST_lfta IP (IP);
162 string UDAF [RUNNING, SUBAGGR FIRST_STR_lfta, SUPERAGGR FIRST_STR_hfta] FIRST string (string);
163 string UDAF [RUNNING] FIRST_STR_hfta string (string);
164 string UDAF [RUNNING] FIRST_STR_lfta string (string);
166 uint UDAF [RUNNING, SUBAGGR LAST_lfta, SUPERAGGR LAST_hfta] LAST uint (uint);
167 uint UDAF [RUNNING] LAST_hfta uint (uint);
168 uint UDAF [RUNNING] LAST_lfta uint (uint);
170 ullong UDAF [RUNNING, SUBAGGR LAST_ULL_lfta, SUPERAGGR LAST_ULL_hfta] LAST ullong (ullong);
171 ullong UDAF [RUNNING] LAST_ULL_hfta ullong (ullong);
172 ullong UDAF [RUNNING] LAST_ULL_lfta ullong (ullong);
174 IP UDAF [RUNNING, SUBAGGR LAST_lfta, SUPERAGGR LAST_hfta] LAST IP (IP);
175 IP UDAF [RUNNING] LAST_hfta IP (IP);
176 IP UDAF [RUNNING] LAST_lfta IP (IP);
178 string UDAF [RUNNING, SUBAGGR LAST_STR_lfta, SUPERAGGR LAST_STR_hfta] LAST string (string);
179 string UDAF [RUNNING] LAST_STR_hfta string (string);
180 string UDAF [RUNNING] LAST_STR_lfta string (string);
182 ///////////////////////////////////////////////////////////
183 // integer array aggregation funciton
184 // We are going to store 4 values in LFTA in fixed size buffer
185 // plus one byte for array length (17 bytes total)
186 // HFTA will combine partial aggregates
187 ///////////////////////////////////////////////////////////
189 string UDAF [RUNNING, SUBAGGR running_array_aggr_lfta, SUPERAGGR running_array_aggr_hfta] running_array_aggr string (uint);
190 string UDAF [RUNNING] running_array_aggr_hfta string (string);
191 string UDAF [RUNNING] running_array_aggr_lfta fstring17 (uint);