From 9b2f586aa30c3802a7663a25cf98eb8f06309d2f Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Tue, 17 May 2016 13:50:43 -0700 Subject: z2_plus: Update IPA connection manager to 1.0 branch Change-Id: I20555a4bd9981f652f71360bdb7d83e822fad883 --- data-ipa-cfg-mgr/ipacm/inc/IPACM_LanToLan.h | 169 ++++++++++++++++------------ 1 file changed, 98 insertions(+), 71 deletions(-) (limited to 'data-ipa-cfg-mgr/ipacm/inc/IPACM_LanToLan.h') diff --git a/data-ipa-cfg-mgr/ipacm/inc/IPACM_LanToLan.h b/data-ipa-cfg-mgr/ipacm/inc/IPACM_LanToLan.h index 06d5832..a28631e 100644 --- a/data-ipa-cfg-mgr/ipacm/inc/IPACM_LanToLan.h +++ b/data-ipa-cfg-mgr/ipacm/inc/IPACM_LanToLan.h @@ -42,7 +42,6 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "IPACM_Iface.h" #include "IPACM_Defs.h" #include "IPACM_Lan.h" -#include #ifdef FEATURE_IPA_ANDROID #include @@ -50,125 +49,153 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #endif /* ndefined(FEATURE_IPA_ANDROID)*/ -struct client_info; +#define MAX_NUM_CACHED_CLIENT_ADD_EVENT 10 +#define MAX_NUM_IFACE 10 +#define MAX_NUM_CLIENT 16 -struct peer_info +struct rt_rule_info { - struct client_info* peer_pointer; - int num_connection; + int num_hdl[IPA_IP_MAX]; /* one client may need more than one routing rules on the same routing table depending on tx_prop */ + uint32_t rule_hdl[IPA_IP_MAX][MAX_NUM_PROP]; }; -//used to store rule handles for offload link (one direction) -struct offload_link_info +struct client_info { - struct client_info* peer_pointer; - uint32_t flt_rule_hdl; - lan_to_lan_rt_rule_hdl rt_rule_hdl; - uint32_t hdr_hdl; + uint8_t mac_addr[6]; + rt_rule_info inter_iface_rt_rule_hdl[IPA_HDR_L2_MAX]; /* routing rule handles of inter interface communication based on source l2 header type */ + rt_rule_info intra_iface_rt_rule_hdl; /* routing rule handles of inter interface communication */ }; -typedef list peer_info_list; -typedef list offload_link_info_list; -typedef list connection_list; - -struct client_info +struct flt_rule_info { - union - { - uint32_t ipv4_addr; - uint32_t ipv6_addr[4]; - } ip; - uint8_t mac_addr[6]; - bool is_active; - bool is_powersave; - IPACM_Lan* p_iface; - peer_info_list peer; - offload_link_info_list link; + client_info *p_client; + uint32_t flt_rule_hdl[IPA_IP_MAX]; }; -struct v6_addr +struct peer_iface_info { - uint32_t ipv6_addr[4]; + class IPACM_LanToLan_Iface *peer; + char rt_tbl_name_for_rt[IPA_IP_MAX][IPA_RESOURCE_NAME_MAX]; + char rt_tbl_name_for_flt[IPA_IP_MAX][IPA_RESOURCE_NAME_MAX]; + list flt_rule; }; -typedef unordered_map client_table_v4; -typedef unordered_map client_table_v6; +class IPACM_LanToLan_Iface +{ +public: + IPACM_LanToLan_Iface(IPACM_Lan *p_iface); + ~IPACM_LanToLan_Iface(); + void add_client_rt_rule_for_new_iface(); -class IPACM_LanToLan : public IPACM_Listener -{ + void add_all_inter_interface_client_flt_rule(ipa_ip_type iptype); -public: + void add_all_intra_interface_client_flt_rule(ipa_ip_type iptype); + + void handle_down_event(); + + void handle_wlan_scc_mcc_switch(); + + void handle_intra_interface_info(); + + void handle_new_iface_up(char rt_tbl_name_for_flt[][IPA_RESOURCE_NAME_MAX], char rt_tbl_name_for_rt[][IPA_RESOURCE_NAME_MAX], + IPACM_LanToLan_Iface *peer_iface); + + void handle_client_add(uint8_t *mac); + + void handle_client_del(uint8_t *mac); - IPACM_LanToLan(); - ~IPACM_LanToLan(); + void print_data_structure_info(); - void handle_new_connection(ipacm_event_connection* new_conn); - void handle_del_connection(ipacm_event_connection* del_conn); + IPACM_Lan* get_iface_pointer(); - static IPACM_LanToLan* getLan2LanInstance(); + bool get_m_is_ip_addr_assigned(ipa_ip_type iptype); + + void set_m_is_ip_addr_assigned(ipa_ip_type iptype, bool value); + + bool get_m_support_inter_iface_offload(); + + bool get_m_support_intra_iface_offload(); + + void increment_ref_cnt_peer_l2_hdr_type(ipa_hdr_l2_type peer_l2_type); + + void decrement_ref_cnt_peer_l2_hdr_type(ipa_hdr_l2_type peer_l2_type); private: - uint8_t num_offload_pair_v4_; - uint8_t num_offload_pair_v6_; - client_table_v4 client_info_v4_; - client_table_v6 client_info_v6_; + IPACM_Lan *m_p_iface; + bool m_is_ip_addr_assigned[IPA_IP_MAX]; + bool m_support_inter_iface_offload; + bool m_support_intra_iface_offload; + + int ref_cnt_peer_l2_hdr_type[IPA_HDR_L2_MAX]; /* reference count of l2 header type of peer interfaces */ + uint32_t hdr_proc_ctx_for_inter_interface[IPA_HDR_L2_MAX]; + uint32_t hdr_proc_ctx_for_intra_interface; - connection_list connection_v4_; - connection_list connection_v6_; + list m_client_info; /* client list */ + list m_peer_iface_info; /* peer information list */ - static IPACM_LanToLan* p_instance; + /* The following members are for intra-interface communication*/ + peer_iface_info m_intra_interface_info; - void event_callback(ipa_cm_event_id event, void* param); + void add_one_client_flt_rule(IPACM_LanToLan_Iface *peer_iface, client_info *client); - void handle_client_active(ipacm_event_lan_client* data); + void add_client_flt_rule(peer_iface_info *peer, client_info *client, ipa_ip_type iptype); - void check_potential_link(ipa_ip_type iptype, client_info* client); + void del_one_client_flt_rule(IPACM_LanToLan_Iface *peer_iface, client_info *client); - int add_offload_link(ipa_ip_type iptype, client_info* client, client_info* peer); + void del_client_flt_rule(peer_iface_info *peer, client_info *client); - void handle_client_inactive(ipacm_event_lan_client* data); + void add_client_rt_rule(peer_iface_info *peer, client_info *client); - int turnoff_offload_links(ipa_ip_type iptype, client_info* client); + void del_client_rt_rule(peer_iface_info *peer, client_info *client); - int del_offload_link(ipa_ip_type iptype, IPACM_Lan* client, IPACM_Lan* peer, offload_link_info* link); + void clear_all_flt_rule_for_one_peer_iface(peer_iface_info *peer); - void handle_client_disconnect(ipacm_event_lan_client* data); + void clear_all_rt_rule_for_one_peer_iface(peer_iface_info *peer); - int clear_peer_list(client_info* client); + void add_hdr_proc_ctx(ipa_hdr_l2_type peer_l2_type); - void handle_client_power_save(ipacm_event_lan_client* data); + void del_hdr_proc_ctx(ipa_hdr_l2_type peer_l2_type); - void handle_client_power_recover(ipacm_event_lan_client* data); + void print_peer_info(peer_iface_info *peer_info); + +}; - int remove_flt_rules(ipa_ip_type iptype, client_info* client); +class IPACM_LanToLan : public IPACM_Listener +{ + +public: + + IPACM_LanToLan(); + +private: - int add_flt_rules(ipa_ip_type iptype, client_info* client); + ~IPACM_LanToLan(); -//the following are for connections + list m_iface; - void handle_new_lan2lan_connection(ipacm_event_connection* data); + list m_cached_client_add_event; - bool add_connection(client_info* src_client, client_info* dst_client); + void handle_iface_up(ipacm_event_eth_bridge *data); - void handle_del_lan2lan_connection(ipacm_event_connection* data); + void handle_iface_down(ipacm_event_eth_bridge *data); - bool remove_connection(client_info* src_client, client_info* dst_client); + void handle_client_add(ipacm_event_eth_bridge *data); - void erase_offload_link(ipa_ip_type iptype, client_info* src_client, client_info* dst_client); + void handle_client_del(ipacm_event_eth_bridge *data); - void generate_new_connection(ipa_ip_type iptype, client_info* client); + void handle_wlan_scc_mcc_switch(ipacm_event_eth_bridge *data); - bool is_lan2lan_connection(ipacm_event_connection* data); + void handle_new_iface_up(IPACM_LanToLan_Iface *new_iface, IPACM_LanToLan_Iface *exist_iface); - bool is_potential_lan2lan_connection(ipacm_event_connection* new_conn); + void event_callback(ipa_cm_event_id event, void* param); - void cache_new_connection(ipacm_event_connection* new_conn); + void handle_cached_client_add_event(IPACM_Lan *p_iface); - void remove_cache_connection(ipacm_event_connection* del_conn); + void clear_cached_client_add_event(IPACM_Lan *p_iface); - void check_cache_connection(ipa_ip_type iptype, client_info* client); + void print_data_structure_info(); }; -- cgit v1.2.3