| /***************************************************************************** |
| * Copyright Statement: |
| * -------------------- |
| * This software is protected by Copyright and the information contained |
| * herein is confidential. The software may not be copied and the information |
| * contained herein may not be used or disclosed except with the written |
| * permission of MediaTek Inc. (C) 2015 |
| * |
| * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| * |
| * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| * |
| * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| * |
| *****************************************************************************/ |
| |
| /******************************************************************************* |
| * Filename: |
| * --------- |
| * dpfm_api.h |
| * |
| * Project: |
| * -------- |
| * UMOLY |
| * |
| * Description: |
| * ------------ |
| * |
| * |
| * Author: |
| * ------- |
| * ------- |
| * |
| *============================================================================== |
| * HISTORY |
| * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| *------------------------------------------------------------------------------ |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * |
| *------------------------------------------------------------------------------ |
| * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| *============================================================================== |
| *******************************************************************************/ |
| #ifndef __DPFM_API_H |
| #define __DPFM_API_H |
| |
| #include "hif_ior.h" |
| #include "hif_mw_msgid.h" |
| #include "ipc_api.h" |
| #include "ipc_defs_public.h" |
| #include "ipc_enums.h" |
| |
| #include "dpfm_enums.h" |
| #include "dpfm_struct.h" |
| |
| /*------------------------------------------------------------------------------ |
| * Constant definition. |
| *----------------------------------------------------------------------------*/ |
| #define DPFM_VERSION 2 |
| #define DPFM_MAX_CT_TABLE_NUM 64 |
| |
| #define DPFM_PKT_TYPE_FILTER_DEL_ACK 0x1 |
| |
| /*------------------------------------------------------------------------------ |
| * Global variables. |
| *----------------------------------------------------------------------------*/ |
| |
| /*------------------------------------------------------------------------------ |
| * Helper Macro. |
| *----------------------------------------------------------------------------*/ |
| #define DPFM_GET_PKT_TYPE_FROM_PSN(_psn) (((_psn) & 0x0F00) >> 8) |
| |
| /*------------------------------------------------------------------------------ |
| * Public fucntions. |
| *----------------------------------------------------------------------------*/ |
| kal_bool dpfm_init(void); |
| kal_bool dpfm_reset(void); |
| void dpfm_on_ilm(ilm_struct *ilm); |
| kal_int32 dpfm_enable(void *info); |
| kal_int32 dpfm_disable(void *info); |
| kal_int32 dpfm_activate(void *info); |
| kal_int32 dpfm_deactivate(void *info); |
| |
| /*! |
| * Update global alert data usage base on the received packet. |
| * |
| * @param packet_len [IN] Length of the packet |
| * @param netif_id [IN] netif_id for the packet. |
| */ |
| void dpfm_update_global_alert_data_usage(kal_uint32 packet_len, kal_uint32 netif_id); |
| |
| /*! |
| * Update iquota data usage base on the received packet. |
| * |
| * @param uplink [IN] Is uplink traffic. false for downlink traffic. |
| * @param in_netif_id [IN] Source netif_id for the packet. |
| * @param out_netif_id [IN] Destination netif_id for the packet. |
| * @param protocol [IN] Protocol of the packet |
| * @param packet_len [IN] Length of the packet |
| */ |
| void dpfm_update_iquota_data_usage(kal_bool uplink, kal_uint32 in_netif_id, kal_uint32 out_netif_id, kal_uint8 protocol, kal_uint32 packet_len); |
| |
| /*! |
| * Check the packet should be sent to which netif. |
| * |
| * @param uplink [IN] Is uplink traffic. false for downlink traffic. |
| * @param ip_type [IN] IP type of the packet. |
| * @param pkt_des [IN] Descriptor of the packet. |
| * @param in_netif_id [IN] Source netif_id for the packet. |
| * @param out_netif_id [OUT] Destination netif_id for the packet. |
| * |
| * @return KAL_TRUE if match DPFM SW filter. KAL_FALSE otherwise. |
| */ |
| kal_bool dpfm_check_route(kal_bool uplink, kal_uint8 ip_type, ipc_pkt_des_t *pkt_des, kal_uint32 in_netif_id, kal_uint32 *out_netif_id); |
| |
| /*! |
| * Check if the packet needed to add filter. |
| * |
| * @param uplink [IN] Is uplink traffic. false for downlink traffic. |
| * @param pkt_des [IN] Descriptor of the packet. |
| * @param in_netif_id [IN] Source netif_id for the packet. |
| */ |
| void dpfm_track_packet(kal_bool uplink, ipc_pkt_des_t *pkt_des, kal_uint32 in_netif_id); |
| |
| /*! |
| * Process SW filter according to HW filter command result. |
| * |
| * @param pkt_des [IN] Descriptor of the packet. |
| */ |
| void dpfm_process_filter_cmd_result(ipc_pkt_des_t *pkt_des); |
| |
| /*! |
| * Register to DPFM LAN device. |
| * |
| * @param lan_dev_id [IN] DPFM LAN device id. |
| * @param dev_info [IN] lan device information. |
| * |
| * @return KAL_TRUE if register successfully. KAL_FALSE otherwise. |
| */ |
| kal_bool dpfm_lan_dev_register(kal_uint8 lan_dev_id, dpfm_lan_dev_info_t *dev_info); |
| |
| /*! |
| * Query DPFM is activated. |
| * |
| * @return KAL_TRUE if DPFM is activated. KAL_FALSE otherwise. |
| */ |
| kal_bool dpfm_is_active(void); |
| |
| /*! |
| * Get DPFM SW filter according to filter id. |
| * |
| * @param filter_id [IN] DPFM SW filter id. |
| * |
| * @return SW filter if found. NULL otherwise. |
| */ |
| dpfm_filter_t* dpfm_find_filter_by_id(kal_int16 filter_id); |
| |
| /*! |
| * Remove DPFM sensitive data. |
| */ |
| void dpfm_module_clean(void); |
| |
| #endif |