blob: 182b3938146e68670987533d924055ddb9cf5614 [file] [log] [blame]
Ben Menchaca84f36632014-02-28 20:57:38 +00001/*
2 **************************************************************************
Gareth Williamsd5618a82015-05-20 11:13:32 +01003 * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
Ben Menchaca84f36632014-02-28 20:57:38 +00004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all copies.
7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
13 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14 **************************************************************************
15 */
16
17/*
18 * API's
19 */
ratheesh kannoth37e35b02015-03-26 11:25:02 +053020#ifndef ECM_DB_H_
21#define ECM_DB_H_
22
23
Ben Menchaca84f36632014-02-28 20:57:38 +000024uint32_t ecm_db_time_get(void);
25void ecm_db_connection_defunct_all(void);
Gareth Williamsd5618a82015-05-20 11:13:32 +010026#ifdef ECM_DB_XREF_ENABLE
ratheesh kannoth37e35b02015-03-26 11:25:02 +053027void ecm_db_traverse_node_from_connection_list_and_decelerate(struct ecm_db_node_instance *node);
28void ecm_db_traverse_node_to_connection_list_and_decelerate(struct ecm_db_node_instance *node);
29void ecm_db_traverse_node_from_nat_connection_list_and_decelerate(struct ecm_db_node_instance *node);
30void ecm_db_traverse_node_to_nat_connection_list_and_decelerate(struct ecm_db_node_instance *node);
Murat Sezgin8c345822015-05-27 15:35:38 -070031#endif
Gareth Williamsf28ba5f2015-02-13 11:07:28 +000032int ecm_db_connection_count_get(void);
33
Ben Menchaca84f36632014-02-28 20:57:38 +000034void ecm_db_connection_data_totals_update_dropped(struct ecm_db_connection_instance *ci, bool is_from, uint64_t size, uint64_t packets);
35void ecm_db_connection_data_totals_update(struct ecm_db_connection_instance *ci, bool is_from, uint64_t size, uint64_t packets);
36
37bool ecm_db_connection_defunct_timer_reset(struct ecm_db_connection_instance *ci, ecm_db_timer_group_t tg);
38bool ecm_db_connection_defunct_timer_touch(struct ecm_db_connection_instance *ci);
39void ecm_db_connection_make_defunct(struct ecm_db_connection_instance *ci);
40
41uint32_t ecm_db_connection_serial_get(struct ecm_db_connection_instance *ci);
42
43void ecm_db_connection_from_address_get(struct ecm_db_connection_instance *ci, ip_addr_t addr);
44void ecm_db_connection_from_address_nat_get(struct ecm_db_connection_instance *ci, ip_addr_t addr);
45void ecm_db_connection_to_address_get(struct ecm_db_connection_instance *ci, ip_addr_t addr);
46void ecm_db_connection_to_address_nat_get(struct ecm_db_connection_instance *ci, ip_addr_t addr);
47int ecm_db_connection_to_port_get(struct ecm_db_connection_instance *ci);
48int ecm_db_connection_to_port_nat_get(struct ecm_db_connection_instance *ci);
49int ecm_db_connection_from_port_get(struct ecm_db_connection_instance *ci);
50int ecm_db_connection_from_port_nat_get(struct ecm_db_connection_instance *ci);
51
52void ecm_db_node_adress_get(struct ecm_db_node_instance *ni, uint8_t *address_buffer);
Ben Menchaca84f36632014-02-28 20:57:38 +000053
54void ecm_db_connection_from_node_address_get(struct ecm_db_connection_instance *ci, uint8_t *address_buffer);
55void ecm_db_connection_to_node_address_get(struct ecm_db_connection_instance *ci, uint8_t *address_buffer);
56void ecm_db_connection_to_nat_node_address_get(struct ecm_db_connection_instance *ci, uint8_t *address_buffer);
57void ecm_db_connection_from_nat_node_address_get(struct ecm_db_connection_instance *ci, uint8_t *address_buffer);
58void ecm_db_connection_to_iface_name_get(struct ecm_db_connection_instance *ci, char *name_buffer);
59void ecm_db_connection_from_iface_name_get(struct ecm_db_connection_instance *ci, char *name_buffer);
60int ecm_db_connection_from_iface_mtu_get(struct ecm_db_connection_instance *ci);
61ecm_db_iface_type_t ecm_db_connection_from_iface_type_get(struct ecm_db_connection_instance *ci);
62int ecm_db_connection_to_iface_mtu_get(struct ecm_db_connection_instance *ci);
63ecm_db_iface_type_t ecm_db_connection_to_iface_type_get(struct ecm_db_connection_instance *ci);
64
65ecm_db_iface_type_t ecm_db_connection_iface_type_get(struct ecm_db_iface_instance *ii);
66int32_t ecm_db_iface_mtu_reset(struct ecm_db_iface_instance *ii, int32_t mtu);
Murat Sezgin91c5d712015-06-12 15:16:22 -070067int32_t ecm_db_iface_ae_interface_identifier_get(struct ecm_db_iface_instance *ii);
Kiran Kumar C. S. K451b62e2014-05-19 20:34:06 +053068int32_t ecm_db_iface_interface_identifier_get(struct ecm_db_iface_instance *ii);
Shyam Sunder39e25672015-09-03 14:28:09 +053069void ecm_db_iface_identifier_hash_table_entry_check_and_update(struct ecm_db_iface_instance *ii, int32_t new_interface_identifier);
Ben Menchaca84f36632014-02-28 20:57:38 +000070
71struct ecm_front_end_connection_instance *ecm_db_connection_front_end_get_and_ref(struct ecm_db_connection_instance *ci);
72
73void ecm_db_connection_data_stats_get(struct ecm_db_connection_instance *ci, uint64_t *from_data_total, uint64_t *to_data_total, uint64_t *from_packet_total, uint64_t *to_packet_total, uint64_t *from_data_total_dropped, uint64_t *to_data_total_dropped, uint64_t *from_packet_total_dropped, uint64_t *to_packet_total_dropped);
74
Tushar Mathurd38cacd2015-07-28 12:19:10 +053075uint16_t ecm_db_connection_regeneration_occurrances_get(struct ecm_db_connection_instance *ci);
76void ecm_db_conection_regeneration_completed(struct ecm_db_connection_instance *ci);
77void ecm_db_conection_regeneration_failed(struct ecm_db_connection_instance *ci);
78bool ecm_db_connection_regeneration_required_check(struct ecm_db_connection_instance *ci);
79bool ecm_db_connection_regeneration_required_peek(struct ecm_db_connection_instance *ci);
80void ecm_db_connection_regeneration_needed(struct ecm_db_connection_instance *ci);
81void ecm_db_regeneration_needed(void);
Gareth Williamsb39e7c22015-03-25 10:15:33 +000082#ifdef ECM_DB_CTA_TRACK_ENABLE
Gareth Williamsdd6dfce2014-10-14 15:51:31 +010083void ecm_db_connection_regenerate_by_assignment_type(ecm_classifier_type_t ca_type);
84void ecm_db_connection_make_defunct_by_assignment_type(ecm_classifier_type_t ca_type);
Gareth Williamsb39e7c22015-03-25 10:15:33 +000085#endif
Gareth Williamsdd6dfce2014-10-14 15:51:31 +010086
Ben Menchaca84f36632014-02-28 20:57:38 +000087ecm_db_direction_t ecm_db_connection_direction_get(struct ecm_db_connection_instance *ci);
88
89void ecm_db_mapping_port_count_get(struct ecm_db_mapping_instance *mi, int *tcp_from, int *tcp_to, int *udp_from, int *udp_to, int *from, int *to, int *tcp_nat_from, int *tcp_nat_to, int *udp_nat_from, int *udp_nat_to, int *nat_from, int *nat_to);
90
Ben Menchaca84f36632014-02-28 20:57:38 +000091void ecm_db_host_address_get(struct ecm_db_host_instance *hi, ip_addr_t addr);
92bool ecm_db_host_on_link_get(struct ecm_db_host_instance *hi);
93
94void ecm_db_mapping_adress_get(struct ecm_db_mapping_instance *mi, ip_addr_t addr);
95int ecm_db_mapping_port_get(struct ecm_db_mapping_instance *mi);
96
97int ecm_db_connection_protocol_get(struct ecm_db_connection_instance *ci);
Gareth Williams3e5b37f2015-05-13 10:04:12 +010098int ecm_db_connection_ip_version_get(struct ecm_db_connection_instance *ci);
Ben Menchaca84f36632014-02-28 20:57:38 +000099bool ecm_db_connection_is_routed_get(struct ecm_db_connection_instance *ci);
100
101void ecm_db_connection_data_totals_update_tracked(struct ecm_db_connection_instance *ci, bool is_from, uint64_t size, uint64_t packets);
102void ecm_db_connection_data_totals_update_dropped(struct ecm_db_connection_instance *ci, bool is_from, uint64_t size, uint64_t packets);
103
104ecm_db_timer_group_t ecm_db_connection_timer_group_get(struct ecm_db_connection_instance *ci);
105void ecm_db_timer_group_entry_init(struct ecm_db_timer_group_entry *tge, ecm_db_timer_group_entry_callback_t fn, void *arg);
106void ecm_db_timer_group_entry_set(struct ecm_db_timer_group_entry *tge, ecm_db_timer_group_t tg);
107bool ecm_db_timer_group_entry_reset(struct ecm_db_timer_group_entry *tge, ecm_db_timer_group_t tg);
108bool ecm_db_timer_group_entry_remove(struct ecm_db_timer_group_entry *tge);
109bool ecm_db_timer_group_entry_touch(struct ecm_db_timer_group_entry *tge);
110
Ben Menchaca84f36632014-02-28 20:57:38 +0000111int ecm_db_mapping_connections_total_count_get(struct ecm_db_mapping_instance *mi);
Ben Menchaca84f36632014-02-28 20:57:38 +0000112
113struct ecm_db_host_instance *ecm_db_mapping_host_get_and_ref(struct ecm_db_mapping_instance *mi);
Ben Menchaca84f36632014-02-28 20:57:38 +0000114struct ecm_db_iface_instance *ecm_db_node_iface_get_and_ref(struct ecm_db_node_instance *ni);
Ben Menchaca84f36632014-02-28 20:57:38 +0000115
116struct ecm_db_mapping_instance *ecm_db_connection_mapping_from_get_and_ref(struct ecm_db_connection_instance *ci);
117struct ecm_db_mapping_instance *ecm_db_connection_mapping_to_get_and_ref(struct ecm_db_connection_instance *ci);
118struct ecm_db_mapping_instance *ecm_db_connection_mapping_nat_from_get_and_ref(struct ecm_db_connection_instance *ci);
119struct ecm_db_mapping_instance *ecm_db_connection_mapping_nat_to_get_and_ref(struct ecm_db_connection_instance *ci);
120struct ecm_db_node_instance *ecm_db_connection_node_from_get_and_ref(struct ecm_db_connection_instance *ci);
121struct ecm_db_node_instance *ecm_db_connection_node_to_get_and_ref(struct ecm_db_connection_instance *ci);
122
123struct ecm_db_host_instance *ecm_db_host_find_and_ref(ip_addr_t address);
124
125struct ecm_db_mapping_instance *ecm_db_mapping_find_and_ref(ip_addr_t address, int port);
126
127struct ecm_db_connection_instance *ecm_db_connection_serial_find_and_ref(uint32_t serial);
128struct ecm_db_connection_instance *ecm_db_connection_find_and_ref(ip_addr_t host1_addr, ip_addr_t host2_addr, int protocol, int host1_port, int host2_port);
129
130void ecm_db_iface_ethernet_address_get(struct ecm_db_iface_instance *ii, uint8_t *address);
Gareth Williams83125b12014-05-26 19:58:09 +0100131void ecm_db_iface_bridge_address_get(struct ecm_db_iface_instance *ii, uint8_t *address);
Murat Sezginaad635c2015-03-06 16:11:41 -0800132#ifdef ECM_INTERFACE_PPP_ENABLE
Ben Menchaca84f36632014-02-28 20:57:38 +0000133void ecm_db_iface_pppoe_session_info_get(struct ecm_db_iface_instance *ii, struct ecm_db_interface_info_pppoe *pppoe_info);
Murat Sezginaad635c2015-03-06 16:11:41 -0800134#endif
Murat Sezgin37fb3952015-03-10 16:45:13 -0700135#ifdef ECM_INTERFACE_VLAN_ENABLE
Ben Menchaca84f36632014-02-28 20:57:38 +0000136void ecm_db_iface_vlan_info_get(struct ecm_db_iface_instance *ii, struct ecm_db_interface_info_vlan *vlan_info);
Murat Sezgin37fb3952015-03-10 16:45:13 -0700137#endif
Ben Menchaca84f36632014-02-28 20:57:38 +0000138
Murat Sezgin91c5d712015-06-12 15:16:22 -0700139struct ecm_db_iface_instance *ecm_db_iface_find_and_ref_by_interface_identifier(int32_t interface_id);
Tushar Mathur4ab0bf92014-06-10 20:37:07 +0530140struct ecm_db_iface_instance *ecm_db_iface_ifidx_find_and_ref_ethernet(uint8_t *address, int32_t idx);
Murat Sezgin910c9662015-03-11 16:15:06 -0700141#ifdef ECM_INTERFACE_BOND_ENABLE
Ben Menchaca84f36632014-02-28 20:57:38 +0000142struct ecm_db_iface_instance *ecm_db_iface_find_and_ref_lag(uint8_t *address);
Murat Sezgin910c9662015-03-11 16:15:06 -0700143#endif
Murat Sezgin37fb3952015-03-10 16:45:13 -0700144#ifdef ECM_INTERFACE_VLAN_ENABLE
Radha krishna Simha Jiguruf7dc34c2014-05-12 18:59:07 +0530145struct ecm_db_iface_instance *ecm_db_iface_find_and_ref_vlan(uint8_t *address, uint16_t vlan_tag, uint16_t vlan_tpid);
Murat Sezgin37fb3952015-03-10 16:45:13 -0700146#endif
Ben Menchaca84f36632014-02-28 20:57:38 +0000147struct ecm_db_iface_instance *ecm_db_iface_find_and_ref_bridge(uint8_t *address);
148struct ecm_db_iface_instance *ecm_db_iface_find_and_ref_unknown(uint32_t os_specific_ident);
Murat Sezginaad635c2015-03-06 16:11:41 -0800149#ifdef ECM_INTERFACE_PPP_ENABLE
Ben Menchaca84f36632014-02-28 20:57:38 +0000150struct ecm_db_iface_instance *ecm_db_iface_find_and_ref_pppoe(uint16_t pppoe_session_id, uint8_t *remote_mac);
Murat Sezginaad635c2015-03-06 16:11:41 -0800151#endif
Ben Menchaca84f36632014-02-28 20:57:38 +0000152struct ecm_db_iface_instance *ecm_db_iface_find_and_ref_loopback(uint32_t os_specific_ident);
Murat Sezgin69a27532015-03-12 14:09:40 -0700153#ifdef ECM_INTERFACE_IPSEC_ENABLE
Ben Menchaca84f36632014-02-28 20:57:38 +0000154struct ecm_db_iface_instance *ecm_db_iface_find_and_ref_ipsec_tunnel(uint32_t os_specific_ident);
Murat Sezgin69a27532015-03-12 14:09:40 -0700155#endif
Murat Sezginbde55f92015-03-11 16:44:11 -0700156#ifdef ECM_INTERFACE_SIT_ENABLE
Ben Menchaca84f36632014-02-28 20:57:38 +0000157struct ecm_db_iface_instance *ecm_db_iface_find_and_ref_sit(ip_addr_t saddr, ip_addr_t daddr);
Murat Sezginbde55f92015-03-11 16:44:11 -0700158#endif
Murat Sezginc1402562015-03-12 12:32:20 -0700159#ifdef ECM_INTERFACE_TUNIPIP6_ENABLE
Ben Menchaca84f36632014-02-28 20:57:38 +0000160struct ecm_db_iface_instance *ecm_db_iface_find_and_ref_tunipip6(ip_addr_t saddr, ip_addr_t daddr);
Murat Sezginc1402562015-03-12 12:32:20 -0700161#endif
Ben Menchaca84f36632014-02-28 20:57:38 +0000162struct ecm_db_node_instance *ecm_db_node_find_and_ref(uint8_t *address);
163
164void ecm_db_connection_from_interfaces_reset(struct ecm_db_connection_instance *ci, struct ecm_db_iface_instance *interfaces[], int32_t new_first);
165void ecm_db_connection_to_interfaces_reset(struct ecm_db_connection_instance *ci, struct ecm_db_iface_instance *interfaces[], int32_t new_first);
166void ecm_db_connection_from_nat_interfaces_reset(struct ecm_db_connection_instance *ci, struct ecm_db_iface_instance *interfaces[], int32_t new_first);
167void ecm_db_connection_to_nat_interfaces_reset(struct ecm_db_connection_instance *ci, struct ecm_db_iface_instance *interfaces[], int32_t new_first);
168
169void ecm_db_connection_from_interfaces_clear(struct ecm_db_connection_instance *ci);
170void ecm_db_connection_from_nat_interfaces_clear(struct ecm_db_connection_instance *ci);
171void ecm_db_connection_to_interfaces_clear(struct ecm_db_connection_instance *ci);
172void ecm_db_connection_to_nat_interfaces_clear(struct ecm_db_connection_instance *ci);
173
174bool ecm_db_connection_to_interfaces_set_check(struct ecm_db_connection_instance *ci);
175bool ecm_db_connection_from_interfaces_set_check(struct ecm_db_connection_instance *ci);
176bool ecm_db_connection_to_nat_interfaces_set_check(struct ecm_db_connection_instance *ci);
177bool ecm_db_connection_from_nat_interfaces_set_check(struct ecm_db_connection_instance *ci);
178
179int32_t ecm_db_connection_to_nat_interfaces_get_count(struct ecm_db_connection_instance *ci);
180int32_t ecm_db_connection_from_nat_interfaces_get_count(struct ecm_db_connection_instance *ci);
181int32_t ecm_db_connection_to_interfaces_get_count(struct ecm_db_connection_instance *ci);
182int32_t ecm_db_connection_from_interfaces_get_count(struct ecm_db_connection_instance *ci);
183
184int32_t ecm_db_connection_from_interfaces_get_and_ref(struct ecm_db_connection_instance *ci, struct ecm_db_iface_instance *interfaces[]);
185int32_t ecm_db_connection_to_interfaces_get_and_ref(struct ecm_db_connection_instance *ci, struct ecm_db_iface_instance *interfaces[]);
186int32_t ecm_db_connection_from_nat_interfaces_get_and_ref(struct ecm_db_connection_instance *ci, struct ecm_db_iface_instance *interfaces[]);
187int32_t ecm_db_connection_to_nat_interfaces_get_and_ref(struct ecm_db_connection_instance *ci, struct ecm_db_iface_instance *interfaces[]);
188void ecm_db_connection_interfaces_deref(struct ecm_db_iface_instance *interfaces[], int32_t first);
189
Gareth Williamsf98d4192015-03-11 16:55:41 +0000190struct ecm_db_connection_instance *ecm_db_connections_get_and_ref_first(void);
191struct ecm_db_connection_instance *ecm_db_connection_get_and_ref_next(struct ecm_db_connection_instance *ci);
192
193struct ecm_db_mapping_instance *ecm_db_mappings_get_and_ref_first(void);
194struct ecm_db_mapping_instance *ecm_db_mapping_get_and_ref_next(struct ecm_db_mapping_instance *mi);
195
196struct ecm_db_host_instance *ecm_db_hosts_get_and_ref_first(void);
197struct ecm_db_host_instance *ecm_db_host_get_and_ref_next(struct ecm_db_host_instance *hi);
198
199struct ecm_db_node_instance *ecm_db_nodes_get_and_ref_first(void);
200struct ecm_db_node_instance *ecm_db_node_get_and_ref_next(struct ecm_db_node_instance *ni);
201
202struct ecm_db_iface_instance *ecm_db_interfaces_get_and_ref_first(void);
203struct ecm_db_iface_instance *ecm_db_interface_get_and_ref_next(struct ecm_db_iface_instance *ii);
204
Gareth Williamsb5903892015-03-20 15:13:07 +0000205#ifdef ECM_DB_XREF_ENABLE
206int ecm_db_host_mapping_count_get(struct ecm_db_host_instance *hi);
207int ecm_db_iface_node_count_get(struct ecm_db_iface_instance *ii);
208
Ben Menchaca84f36632014-02-28 20:57:38 +0000209struct ecm_db_connection_instance *ecm_db_mapping_connections_from_get_and_ref_first(struct ecm_db_mapping_instance *mi);
210struct ecm_db_connection_instance *ecm_db_mapping_connections_to_get_and_ref_first(struct ecm_db_mapping_instance *mi);
211struct ecm_db_connection_instance *ecm_db_connection_mapping_from_get_and_ref_next(struct ecm_db_connection_instance *ci);
212struct ecm_db_connection_instance *ecm_db_connection_mapping_to_get_and_ref_next(struct ecm_db_connection_instance *ci);
213
214struct ecm_db_connection_instance *ecm_db_mapping_connections_nat_from_get_and_ref_first(struct ecm_db_mapping_instance *mi);
215struct ecm_db_connection_instance *ecm_db_mapping_connections_nat_to_get_and_ref_first(struct ecm_db_mapping_instance *mi);
216struct ecm_db_connection_instance *ecm_db_connection_mapping_nat_from_get_and_ref_next(struct ecm_db_connection_instance *ci);
217struct ecm_db_connection_instance *ecm_db_connection_mapping_nat_to_get_and_ref_next(struct ecm_db_connection_instance *ci);
218
219struct ecm_db_connection_instance *ecm_db_iface_connections_from_get_and_ref_first(struct ecm_db_iface_instance *ii);
220struct ecm_db_connection_instance *ecm_db_iface_connections_to_get_and_ref_first(struct ecm_db_iface_instance *ii);
221struct ecm_db_connection_instance *ecm_db_connection_iface_from_get_and_ref_next(struct ecm_db_connection_instance *ci);
222struct ecm_db_connection_instance *ecm_db_connection_iface_to_get_and_ref_next(struct ecm_db_connection_instance *ci);
223
224struct ecm_db_connection_instance *ecm_db_iface_connections_nat_from_get_and_ref_first(struct ecm_db_iface_instance *ii);
225struct ecm_db_connection_instance *ecm_db_iface_connections_nat_to_get_and_ref_first(struct ecm_db_iface_instance *ii);
226struct ecm_db_connection_instance *ecm_db_connection_iface_nat_from_get_and_ref_next(struct ecm_db_connection_instance *ci);
227struct ecm_db_connection_instance *ecm_db_connection_iface_nat_to_get_and_ref_next(struct ecm_db_connection_instance *ci);
228
229struct ecm_db_node_instance *ecm_db_iface_nodes_get_and_ref_first(struct ecm_db_iface_instance *ii);
Gareth Williamsb5903892015-03-20 15:13:07 +0000230#endif
Ben Menchaca84f36632014-02-28 20:57:38 +0000231
232struct ecm_db_node_instance *ecm_db_node_get_and_ref_next(struct ecm_db_node_instance *ni);
233struct ecm_db_host_instance *ecm_db_host_get_and_ref_next(struct ecm_db_host_instance *hi);
234
235struct ecm_classifier_default_instance *ecm_db_connection_classifier_default_get_and_ref(struct ecm_db_connection_instance *ci);
236
237void ecm_db_connection_classifier_assign(struct ecm_db_connection_instance *ci, struct ecm_classifier_instance *new_ca);
238int ecm_db_connection_classifier_assignments_get_and_ref(struct ecm_db_connection_instance *ci, struct ecm_classifier_instance *assignments[]);
239void ecm_db_connection_classifier_unassign(struct ecm_db_connection_instance *ci, struct ecm_classifier_instance *cci);
240void ecm_db_connection_assignments_release(int assignment_count, struct ecm_classifier_instance *assignments[]);
241struct ecm_classifier_instance *ecm_db_connection_assigned_classifier_find_and_ref(struct ecm_db_connection_instance *ci, ecm_classifier_type_t type);
242
Gareth Williamsb39e7c22015-03-25 10:15:33 +0000243#ifdef ECM_DB_CTA_TRACK_ENABLE
Gareth Williamsf98d4192015-03-11 16:55:41 +0000244struct ecm_db_connection_instance *ecm_db_connection_by_classifier_type_assignment_get_and_ref_first(ecm_classifier_type_t ca_type);
245struct ecm_db_connection_instance *ecm_db_connection_by_classifier_type_assignment_get_and_ref_next(struct ecm_db_connection_instance *ci, ecm_classifier_type_t ca_type);
246void ecm_db_connection_by_classifier_type_assignment_deref(struct ecm_db_connection_instance *ci, ecm_classifier_type_t ca_type);
Gareth Williamsb39e7c22015-03-25 10:15:33 +0000247#endif
Gareth Williamsf98d4192015-03-11 16:55:41 +0000248
Ben Menchaca84f36632014-02-28 20:57:38 +0000249struct ecm_db_listener_instance *ecm_db_listener_alloc(void);
250struct ecm_db_connection_instance *ecm_db_connection_alloc(void);
251struct ecm_db_host_instance *ecm_db_host_alloc(void);
252struct ecm_db_mapping_instance *ecm_db_mapping_alloc(void);
253struct ecm_db_node_instance *ecm_db_node_alloc(void);
254struct ecm_db_iface_instance *ecm_db_iface_alloc(void);
255
256char *ecm_db_interface_type_to_string(ecm_db_iface_type_t type);
257
258void ecm_db_listener_add(struct ecm_db_listener_instance *li, ecm_db_iface_listener_added_callback_t iface_added, ecm_db_iface_listener_removed_callback_t iface_removed, ecm_db_node_listener_added_callback_t node_added, ecm_db_node_listener_removed_callback_t node_removed, ecm_db_host_listener_added_callback_t host_added, ecm_db_host_listener_removed_callback_t host_removed, ecm_db_mapping_listener_added_callback_t mapping_added, ecm_db_mapping_listener_removed_callback_t mapping_removed, ecm_db_connection_listener_added_callback_t connection_added, ecm_db_connection_listener_removed_callback_t connection_removed, ecm_db_listener_final_callback_t final, void *arg);
259
Murat Sezgin91c5d712015-06-12 15:16:22 -0700260void ecm_db_iface_add_ethernet(struct ecm_db_iface_instance *ii, uint8_t *address, char *name, int32_t mtu, int32_t interface_identifier, int32_t ae_interface_identifier, ecm_db_iface_final_callback_t final, void *arg);
Murat Sezgin910c9662015-03-11 16:15:06 -0700261#ifdef ECM_INTERFACE_BOND_ENABLE
Murat Sezgin91c5d712015-06-12 15:16:22 -0700262void ecm_db_iface_add_lag(struct ecm_db_iface_instance *ii, uint8_t *address, char *name, int32_t mtu, int32_t interface_identifier, int32_t ae_interface_identifier, ecm_db_iface_final_callback_t final, void *arg);
Murat Sezgin910c9662015-03-11 16:15:06 -0700263#endif
Murat Sezgin91c5d712015-06-12 15:16:22 -0700264void ecm_db_iface_add_bridge(struct ecm_db_iface_instance *ii, uint8_t *address, char *name, int32_t mtu, int32_t interface_identifier, int32_t ae_interface_identifier, ecm_db_iface_final_callback_t final, void *arg);
Murat Sezgin37fb3952015-03-10 16:45:13 -0700265#ifdef ECM_INTERFACE_VLAN_ENABLE
Murat Sezgin91c5d712015-06-12 15:16:22 -0700266void ecm_db_iface_add_vlan(struct ecm_db_iface_instance *ii, uint8_t *address, uint16_t vlan_tag, uint16_t vlan_tpid, char *name, int32_t mtu, int32_t interface_identifier, int32_t ae_interface_identifier, ecm_db_iface_final_callback_t final, void *arg);
Murat Sezgin37fb3952015-03-10 16:45:13 -0700267#endif
Murat Sezginaad635c2015-03-06 16:11:41 -0800268#ifdef ECM_INTERFACE_PPP_ENABLE
Murat Sezgin91c5d712015-06-12 15:16:22 -0700269void ecm_db_iface_add_pppoe(struct ecm_db_iface_instance *ii, uint16_t pppoe_session_id, uint8_t *remote_mac, char *name, int32_t mtu, int32_t interface_identifier, int32_t ae_interface_identifier, ecm_db_iface_final_callback_t final, void *arg);
Murat Sezginaad635c2015-03-06 16:11:41 -0800270#endif
Murat Sezgin91c5d712015-06-12 15:16:22 -0700271void ecm_db_iface_add_unknown(struct ecm_db_iface_instance *ii, uint32_t os_specific_ident, char *name, int32_t mtu, int32_t interface_identifier, int32_t ae_interface_identifier, ecm_db_iface_final_callback_t final, void *arg);
272void ecm_db_iface_add_loopback(struct ecm_db_iface_instance *ii, uint32_t os_specific_ident, char *name, int32_t mtu, int32_t interface_identifier, int32_t ae_interface_identifier, ecm_db_iface_final_callback_t final, void *arg);
Murat Sezgin69a27532015-03-12 14:09:40 -0700273#ifdef ECM_INTERFACE_IPSEC_ENABLE
Murat Sezgin91c5d712015-06-12 15:16:22 -0700274void ecm_db_iface_add_ipsec_tunnel(struct ecm_db_iface_instance *ii, uint32_t os_specific_ident, char *name, int32_t mtu, int32_t interface_identifier, int32_t ae_interface_identifier, ecm_db_iface_final_callback_t final, void *arg);
Murat Sezgin69a27532015-03-12 14:09:40 -0700275#endif
Murat Sezginbde55f92015-03-11 16:44:11 -0700276#ifdef ECM_INTERFACE_SIT_ENABLE
Zhu Ken56477be2014-08-05 17:50:28 +0800277bool ecm_db_iface_sit_daddr_is_null(struct ecm_db_iface_instance *ii);
Murat Sezgin91c5d712015-06-12 15:16:22 -0700278void ecm_db_iface_add_sit(struct ecm_db_iface_instance *ii, struct ecm_db_interface_info_sit *type_info, char *name, int32_t mtu, int32_t interface_identifier, int32_t ae_interface_identifier, ecm_db_iface_final_callback_t final, void *arg);
Murat Sezginbde55f92015-03-11 16:44:11 -0700279#endif
Murat Sezginc1402562015-03-12 12:32:20 -0700280#ifdef ECM_INTERFACE_TUNIPIP6_ENABLE
Murat Sezgin91c5d712015-06-12 15:16:22 -0700281void ecm_db_iface_add_tunipip6(struct ecm_db_iface_instance *ii, struct ecm_db_interface_info_tunipip6 *type_info, char *name, int32_t mtu, int32_t interface_identifier, int32_t ae_interface_identifier, ecm_db_iface_final_callback_t final, void *arg);
Murat Sezginc1402562015-03-12 12:32:20 -0700282#endif
Ben Menchaca84f36632014-02-28 20:57:38 +0000283void ecm_db_node_add(struct ecm_db_node_instance *ni, struct ecm_db_iface_instance *ii, uint8_t *address, ecm_db_node_final_callback_t final, void *arg);
Gareth Williams90f2a282014-08-27 15:56:25 +0100284void ecm_db_host_add(struct ecm_db_host_instance *hi, ip_addr_t address, bool on_link, ecm_db_host_final_callback_t final, void *arg);
Ben Menchaca84f36632014-02-28 20:57:38 +0000285void ecm_db_mapping_add(struct ecm_db_mapping_instance *mi, struct ecm_db_host_instance *hi, int port, ecm_db_mapping_final_callback_t final, void *arg);
Gareth Williams3e5b37f2015-05-13 10:04:12 +0100286void ecm_db_connection_add(struct ecm_db_connection_instance *ci, struct ecm_front_end_connection_instance *feci, struct ecm_db_mapping_instance *mapping_from, struct ecm_db_mapping_instance *mapping_to, struct ecm_db_mapping_instance *mapping_nat_from, struct ecm_db_mapping_instance *mapping_nat_to, struct ecm_db_node_instance *from_node, struct ecm_db_node_instance *to_node, struct ecm_db_node_instance *from_nat_node, struct ecm_db_node_instance *to_nat_node, int ip_version, int protocol, ecm_db_direction_t dir, ecm_db_connection_final_callback_t final, ecm_db_connection_defunct_callback_t defunct, ecm_db_timer_group_t tg, bool is_routed, void *arg);
Ben Menchaca84f36632014-02-28 20:57:38 +0000287
288void ecm_db_listener_ref(struct ecm_db_listener_instance *li);
289void ecm_db_connection_ref(struct ecm_db_connection_instance *ci);
290void ecm_db_host_ref(struct ecm_db_host_instance *hi);
291void ecm_db_mapping_ref(struct ecm_db_mapping_instance *mi);
292void ecm_db_iface_ref(struct ecm_db_iface_instance *ii);
293void ecm_db_node_ref(struct ecm_db_node_instance *ni);
294
295int ecm_db_listener_deref(struct ecm_db_listener_instance *li);
296int ecm_db_connection_deref(struct ecm_db_connection_instance *ci);
297int ecm_db_host_deref(struct ecm_db_host_instance *hi);
298int ecm_db_mapping_deref(struct ecm_db_mapping_instance *mi);
299int ecm_db_iface_deref(struct ecm_db_iface_instance *ii);
300int ecm_db_node_deref(struct ecm_db_node_instance *ni);
301
Gareth Williamsf98d4192015-03-11 16:55:41 +0000302int ecm_db_connection_count_by_protocol_get(int protocol);
303
304#ifdef ECM_STATE_OUTPUT_ENABLE
Gareth Williamsd5618a82015-05-20 11:13:32 +0100305int ecm_db_connection_state_get(struct ecm_state_file_instance *sfi, struct ecm_db_connection_instance *ci);
306int ecm_db_mapping_state_get(struct ecm_state_file_instance *sfi, struct ecm_db_mapping_instance *mi);
307int ecm_db_host_state_get(struct ecm_state_file_instance *sfi, struct ecm_db_host_instance *hi);
308int ecm_db_node_state_get(struct ecm_state_file_instance *sfi, struct ecm_db_node_instance *ni);
309int ecm_db_iface_state_get(struct ecm_state_file_instance *sfi, struct ecm_db_iface_instance *ii);
Gareth Williamsf98d4192015-03-11 16:55:41 +0000310int ecm_db_connection_hash_table_lengths_get(int index);
311int ecm_db_connection_hash_index_get_next(int index);
312int ecm_db_connection_hash_index_get_first(void);
313int ecm_db_mapping_hash_table_lengths_get(int index);
314int ecm_db_mapping_hash_index_get_next(int index);
315int ecm_db_mapping_hash_index_get_first(void);
316int ecm_db_host_hash_table_lengths_get(int index);
317int ecm_db_host_hash_index_get_next(int index);
318int ecm_db_host_hash_index_get_first(void);
319int ecm_db_node_hash_table_lengths_get(int index);
320int ecm_db_node_hash_index_get_next(int index);
321int ecm_db_node_hash_index_get_first(void);
322int ecm_db_iface_hash_table_lengths_get(int index);
323int ecm_db_iface_hash_index_get_next(int index);
324int ecm_db_iface_hash_index_get_first(void);
325int ecm_db_protocol_get_next(int protocol);
326int ecm_db_protocol_get_first(void);
327#endif
Shyam Sunder1f037262015-05-18 20:04:13 +0530328
329#ifdef ECM_MULTICAST_ENABLE
330struct ecm_db_multicast_tuple_instance *ecm_db_multicast_tuple_instance_alloc(ip_addr_t origin, ip_addr_t group, uint16_t src_port, uint16_t dst_port);
331int ecm_db_multicast_tuple_instance_deref(struct ecm_db_multicast_tuple_instance *ti);
Shyam Sunder3af86a52015-08-28 18:04:10 +0530332void ecm_db_multicast_connection_deref(struct ecm_db_multicast_tuple_instance *ti);
Shyam Sunderbf40d0e2015-06-23 15:56:37 +0530333void ecm_db_multicast_tuple_instance_add(struct ecm_db_multicast_tuple_instance *ti, struct ecm_db_connection_instance *ci);
Shyam Sunder3af86a52015-08-28 18:04:10 +0530334struct ecm_db_multicast_tuple_instance *ecm_db_multicast_connection_find_and_ref(ip_addr_t origin, ip_addr_t group);
335struct ecm_db_multicast_tuple_instance *ecm_db_multicast_connection_get_and_ref_first(ip_addr_t group);
336struct ecm_db_multicast_tuple_instance *ecm_db_multicast_connection_get_and_ref_next(struct ecm_db_multicast_tuple_instance *ti);
Shyam Sunder1f037262015-05-18 20:04:13 +0530337void ecm_db_multicast_tuple_instance_source_ip_get(struct ecm_db_multicast_tuple_instance *ti, ip_addr_t origin);
Shyam Sunderf34c25b2015-06-11 21:14:50 +0530338void ecm_db_multicast_tuple_instance_group_ip_get(struct ecm_db_multicast_tuple_instance *ti, ip_addr_t group);
Shyam Sunder1f037262015-05-18 20:04:13 +0530339uint32_t ecm_db_multicast_tuple_instance_flags_get(struct ecm_db_multicast_tuple_instance *ti);
340void ecm_db_multicast_tuple_instance_flags_set(struct ecm_db_multicast_tuple_instance *ti, uint32_t flags);
341void ecm_db_multicast_tuple_instance_flags_clear(struct ecm_db_multicast_tuple_instance *ti, uint32_t flags);
342
Shyam Sunder3af86a52015-08-28 18:04:10 +0530343struct ecm_db_connection_instance *ecm_db_multicast_connection_get_from_tuple(struct ecm_db_multicast_tuple_instance *ti);
Shyam Sunder1f037262015-05-18 20:04:13 +0530344void ecm_db_multicast_connection_to_interfaces_deref_all(struct ecm_db_iface_instance *interfaces, int32_t *ifaces_first);
345void ecm_db_multicast_connection_to_interfaces_clear(struct ecm_db_connection_instance *ci);
346int32_t ecm_db_multicast_connection_to_interfaces_get_and_ref_all(struct ecm_db_connection_instance *ci, struct ecm_db_iface_instance **interfaces, int32_t **to_ifaces_first);
Shyam Sunderbf40d0e2015-06-23 15:56:37 +0530347int ecm_db_multicast_connection_to_interfaces_reset(struct ecm_db_connection_instance *ci, struct ecm_db_iface_instance *interfaces, int32_t *new_first);
Shyam Sunder1f037262015-05-18 20:04:13 +0530348void ecm_db_multicast_connection_to_interfaces_update(struct ecm_db_connection_instance *ci, struct ecm_db_iface_instance *interfaces, int32_t *new_first, int *join_valid_idx);
349void ecm_db_multicast_connection_data_totals_update(struct ecm_db_connection_instance *ci, bool is_from, uint64_t size, uint64_t packets);
350void ecm_db_multicast_connection_to_interfaces_clear_at_index(struct ecm_db_connection_instance *ci, uint32_t index);
Shyam Sunder3b049ff2015-05-18 20:44:30 +0530351void ecm_db_multicast_connection_data_totals_update(struct ecm_db_connection_instance *ci, bool is_from, uint64_t size, uint64_t packets);
352void ecm_db_multicast_connection_interface_heirarchy_stats_update(struct ecm_db_connection_instance *ci, uint64_t size, uint64_t packets);
Shyam Sunder1f037262015-05-18 20:04:13 +0530353bool ecm_db_multicast_connection_to_interfaces_set_check(struct ecm_db_connection_instance *ci);
354#endif
ratheesh kannoth37e35b02015-03-26 11:25:02 +0530355#endif