Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 1 | /* |
| 2 | ************************************************************************** |
Murat Sezgin | aad635c | 2015-03-06 16:11:41 -0800 | [diff] [blame] | 3 | * Copyright (c) 2014,2015, The Linux Foundation. All rights reserved. |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 4 | * 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 | */ |
| 20 | uint32_t ecm_db_time_get(void); |
| 21 | void ecm_db_connection_defunct_all(void); |
| 22 | |
Gareth Williams | f28ba5f | 2015-02-13 11:07:28 +0000 | [diff] [blame] | 23 | int ecm_db_connection_count_get(void); |
| 24 | |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 25 | void ecm_db_connection_data_totals_update_dropped(struct ecm_db_connection_instance *ci, bool is_from, uint64_t size, uint64_t packets); |
| 26 | void ecm_db_connection_data_totals_update(struct ecm_db_connection_instance *ci, bool is_from, uint64_t size, uint64_t packets); |
| 27 | |
| 28 | bool ecm_db_connection_defunct_timer_reset(struct ecm_db_connection_instance *ci, ecm_db_timer_group_t tg); |
| 29 | bool ecm_db_connection_defunct_timer_touch(struct ecm_db_connection_instance *ci); |
| 30 | void ecm_db_connection_make_defunct(struct ecm_db_connection_instance *ci); |
| 31 | |
| 32 | uint32_t ecm_db_connection_serial_get(struct ecm_db_connection_instance *ci); |
| 33 | |
| 34 | void ecm_db_connection_from_address_get(struct ecm_db_connection_instance *ci, ip_addr_t addr); |
| 35 | void ecm_db_connection_from_address_nat_get(struct ecm_db_connection_instance *ci, ip_addr_t addr); |
| 36 | void ecm_db_connection_to_address_get(struct ecm_db_connection_instance *ci, ip_addr_t addr); |
| 37 | void ecm_db_connection_to_address_nat_get(struct ecm_db_connection_instance *ci, ip_addr_t addr); |
| 38 | int ecm_db_connection_to_port_get(struct ecm_db_connection_instance *ci); |
| 39 | int ecm_db_connection_to_port_nat_get(struct ecm_db_connection_instance *ci); |
| 40 | int ecm_db_connection_from_port_get(struct ecm_db_connection_instance *ci); |
| 41 | int ecm_db_connection_from_port_nat_get(struct ecm_db_connection_instance *ci); |
| 42 | |
| 43 | void ecm_db_node_adress_get(struct ecm_db_node_instance *ni, uint8_t *address_buffer); |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 44 | |
| 45 | void ecm_db_connection_from_node_address_get(struct ecm_db_connection_instance *ci, uint8_t *address_buffer); |
| 46 | void ecm_db_connection_to_node_address_get(struct ecm_db_connection_instance *ci, uint8_t *address_buffer); |
| 47 | void ecm_db_connection_to_nat_node_address_get(struct ecm_db_connection_instance *ci, uint8_t *address_buffer); |
| 48 | void ecm_db_connection_from_nat_node_address_get(struct ecm_db_connection_instance *ci, uint8_t *address_buffer); |
| 49 | void ecm_db_connection_to_iface_name_get(struct ecm_db_connection_instance *ci, char *name_buffer); |
| 50 | void ecm_db_connection_from_iface_name_get(struct ecm_db_connection_instance *ci, char *name_buffer); |
| 51 | int ecm_db_connection_from_iface_mtu_get(struct ecm_db_connection_instance *ci); |
| 52 | ecm_db_iface_type_t ecm_db_connection_from_iface_type_get(struct ecm_db_connection_instance *ci); |
| 53 | int ecm_db_connection_to_iface_mtu_get(struct ecm_db_connection_instance *ci); |
| 54 | ecm_db_iface_type_t ecm_db_connection_to_iface_type_get(struct ecm_db_connection_instance *ci); |
| 55 | |
| 56 | ecm_db_iface_type_t ecm_db_connection_iface_type_get(struct ecm_db_iface_instance *ii); |
| 57 | int32_t ecm_db_iface_mtu_reset(struct ecm_db_iface_instance *ii, int32_t mtu); |
| 58 | int32_t ecm_db_iface_nss_interface_identifier_get(struct ecm_db_iface_instance *ii); |
Kiran Kumar C. S. K | 451b62e | 2014-05-19 20:34:06 +0530 | [diff] [blame] | 59 | int32_t ecm_db_iface_interface_identifier_get(struct ecm_db_iface_instance *ii); |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 60 | |
| 61 | struct ecm_front_end_connection_instance *ecm_db_connection_front_end_get_and_ref(struct ecm_db_connection_instance *ci); |
| 62 | |
| 63 | void 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); |
| 64 | |
| 65 | void ecm_db_classifier_generation_change(void); |
| 66 | |
| 67 | void ecm_db_connection_classifier_generation_change(struct ecm_db_connection_instance *ci); |
| 68 | bool ecm_db_connection_classifier_generation_changed(struct ecm_db_connection_instance *ci); |
| 69 | bool ecm_db_connection_classifier_peek_generation_changed(struct ecm_db_connection_instance *ci); |
| 70 | |
Gareth Williams | dd6dfce | 2014-10-14 15:51:31 +0100 | [diff] [blame] | 71 | void ecm_db_connection_regenerate_by_assignment_type(ecm_classifier_type_t ca_type); |
| 72 | void ecm_db_connection_make_defunct_by_assignment_type(ecm_classifier_type_t ca_type); |
| 73 | |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 74 | ecm_db_direction_t ecm_db_connection_direction_get(struct ecm_db_connection_instance *ci); |
| 75 | |
| 76 | void 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); |
| 77 | |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 78 | void ecm_db_host_address_get(struct ecm_db_host_instance *hi, ip_addr_t addr); |
| 79 | bool ecm_db_host_on_link_get(struct ecm_db_host_instance *hi); |
| 80 | |
| 81 | void ecm_db_mapping_adress_get(struct ecm_db_mapping_instance *mi, ip_addr_t addr); |
| 82 | int ecm_db_mapping_port_get(struct ecm_db_mapping_instance *mi); |
| 83 | |
| 84 | int ecm_db_connection_protocol_get(struct ecm_db_connection_instance *ci); |
| 85 | bool ecm_db_connection_is_routed_get(struct ecm_db_connection_instance *ci); |
| 86 | |
| 87 | void ecm_db_connection_data_totals_update_tracked(struct ecm_db_connection_instance *ci, bool is_from, uint64_t size, uint64_t packets); |
| 88 | void ecm_db_connection_data_totals_update_dropped(struct ecm_db_connection_instance *ci, bool is_from, uint64_t size, uint64_t packets); |
| 89 | |
| 90 | ecm_db_timer_group_t ecm_db_connection_timer_group_get(struct ecm_db_connection_instance *ci); |
| 91 | void ecm_db_timer_group_entry_init(struct ecm_db_timer_group_entry *tge, ecm_db_timer_group_entry_callback_t fn, void *arg); |
| 92 | void ecm_db_timer_group_entry_set(struct ecm_db_timer_group_entry *tge, ecm_db_timer_group_t tg); |
| 93 | bool ecm_db_timer_group_entry_reset(struct ecm_db_timer_group_entry *tge, ecm_db_timer_group_t tg); |
| 94 | bool ecm_db_timer_group_entry_remove(struct ecm_db_timer_group_entry *tge); |
| 95 | bool ecm_db_timer_group_entry_touch(struct ecm_db_timer_group_entry *tge); |
| 96 | |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 97 | int ecm_db_mapping_connections_total_count_get(struct ecm_db_mapping_instance *mi); |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 98 | |
| 99 | struct ecm_db_host_instance *ecm_db_mapping_host_get_and_ref(struct ecm_db_mapping_instance *mi); |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 100 | struct ecm_db_iface_instance *ecm_db_node_iface_get_and_ref(struct ecm_db_node_instance *ni); |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 101 | |
| 102 | struct ecm_db_mapping_instance *ecm_db_connection_mapping_from_get_and_ref(struct ecm_db_connection_instance *ci); |
| 103 | struct ecm_db_mapping_instance *ecm_db_connection_mapping_to_get_and_ref(struct ecm_db_connection_instance *ci); |
| 104 | struct ecm_db_mapping_instance *ecm_db_connection_mapping_nat_from_get_and_ref(struct ecm_db_connection_instance *ci); |
| 105 | struct ecm_db_mapping_instance *ecm_db_connection_mapping_nat_to_get_and_ref(struct ecm_db_connection_instance *ci); |
| 106 | struct ecm_db_node_instance *ecm_db_connection_node_from_get_and_ref(struct ecm_db_connection_instance *ci); |
| 107 | struct ecm_db_node_instance *ecm_db_connection_node_to_get_and_ref(struct ecm_db_connection_instance *ci); |
| 108 | |
| 109 | struct ecm_db_host_instance *ecm_db_host_find_and_ref(ip_addr_t address); |
| 110 | |
| 111 | struct ecm_db_mapping_instance *ecm_db_mapping_find_and_ref(ip_addr_t address, int port); |
| 112 | |
| 113 | struct ecm_db_connection_instance *ecm_db_connection_serial_find_and_ref(uint32_t serial); |
| 114 | struct 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); |
| 115 | |
| 116 | void ecm_db_iface_ethernet_address_get(struct ecm_db_iface_instance *ii, uint8_t *address); |
Gareth Williams | 83125b1 | 2014-05-26 19:58:09 +0100 | [diff] [blame] | 117 | void ecm_db_iface_bridge_address_get(struct ecm_db_iface_instance *ii, uint8_t *address); |
Murat Sezgin | aad635c | 2015-03-06 16:11:41 -0800 | [diff] [blame] | 118 | #ifdef ECM_INTERFACE_PPP_ENABLE |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 119 | void ecm_db_iface_pppoe_session_info_get(struct ecm_db_iface_instance *ii, struct ecm_db_interface_info_pppoe *pppoe_info); |
Murat Sezgin | aad635c | 2015-03-06 16:11:41 -0800 | [diff] [blame] | 120 | #endif |
Murat Sezgin | 37fb395 | 2015-03-10 16:45:13 -0700 | [diff] [blame] | 121 | #ifdef ECM_INTERFACE_VLAN_ENABLE |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 122 | void ecm_db_iface_vlan_info_get(struct ecm_db_iface_instance *ii, struct ecm_db_interface_info_vlan *vlan_info); |
Murat Sezgin | 37fb395 | 2015-03-10 16:45:13 -0700 | [diff] [blame] | 123 | #endif |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 124 | |
Tushar Mathur | 4ab0bf9 | 2014-06-10 20:37:07 +0530 | [diff] [blame] | 125 | struct ecm_db_iface_instance *ecm_db_iface_ifidx_find_and_ref_ethernet(uint8_t *address, int32_t idx); |
Murat Sezgin | 910c966 | 2015-03-11 16:15:06 -0700 | [diff] [blame] | 126 | #ifdef ECM_INTERFACE_BOND_ENABLE |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 127 | struct ecm_db_iface_instance *ecm_db_iface_find_and_ref_lag(uint8_t *address); |
Murat Sezgin | 910c966 | 2015-03-11 16:15:06 -0700 | [diff] [blame] | 128 | #endif |
Murat Sezgin | 37fb395 | 2015-03-10 16:45:13 -0700 | [diff] [blame] | 129 | #ifdef ECM_INTERFACE_VLAN_ENABLE |
Radha krishna Simha Jiguru | f7dc34c | 2014-05-12 18:59:07 +0530 | [diff] [blame] | 130 | struct ecm_db_iface_instance *ecm_db_iface_find_and_ref_vlan(uint8_t *address, uint16_t vlan_tag, uint16_t vlan_tpid); |
Murat Sezgin | 37fb395 | 2015-03-10 16:45:13 -0700 | [diff] [blame] | 131 | #endif |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 132 | struct ecm_db_iface_instance *ecm_db_iface_find_and_ref_bridge(uint8_t *address); |
| 133 | struct ecm_db_iface_instance *ecm_db_iface_find_and_ref_unknown(uint32_t os_specific_ident); |
Murat Sezgin | aad635c | 2015-03-06 16:11:41 -0800 | [diff] [blame] | 134 | #ifdef ECM_INTERFACE_PPP_ENABLE |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 135 | struct ecm_db_iface_instance *ecm_db_iface_find_and_ref_pppoe(uint16_t pppoe_session_id, uint8_t *remote_mac); |
Murat Sezgin | aad635c | 2015-03-06 16:11:41 -0800 | [diff] [blame] | 136 | #endif |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 137 | struct ecm_db_iface_instance *ecm_db_iface_find_and_ref_loopback(uint32_t os_specific_ident); |
Murat Sezgin | 69a2753 | 2015-03-12 14:09:40 -0700 | [diff] [blame] | 138 | #ifdef ECM_INTERFACE_IPSEC_ENABLE |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 139 | struct ecm_db_iface_instance *ecm_db_iface_find_and_ref_ipsec_tunnel(uint32_t os_specific_ident); |
Murat Sezgin | 69a2753 | 2015-03-12 14:09:40 -0700 | [diff] [blame] | 140 | #endif |
Murat Sezgin | bde55f9 | 2015-03-11 16:44:11 -0700 | [diff] [blame] | 141 | #ifdef ECM_INTERFACE_SIT_ENABLE |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 142 | struct ecm_db_iface_instance *ecm_db_iface_find_and_ref_sit(ip_addr_t saddr, ip_addr_t daddr); |
Murat Sezgin | bde55f9 | 2015-03-11 16:44:11 -0700 | [diff] [blame] | 143 | #endif |
Murat Sezgin | c140256 | 2015-03-12 12:32:20 -0700 | [diff] [blame] | 144 | #ifdef ECM_INTERFACE_TUNIPIP6_ENABLE |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 145 | struct ecm_db_iface_instance *ecm_db_iface_find_and_ref_tunipip6(ip_addr_t saddr, ip_addr_t daddr); |
Murat Sezgin | c140256 | 2015-03-12 12:32:20 -0700 | [diff] [blame] | 146 | #endif |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 147 | struct ecm_db_node_instance *ecm_db_node_find_and_ref(uint8_t *address); |
| 148 | |
| 149 | void ecm_db_connection_from_interfaces_reset(struct ecm_db_connection_instance *ci, struct ecm_db_iface_instance *interfaces[], int32_t new_first); |
| 150 | void ecm_db_connection_to_interfaces_reset(struct ecm_db_connection_instance *ci, struct ecm_db_iface_instance *interfaces[], int32_t new_first); |
| 151 | void ecm_db_connection_from_nat_interfaces_reset(struct ecm_db_connection_instance *ci, struct ecm_db_iface_instance *interfaces[], int32_t new_first); |
| 152 | void ecm_db_connection_to_nat_interfaces_reset(struct ecm_db_connection_instance *ci, struct ecm_db_iface_instance *interfaces[], int32_t new_first); |
| 153 | |
| 154 | void ecm_db_connection_from_interfaces_clear(struct ecm_db_connection_instance *ci); |
| 155 | void ecm_db_connection_from_nat_interfaces_clear(struct ecm_db_connection_instance *ci); |
| 156 | void ecm_db_connection_to_interfaces_clear(struct ecm_db_connection_instance *ci); |
| 157 | void ecm_db_connection_to_nat_interfaces_clear(struct ecm_db_connection_instance *ci); |
| 158 | |
| 159 | bool ecm_db_connection_to_interfaces_set_check(struct ecm_db_connection_instance *ci); |
| 160 | bool ecm_db_connection_from_interfaces_set_check(struct ecm_db_connection_instance *ci); |
| 161 | bool ecm_db_connection_to_nat_interfaces_set_check(struct ecm_db_connection_instance *ci); |
| 162 | bool ecm_db_connection_from_nat_interfaces_set_check(struct ecm_db_connection_instance *ci); |
| 163 | |
| 164 | int32_t ecm_db_connection_to_nat_interfaces_get_count(struct ecm_db_connection_instance *ci); |
| 165 | int32_t ecm_db_connection_from_nat_interfaces_get_count(struct ecm_db_connection_instance *ci); |
| 166 | int32_t ecm_db_connection_to_interfaces_get_count(struct ecm_db_connection_instance *ci); |
| 167 | int32_t ecm_db_connection_from_interfaces_get_count(struct ecm_db_connection_instance *ci); |
| 168 | |
| 169 | int32_t ecm_db_connection_from_interfaces_get_and_ref(struct ecm_db_connection_instance *ci, struct ecm_db_iface_instance *interfaces[]); |
| 170 | int32_t ecm_db_connection_to_interfaces_get_and_ref(struct ecm_db_connection_instance *ci, struct ecm_db_iface_instance *interfaces[]); |
| 171 | int32_t ecm_db_connection_from_nat_interfaces_get_and_ref(struct ecm_db_connection_instance *ci, struct ecm_db_iface_instance *interfaces[]); |
| 172 | int32_t ecm_db_connection_to_nat_interfaces_get_and_ref(struct ecm_db_connection_instance *ci, struct ecm_db_iface_instance *interfaces[]); |
| 173 | void ecm_db_connection_interfaces_deref(struct ecm_db_iface_instance *interfaces[], int32_t first); |
| 174 | |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 175 | struct ecm_db_connection_instance *ecm_db_connections_get_and_ref_first(void); |
| 176 | struct ecm_db_connection_instance *ecm_db_connection_get_and_ref_next(struct ecm_db_connection_instance *ci); |
| 177 | |
| 178 | struct ecm_db_mapping_instance *ecm_db_mappings_get_and_ref_first(void); |
| 179 | struct ecm_db_mapping_instance *ecm_db_mapping_get_and_ref_next(struct ecm_db_mapping_instance *mi); |
| 180 | |
| 181 | struct ecm_db_host_instance *ecm_db_hosts_get_and_ref_first(void); |
| 182 | struct ecm_db_host_instance *ecm_db_host_get_and_ref_next(struct ecm_db_host_instance *hi); |
| 183 | |
| 184 | struct ecm_db_node_instance *ecm_db_nodes_get_and_ref_first(void); |
| 185 | struct ecm_db_node_instance *ecm_db_node_get_and_ref_next(struct ecm_db_node_instance *ni); |
| 186 | |
| 187 | struct ecm_db_iface_instance *ecm_db_interfaces_get_and_ref_first(void); |
| 188 | struct ecm_db_iface_instance *ecm_db_interface_get_and_ref_next(struct ecm_db_iface_instance *ii); |
| 189 | |
Gareth Williams | b590389 | 2015-03-20 15:13:07 +0000 | [diff] [blame^] | 190 | #ifdef ECM_DB_XREF_ENABLE |
| 191 | int ecm_db_host_mapping_count_get(struct ecm_db_host_instance *hi); |
| 192 | int ecm_db_iface_node_count_get(struct ecm_db_iface_instance *ii); |
| 193 | |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 194 | struct ecm_db_connection_instance *ecm_db_mapping_connections_from_get_and_ref_first(struct ecm_db_mapping_instance *mi); |
| 195 | struct ecm_db_connection_instance *ecm_db_mapping_connections_to_get_and_ref_first(struct ecm_db_mapping_instance *mi); |
| 196 | struct ecm_db_connection_instance *ecm_db_connection_mapping_from_get_and_ref_next(struct ecm_db_connection_instance *ci); |
| 197 | struct ecm_db_connection_instance *ecm_db_connection_mapping_to_get_and_ref_next(struct ecm_db_connection_instance *ci); |
| 198 | |
| 199 | struct ecm_db_connection_instance *ecm_db_mapping_connections_nat_from_get_and_ref_first(struct ecm_db_mapping_instance *mi); |
| 200 | struct ecm_db_connection_instance *ecm_db_mapping_connections_nat_to_get_and_ref_first(struct ecm_db_mapping_instance *mi); |
| 201 | struct ecm_db_connection_instance *ecm_db_connection_mapping_nat_from_get_and_ref_next(struct ecm_db_connection_instance *ci); |
| 202 | struct ecm_db_connection_instance *ecm_db_connection_mapping_nat_to_get_and_ref_next(struct ecm_db_connection_instance *ci); |
| 203 | |
| 204 | struct ecm_db_connection_instance *ecm_db_iface_connections_from_get_and_ref_first(struct ecm_db_iface_instance *ii); |
| 205 | struct ecm_db_connection_instance *ecm_db_iface_connections_to_get_and_ref_first(struct ecm_db_iface_instance *ii); |
| 206 | struct ecm_db_connection_instance *ecm_db_connection_iface_from_get_and_ref_next(struct ecm_db_connection_instance *ci); |
| 207 | struct ecm_db_connection_instance *ecm_db_connection_iface_to_get_and_ref_next(struct ecm_db_connection_instance *ci); |
| 208 | |
| 209 | struct ecm_db_connection_instance *ecm_db_iface_connections_nat_from_get_and_ref_first(struct ecm_db_iface_instance *ii); |
| 210 | struct ecm_db_connection_instance *ecm_db_iface_connections_nat_to_get_and_ref_first(struct ecm_db_iface_instance *ii); |
| 211 | struct ecm_db_connection_instance *ecm_db_connection_iface_nat_from_get_and_ref_next(struct ecm_db_connection_instance *ci); |
| 212 | struct ecm_db_connection_instance *ecm_db_connection_iface_nat_to_get_and_ref_next(struct ecm_db_connection_instance *ci); |
| 213 | |
| 214 | struct ecm_db_node_instance *ecm_db_iface_nodes_get_and_ref_first(struct ecm_db_iface_instance *ii); |
Gareth Williams | b590389 | 2015-03-20 15:13:07 +0000 | [diff] [blame^] | 215 | #endif |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 216 | |
| 217 | struct ecm_db_node_instance *ecm_db_node_get_and_ref_next(struct ecm_db_node_instance *ni); |
| 218 | struct ecm_db_host_instance *ecm_db_host_get_and_ref_next(struct ecm_db_host_instance *hi); |
| 219 | |
| 220 | struct ecm_classifier_default_instance *ecm_db_connection_classifier_default_get_and_ref(struct ecm_db_connection_instance *ci); |
| 221 | |
| 222 | void ecm_db_connection_classifier_assign(struct ecm_db_connection_instance *ci, struct ecm_classifier_instance *new_ca); |
| 223 | int ecm_db_connection_classifier_assignments_get_and_ref(struct ecm_db_connection_instance *ci, struct ecm_classifier_instance *assignments[]); |
| 224 | void ecm_db_connection_classifier_unassign(struct ecm_db_connection_instance *ci, struct ecm_classifier_instance *cci); |
| 225 | void ecm_db_connection_assignments_release(int assignment_count, struct ecm_classifier_instance *assignments[]); |
| 226 | struct ecm_classifier_instance *ecm_db_connection_assigned_classifier_find_and_ref(struct ecm_db_connection_instance *ci, ecm_classifier_type_t type); |
| 227 | |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 228 | struct ecm_db_connection_instance *ecm_db_connection_by_classifier_type_assignment_get_and_ref_first(ecm_classifier_type_t ca_type); |
| 229 | struct 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); |
| 230 | void ecm_db_connection_by_classifier_type_assignment_deref(struct ecm_db_connection_instance *ci, ecm_classifier_type_t ca_type); |
| 231 | |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 232 | struct ecm_db_listener_instance *ecm_db_listener_alloc(void); |
| 233 | struct ecm_db_connection_instance *ecm_db_connection_alloc(void); |
| 234 | struct ecm_db_host_instance *ecm_db_host_alloc(void); |
| 235 | struct ecm_db_mapping_instance *ecm_db_mapping_alloc(void); |
| 236 | struct ecm_db_node_instance *ecm_db_node_alloc(void); |
| 237 | struct ecm_db_iface_instance *ecm_db_iface_alloc(void); |
| 238 | |
| 239 | char *ecm_db_interface_type_to_string(ecm_db_iface_type_t type); |
| 240 | |
| 241 | void 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); |
| 242 | |
| 243 | void 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 nss_interface_identifier, ecm_db_iface_final_callback_t final, void *arg); |
Murat Sezgin | 910c966 | 2015-03-11 16:15:06 -0700 | [diff] [blame] | 244 | #ifdef ECM_INTERFACE_BOND_ENABLE |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 245 | void 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 nss_interface_identifier, ecm_db_iface_final_callback_t final, void *arg); |
Murat Sezgin | 910c966 | 2015-03-11 16:15:06 -0700 | [diff] [blame] | 246 | #endif |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 247 | void 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 nss_interface_identifier, ecm_db_iface_final_callback_t final, void *arg); |
Murat Sezgin | 37fb395 | 2015-03-10 16:45:13 -0700 | [diff] [blame] | 248 | #ifdef ECM_INTERFACE_VLAN_ENABLE |
Radha krishna Simha Jiguru | f7dc34c | 2014-05-12 18:59:07 +0530 | [diff] [blame] | 249 | void 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 nss_interface_identifier, ecm_db_iface_final_callback_t final, void *arg); |
Murat Sezgin | 37fb395 | 2015-03-10 16:45:13 -0700 | [diff] [blame] | 250 | #endif |
Murat Sezgin | aad635c | 2015-03-06 16:11:41 -0800 | [diff] [blame] | 251 | #ifdef ECM_INTERFACE_PPP_ENABLE |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 252 | void 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 nss_interface_identifier, ecm_db_iface_final_callback_t final, void *arg); |
Murat Sezgin | aad635c | 2015-03-06 16:11:41 -0800 | [diff] [blame] | 253 | #endif |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 254 | void 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 nss_interface_identifier, ecm_db_iface_final_callback_t final, void *arg); |
| 255 | void 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 nss_interface_identifier, ecm_db_iface_final_callback_t final, void *arg); |
Murat Sezgin | 69a2753 | 2015-03-12 14:09:40 -0700 | [diff] [blame] | 256 | #ifdef ECM_INTERFACE_IPSEC_ENABLE |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 257 | void 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 nss_interface_identifier, ecm_db_iface_final_callback_t final, void *arg); |
Murat Sezgin | 69a2753 | 2015-03-12 14:09:40 -0700 | [diff] [blame] | 258 | #endif |
Murat Sezgin | bde55f9 | 2015-03-11 16:44:11 -0700 | [diff] [blame] | 259 | #ifdef ECM_INTERFACE_SIT_ENABLE |
Zhu Ken | 56477be | 2014-08-05 17:50:28 +0800 | [diff] [blame] | 260 | bool ecm_db_iface_sit_daddr_is_null(struct ecm_db_iface_instance *ii); |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 261 | void 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 nss_interface_identifier, ecm_db_iface_final_callback_t final, void *arg); |
Murat Sezgin | bde55f9 | 2015-03-11 16:44:11 -0700 | [diff] [blame] | 262 | #endif |
Murat Sezgin | c140256 | 2015-03-12 12:32:20 -0700 | [diff] [blame] | 263 | #ifdef ECM_INTERFACE_TUNIPIP6_ENABLE |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 264 | void 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 nss_interface_identifier, ecm_db_iface_final_callback_t final, void *arg); |
Murat Sezgin | c140256 | 2015-03-12 12:32:20 -0700 | [diff] [blame] | 265 | #endif |
Ben Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 266 | void 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 Williams | 90f2a28 | 2014-08-27 15:56:25 +0100 | [diff] [blame] | 267 | void 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 Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 268 | void 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 Williams | dd6dfce | 2014-10-14 15:51:31 +0100 | [diff] [blame] | 269 | void 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 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 Menchaca | 84f3663 | 2014-02-28 20:57:38 +0000 | [diff] [blame] | 270 | |
| 271 | void ecm_db_listener_ref(struct ecm_db_listener_instance *li); |
| 272 | void ecm_db_connection_ref(struct ecm_db_connection_instance *ci); |
| 273 | void ecm_db_host_ref(struct ecm_db_host_instance *hi); |
| 274 | void ecm_db_mapping_ref(struct ecm_db_mapping_instance *mi); |
| 275 | void ecm_db_iface_ref(struct ecm_db_iface_instance *ii); |
| 276 | void ecm_db_node_ref(struct ecm_db_node_instance *ni); |
| 277 | |
| 278 | int ecm_db_listener_deref(struct ecm_db_listener_instance *li); |
| 279 | int ecm_db_connection_deref(struct ecm_db_connection_instance *ci); |
| 280 | int ecm_db_host_deref(struct ecm_db_host_instance *hi); |
| 281 | int ecm_db_mapping_deref(struct ecm_db_mapping_instance *mi); |
| 282 | int ecm_db_iface_deref(struct ecm_db_iface_instance *ii); |
| 283 | int ecm_db_node_deref(struct ecm_db_node_instance *ni); |
| 284 | |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 285 | int ecm_db_connection_count_by_protocol_get(int protocol); |
| 286 | |
| 287 | #ifdef ECM_STATE_OUTPUT_ENABLE |
| 288 | int ecm_db_connection_xml_state_get(struct ecm_db_connection_instance *ci, char *buf, int buf_sz); |
| 289 | int ecm_db_mapping_xml_state_get(struct ecm_db_mapping_instance *mi, char *buf, int buf_sz); |
| 290 | int ecm_db_host_xml_state_get(struct ecm_db_host_instance *hi, char *buf, int buf_sz); |
| 291 | int ecm_db_node_xml_state_get(struct ecm_db_node_instance *ni, char *buf, int buf_sz); |
| 292 | int ecm_db_iface_xml_state_get(struct ecm_db_iface_instance *ii, char *buf, int buf_sz); |
| 293 | int ecm_db_connection_hash_table_lengths_get(int index); |
| 294 | int ecm_db_connection_hash_index_get_next(int index); |
| 295 | int ecm_db_connection_hash_index_get_first(void); |
| 296 | int ecm_db_mapping_hash_table_lengths_get(int index); |
| 297 | int ecm_db_mapping_hash_index_get_next(int index); |
| 298 | int ecm_db_mapping_hash_index_get_first(void); |
| 299 | int ecm_db_host_hash_table_lengths_get(int index); |
| 300 | int ecm_db_host_hash_index_get_next(int index); |
| 301 | int ecm_db_host_hash_index_get_first(void); |
| 302 | int ecm_db_node_hash_table_lengths_get(int index); |
| 303 | int ecm_db_node_hash_index_get_next(int index); |
| 304 | int ecm_db_node_hash_index_get_first(void); |
| 305 | int ecm_db_iface_hash_table_lengths_get(int index); |
| 306 | int ecm_db_iface_hash_index_get_next(int index); |
| 307 | int ecm_db_iface_hash_index_get_first(void); |
| 308 | int ecm_db_protocol_get_next(int protocol); |
| 309 | int ecm_db_protocol_get_first(void); |
| 310 | #endif |
| 311 | |