[Feature][API-1578][DATA]Added DATA packet filtering between the AP and the MODEM

    Only Configure: Yes
    Affected branch: MR3.0-Merge-v2.0-GSW
    Affected module: Data
    Is it affected on both ZXIC and MTK: only MTK
    Self-test: Yes
    Doc Update: No

Change-Id: Ie16d9fef020e1f8b58e6e14900a53c35aed87974
diff --git a/common_src/lib/liblynq-data/lynq_data.cpp b/common_src/lib/liblynq-data/lynq_data.cpp
index d04533a..2a14545 100755
--- a/common_src/lib/liblynq-data/lynq_data.cpp
+++ b/common_src/lib/liblynq-data/lynq_data.cpp
@@ -2183,4 +2183,199 @@
 
     RLOGD("decode_data_log: %s", str);
 }
-//xy.he@20240524 modify for T8TSK-338 end
\ No newline at end of file
+//xy.he@20240524 modify for T8TSK-338 end
+
+
+int lynq_set_ip_filter(int cid)
+{
+    Parcel *p =NULL;
+    lynq_client_t client;
+    int resp_type = -1;
+    int token;
+    int request = -1;
+    int slot_id = -1;
+    int error = -1;
+    int version =0;
+    int num = 0;
+
+    client.uToken = get_utoken();
+    client.request = LYNQ_SET_IP_TUPLE_FILTER;//RIL_REQUEST_SET_IP_TUPLE_FILTER 2195
+    client.paramLen = 1;
+    bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
+    sprintf(client.param,"%d",(cid / 100));
+    LYINFLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
+    pthread_mutex_lock(&g_lynq_data_sendto_mutex);
+    if(send_request(lynq_client_sockfd,&client)==-1)
+    {
+        LYERRLOG("send request fail");
+        perror("[LYNQ_DATA] send request fail:");
+        pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+        return -1;
+    }
+    //get_response(lynq_client_sockfd,p);
+    error = wait_response(lynq_client_sockfd,p,client.uToken);
+    if(error!=0)
+    {
+        LYERRLOG("wait_response fail,ret:%d",error);
+        pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+        return error;
+    }
+    pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+    if(JumpHeader(p,&resp_type,&client.uToken,&request,&slot_id,&error)!=0)
+    {
+        LYERRLOG("JumpHeader fail");
+        return -1;
+    }
+    LYINFLOG("resp_type=%d,uToken=%d,request=%d,slot_id=%d,error_code=%d",resp_type,client.uToken,request,slot_id,error);
+    free_parcel(p);
+    return error;
+}
+
+int lynq_set_ip_filter_mode(int cid,int operation)
+{
+    Parcel *p =NULL;
+    lynq_client_t client;
+    int resp_type = -1;
+    int token;
+    int request = -1;
+    int slot_id = -1;
+    int error = -1;
+    int version =0;
+    int num = 0;
+
+    client.uToken = get_utoken();
+    client.request = LYNQ_SET_IP_TUPLE_FILTER_MODE;//RIL_REQUEST_SET_IP_TUPLE_FILTER_MODE 2196
+    client.paramLen = 2;
+    bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
+    sprintf(client.param,"%d %d",(cid / 100),operation);
+    
+    LYINFLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
+    pthread_mutex_lock(&g_lynq_data_sendto_mutex);
+    if(send_request(lynq_client_sockfd,&client)==-1)
+    {
+        LYERRLOG("send request fail");
+        perror("[LYNQ_DATA] send request fail:");
+        pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+        return -1;
+    }
+    //get_response(lynq_client_sockfd,p);
+    error = wait_response(lynq_client_sockfd,p,client.uToken);
+    if(error!=0)
+    {
+        LYERRLOG("wait_response fail,ret:%d",error);
+        pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+        return error;
+    }
+    pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+    if(JumpHeader(p,&resp_type,&client.uToken,&request,&slot_id,&error)!=0)
+    {
+        LYERRLOG("JumpHeader fail");
+        return -1;
+    }
+    LYINFLOG("resp_type=%d,uToken=%d,request=%d,slot_id=%d,error_code=%d",resp_type,client.uToken,request,slot_id,error);
+    free_parcel(p);
+    return error;
+
+
+}
+
+int lynq_get_ip_filter(int cid,int *filter_count, int *filter_mode)
+{
+    Parcel *p =NULL;
+    lynq_client_t client;
+    int resp_type = -1;
+    int token;
+    int request = -1;
+    int slot_id = -1;
+    int error = -1;
+    int version =0;
+    int num = 0;
+
+    client.uToken = get_utoken();
+    client.request = LYNQ_GET_IP_TUPLE_FILTER;//RIL_REQUEST_GET_IP_TUPLE_FILTER 2197
+    client.paramLen = 1;
+    bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
+    sprintf(client.param,"%d",(cid / 100));
+    
+    LYINFLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
+    pthread_mutex_lock(&g_lynq_data_sendto_mutex);
+    if(send_request(lynq_client_sockfd,&client)==-1)
+    {
+        LYERRLOG("send request fail");
+        perror("[LYNQ_DATA] send request fail:");
+        pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+        return -1;
+    }
+    //get_response(lynq_client_sockfd,p);
+    error = wait_response(lynq_client_sockfd,p,client.uToken);
+    if(error!=0)
+    {
+        LYERRLOG("wait_response fail,ret:%d",error);
+        pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+        return error;
+    }
+    pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+    if(JumpHeader(p,&resp_type,&client.uToken,&request,&slot_id,&error)!=0)
+    {
+        LYERRLOG("JumpHeader fail");
+        return -1;
+    }
+    LYINFLOG("resp_type=%d,uToken=%d,request=%d,slot_id=%d,error_code=%d",resp_type,client.uToken,request,slot_id,error);
+    if(error == 0)
+    {
+        p->readInt32(filter_count);
+        p->readInt32(filter_mode);
+    }
+    free_parcel(p);
+    return error;
+
+
+}
+
+int lynq_del_ip_filter(int cid)
+{
+    Parcel *p =NULL;
+    lynq_client_t client;
+    int resp_type = -1;
+    int token;
+    int request = -1;
+    int slot_id = -1;
+    int error = -1;
+    int version =0;
+    int num = 0;
+
+    client.uToken = get_utoken();
+    client.request = LYNQ_DEL_IP_TUPLE_FILTER;//RIL_REQUEST_DEL_IP_TUPLE_FILTER 2198
+    client.paramLen = 1;
+    bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
+    sprintf(client.param,"%d",(cid / 100));
+    
+    LYINFLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
+    pthread_mutex_lock(&g_lynq_data_sendto_mutex);
+    if(send_request(lynq_client_sockfd,&client)==-1)
+    {
+        LYERRLOG("send request fail");
+        perror("[LYNQ_DATA] send request fail:");
+        pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+        return -1;
+    }
+    //get_response(lynq_client_sockfd,p);
+    error = wait_response(lynq_client_sockfd,p,client.uToken);
+    if(error!=0)
+    {
+        LYERRLOG("wait_response fail,ret:%d",error);
+        pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+        return error;
+    }
+    pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+    if(JumpHeader(p,&resp_type,&client.uToken,&request,&slot_id,&error)!=0)
+    {
+        LYERRLOG("JumpHeader fail");
+        return -1;
+    }
+    LYINFLOG("resp_type=%d,uToken=%d,request=%d,slot_id=%d,error_code=%d",resp_type,client.uToken,request,slot_id,error);
+    free_parcel(p);
+    return error;
+
+
+}
\ No newline at end of file