aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2015-01-16 01:10:44 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-01-16 01:10:44 +0000
commiteda1ec9459e2026f7ceea86fc2422d12280401c8 (patch)
treee53cfe5e5da236e547622f0277510be0ca036f9c
parent9dab0cd7430a4d23e0a7752fb13b941692171c3d (diff)
parent3fbb396ce68e28df8a33f06adf014f804b608576 (diff)
downloadlibpcap-eda1ec9459e2026f7ceea86fc2422d12280401c8.tar.gz
Merge "Expose nflog_send_config_cmd() for netd."
-rw-r--r--Android.mk4
-rw-r--r--pcap-netfilter-linux-android.c25
-rw-r--r--pcap-netfilter-linux-android.h25
3 files changed, 53 insertions, 1 deletions
diff --git a/Android.mk b/Android.mk
index 2d82baff..16fafe4f 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,7 +1,7 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
-libpcap_PSRC = pcap-linux.c pcap-usb-linux.c pcap-can-linux.c pcap-netfilter-linux.c
+libpcap_PSRC = pcap-linux.c pcap-usb-linux.c pcap-can-linux.c pcap-netfilter-linux.c pcap-netfilter-linux-android.c
libpcap_FSRC = fad-gifc.c
libpcap_CSRC = pcap.c inet.c gencode.c optimize.c nametoaddr.c etherent.c \
savefile.c sf-pcap.c sf-pcap-ng.c pcap-common.c \
@@ -17,6 +17,8 @@ LOCAL_SRC_FILES:=\
LOCAL_CFLAGS:=-O2 -g
LOCAL_CFLAGS+=-DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -Dlinux -D__GLIBC__ -D_GNU_SOURCE
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+
LOCAL_MODULE:= libpcap
include $(BUILD_STATIC_LIBRARY)
diff --git a/pcap-netfilter-linux-android.c b/pcap-netfilter-linux-android.c
new file mode 100644
index 00000000..a6a8763b
--- /dev/null
+++ b/pcap-netfilter-linux-android.c
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "pcap-netfilter-linux.c"
+
+int
+android_nflog_send_config_cmd(int fd, u_int16_t group_id, u_int8_t cmd, u_int8_t family)
+{
+ pcap_t handle;
+ handle.fd = fd;
+ return nflog_send_config_cmd(&handle, group_id, cmd, family);
+}
diff --git a/pcap-netfilter-linux-android.h b/pcap-netfilter-linux-android.h
new file mode 100644
index 00000000..89dd808b
--- /dev/null
+++ b/pcap-netfilter-linux-android.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int android_nflog_send_config_cmd(int fd, u_int16_t group_id, u_int8_t cmd, u_int8_t family);
+
+#ifdef __cplusplus
+}
+#endif