[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/framework/lynq-ril-service/src/commands.h b/common_src/framework/lynq-ril-service/src/commands.h
index 115e16d..8a5f736 100755
--- a/common_src/framework/lynq-ril-service/src/commands.h
+++ b/common_src/framework/lynq-ril-service/src/commands.h
@@ -57,6 +57,11 @@
     {"RIL_REQUEST_SYNC_DATA_SETTINGS_TO_MD",syncDataSettingsToMd, "sync data settings to modem", RIL_REQUEST_SYNC_DATA_SETTINGS_TO_MD},
     {"RIL_REQUEST_MODIFY_APN",modifyApnRecord, "modify apn db", RIL_REQUEST_MODIFY_APN},
     {"RIL_REQUEST_RESET_APN",resetApnRecord, "reset apn db", RIL_REQUEST_RESET_APN},
+    {"RIL_REQUEST_SET_IP_TUPLE_FILTER",setIpFilter,"set ip filter", RIL_REQUEST_SET_IP_TUPLE_FILTER},
+    {"RIL_REQUEST_SET_IP_TUPLE_FILTER_MODE",setIpFilterMode,"set ip filter mode",RIL_REQUEST_SET_IP_TUPLE_FILTER_MODE},
+    {"RIL_REQUEST_GET_IP_TUPLE_FILTER",getIpFilter,"get ip filter",RIL_REQUEST_GET_IP_TUPLE_FILTER},
+    {"RIL_REQUEST_DEL_IP_TUPLE_FILTER",delIpFilter,"delete ip filter",RIL_REQUEST_DEL_IP_TUPLE_FILTER},
+    
 //CC
     {"RIL_REQUEST_DIAL",dial,"dial",RIL_REQUEST_DIAL},
     {"RIL_REQUEST_HANGUP",hangupConnection,"hangup",RIL_REQUEST_HANGUP},
diff --git a/common_src/framework/lynq-ril-service/src/data/data.cpp b/common_src/framework/lynq-ril-service/src/data/data.cpp
index 678568d..23103a1 100755
--- a/common_src/framework/lynq-ril-service/src/data/data.cpp
+++ b/common_src/framework/lynq-ril-service/src/data/data.cpp
@@ -1698,3 +1698,77 @@
     resetApnDB();
     return 0;
 }
+
+int setIpFilter(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI)
+{
+    RLOGD("%s,argc = %d,argv = %d", __FUNCTION__,argc,atoi(argv[1]));
+    if (argc < 2){
+        RLOGD("%s parameters  number isn't enough", __FUNCTION__);
+        return -1;
+    }
+    int cid = atoi(argv[1]);
+    android::Parcel p;
+    size_t pos = p.dataPosition();
+    p.writeInt32(1);
+    p.writeInt32(cid);
+    p.setDataPosition(pos);
+    pRI->pCI->dispatchFunction(p, pRI);
+    RLOGD("dispatchFunction done");
+    return 0;
+}
+
+int setIpFilterMode(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI)
+{
+    RLOGD("%s,argc = %d,argv = %d", __FUNCTION__,argc,atoi(argv[1]));
+    if (argc < 3){
+        RLOGD("%s parameters  number isn't enough", __FUNCTION__);
+        return -1;
+    }
+    int cid = atoi(argv[1]);
+    int operation = atoi(argv[2]);
+    android::Parcel p;
+    size_t pos = p.dataPosition();
+    p.writeInt32(2);
+    p.writeInt32(cid);
+    p.writeInt32(operation);
+    p.setDataPosition(pos);
+    pRI->pCI->dispatchFunction(p, pRI);
+    RLOGD("dispatchFunction done");
+    return 0;
+}
+
+int getIpFilter(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI)
+{
+    if (argc < 2){
+        RLOGD("%s parameters  number isn't enough", __FUNCTION__);
+        return -1;
+    }
+    RLOGD("%s,argc = %d,argv = %d", __FUNCTION__,argc,atoi(argv[1]));
+    int cid = atoi(argv[1]);
+    android::Parcel p;
+    size_t pos = p.dataPosition();
+    p.writeInt32(1);
+    p.writeInt32(cid);
+    p.setDataPosition(pos);
+    pRI->pCI->dispatchFunction(p, pRI);
+    RLOGD("dispatchFunction done");
+    return 0;
+}
+
+int delIpFilter(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI)
+{
+    if (argc < 2){
+        RLOGD("%s parameters  number isn't enough", __FUNCTION__);
+        return -1;
+    }
+    RLOGD("%s,argc = %d,argv = %d", __FUNCTION__,argc,atoi(argv[1]));
+    int cid = atoi(argv[1]);
+    android::Parcel p;
+    size_t pos = p.dataPosition();
+    p.writeInt32(1);
+    p.writeInt32(cid);
+    p.setDataPosition(pos);
+    pRI->pCI->dispatchFunction(p, pRI);
+    RLOGD("dispatchFunction done");
+    return 0;
+}
diff --git a/common_src/framework/lynq-ril-service/src/data/data.h b/common_src/framework/lynq-ril-service/src/data/data.h
index 657f8be..e526661 100755
--- a/common_src/framework/lynq-ril-service/src/data/data.h
+++ b/common_src/framework/lynq-ril-service/src/data/data.h
@@ -56,4 +56,12 @@
 int syncDataSettings(RIL_SOCKET_ID socket_id);
 int modifyApnRecord(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI);
 int resetApnRecord(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI);
+int setIpFilter(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI);
+int setIpFilterMode(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI);
+int getIpFilter(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI);
+int delIpFilter(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI);
+
+
+
+
 #endif
diff --git a/common_src/framework/lynq-ril-service/src/mtk_ril_commands.h b/common_src/framework/lynq-ril-service/src/mtk_ril_commands.h
index 4b10fce..50cb474 100755
--- a/common_src/framework/lynq-ril-service/src/mtk_ril_commands.h
+++ b/common_src/framework/lynq-ril-service/src/mtk_ril_commands.h
@@ -97,3 +97,7 @@
 {RIL_REQUEST_GSM_SET_BROADCAST_LANGUAGE, dispatchString, responseVoid },
 {RIL_REQUEST_QUERY_SIM_RETRY_COUNT, dispatchVoid, responseInts },
 {RIL_REQUEST_QUERY_EID, dispatchVoid, responseString },
+{RIL_REQUEST_SET_IP_TUPLE_FILTER, dispatchInts, responseVoid},
+{RIL_REQUEST_SET_IP_TUPLE_FILTER_MODE, dispatchInts, responseVoid},
+{RIL_REQUEST_GET_IP_TUPLE_FILTER, dispatchInts, responseVoid},
+{RIL_REQUEST_DEL_IP_TUPLE_FILTER, dispatchInts, responseVoid},
\ No newline at end of file
diff --git a/common_src/framework/lynq-ril-service/src/ril.cpp b/common_src/framework/lynq-ril-service/src/ril.cpp
index 9ae636a..9b5fcc7 100755
--- a/common_src/framework/lynq-ril-service/src/ril.cpp
+++ b/common_src/framework/lynq-ril-service/src/ril.cpp
@@ -4441,6 +4441,17 @@
                     lynq_send_result_already();
                     break;
                 }
+                case RIL_REQUEST_GET_IP_TUPLE_FILTER:
+                {
+                    int numInts = responselen / sizeof(int);
+                    if(numInts > 0) {
+                       int *p_int = (int *) response;
+                       p.writeInt32(p_int[0]);
+                       p.writeInt32(p_int[1]);
+                   } else {
+                       RLOGD("RIL_REQUEST_GET_IP_TUPLE_FILTER response numInts: %d", numInts);
+                   }
+                }
                default:
                    break;
                }
@@ -5308,6 +5319,10 @@
         case LYNQ_REQUEST_GET_RTP_PARAM:return "LYNQ_REQUEST_GET_RTP_PARAM";
         case LYNQ_REQUEST_SET_CALL_RTP_SSRC:return "LYNQ_REQUEST_SET_CALL_RTP_SSRC";
         case LYNQ_REQUEST_GET_CALL_RTP_SSRC:return "LYNQ_REQUEST_GET_CALL_RTP_SSRC";
+        case RIL_REQUEST_SET_IP_TUPLE_FILTER:return "RIL_REQUEST_SET_IP_TUPLE_FILTER";
+        case RIL_REQUEST_SET_IP_TUPLE_FILTER_MODE:return "RIL_REQUEST_SET_IP_TUPLE_FILTER_MODE";
+        case RIL_REQUEST_GET_IP_TUPLE_FILTER:return "RIL_REQUEST_GET_IP_TUPLE_FILTER";
+        case RIL_REQUEST_DEL_IP_TUPLE_FILTER:return "RIL_REQUEST_DEL_IP_TUPLE_FILTER";
         /*warren add for t800 ril service 2022/1/22 end*/
         default: return "<unknown request>";
     }
@@ -5590,6 +5605,10 @@
         case LYNQ_REQUEST_GET_RTP_PARAM:return "LYNQ_REQUEST_GET_RTP_PARAM";
         case LYNQ_REQUEST_SET_CALL_RTP_SSRC:return "LYNQ_REQUEST_SET_CALL_RTP_SSRC";
         case LYNQ_REQUEST_GET_CALL_RTP_SSRC:return "LYNQ_REQUEST_GET_CALL_RTP_SSRC";
+        case RIL_REQUEST_SET_IP_TUPLE_FILTER:return "RIL_REQUEST_SET_IP_TUPLE_FILTER";
+        case RIL_REQUEST_SET_IP_TUPLE_FILTER_MODE:return "RIL_REQUEST_SET_IP_TUPLE_FILTER_MODE";
+        case RIL_REQUEST_GET_IP_TUPLE_FILTER:return "RIL_REQUEST_GET_IP_TUPLE_FILTER";
+        case RIL_REQUEST_DEL_IP_TUPLE_FILTER:return "RIL_REQUEST_DEL_IP_TUPLE_FILTER";
         /*warren add for t800 ril service 2022/1/22 end*/
         default: return "<unknown request>";
     }
diff --git a/common_src/framework/lynq-ril-service/src/ril_commands.h b/common_src/framework/lynq-ril-service/src/ril_commands.h
index d90c8ba..3d381f3 100755
--- a/common_src/framework/lynq-ril-service/src/ril_commands.h
+++ b/common_src/framework/lynq-ril-service/src/ril_commands.h
@@ -154,3 +154,7 @@
     {RIL_REQUEST_STOP_LCE, dispatchVoid, responseLceStatus},
     {RIL_REQUEST_PULL_LCEDATA, dispatchVoid, responseLceData},
     {RIL_REQUEST_GET_ACTIVITY_INFO, dispatchVoid, responseActivityData},
+    {RIL_REQUEST_SET_IP_TUPLE_FILTER, dispatchInts, responseInts},
+    {RIL_REQUEST_SET_IP_TUPLE_FILTER_MODE, dispatchInts, responseInts},
+    {RIL_REQUEST_GET_IP_TUPLE_FILTER, dispatchInts, responseInts},
+    {RIL_REQUEST_DEL_IP_TUPLE_FILTER, dispatchInts, responseInts},