summaryrefslogtreecommitdiff
path: root/package/ramips/applications/hwnat/src/ac_api.c
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2018-09-16 20:17:57 +0200
committerLudovic Pouzenc <ludovic@pouzenc.fr>2018-09-16 20:17:57 +0200
commit85bdc5b94c8a1730d3077f361297028cfd8b9b78 (patch)
treea6835c355fde8ce9f36c808dbb9b50809d3c77f4 /package/ramips/applications/hwnat/src/ac_api.c
parent6e0004f572f23810c21d5fb4477d8b9347dffdbb (diff)
downloadmtk-20170518-85bdc5b94c8a1730d3077f361297028cfd8b9b78.zip
mtk-20170518-85bdc5b94c8a1730d3077f361297028cfd8b9b78.tar.gz
mtk-20170518-85bdc5b94c8a1730d3077f361297028cfd8b9b78.tar.bz2
MTK mt76 hwnat implementationHEADmtk-20170518
Diffstat (limited to 'package/ramips/applications/hwnat/src/ac_api.c')
-rwxr-xr-xpackage/ramips/applications/hwnat/src/ac_api.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/package/ramips/applications/hwnat/src/ac_api.c b/package/ramips/applications/hwnat/src/ac_api.c
new file mode 100755
index 0000000..0d1832a
--- /dev/null
+++ b/package/ramips/applications/hwnat/src/ac_api.c
@@ -0,0 +1,52 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include <getopt.h>
+#include "ac_ioctl.h"
+
+int SetAcEntry(struct ac_args *opt, unsigned int cmd)
+{
+ int fd;
+
+ fd = open("/dev/"AC_DEVNAME, O_RDONLY);
+ if (fd < 0)
+ {
+ printf("Open %s pseudo device failed\n","/dev/"AC_DEVNAME);
+ return AC_FAIL;
+ }
+
+ if(ioctl(fd, cmd, opt)<0)
+ {
+ printf("AC_API: ioctl error\n");
+ close(fd);
+ return AC_FAIL;
+ }
+
+ close(fd);
+ return AC_SUCCESS;
+}
+
+
+int GetAcEntry(struct ac_args *opt, unsigned int cmd)
+{
+ int fd;
+
+ fd = open("/dev/"AC_DEVNAME, O_RDONLY);
+ if (fd < 0)
+ {
+ printf("Open %s pseudo device failed\n","/dev/"AC_DEVNAME);
+ return AC_FAIL;
+ }
+
+ if(ioctl(fd, cmd, opt)<0)
+ {
+ printf("AC_API: ioctl error\n");
+ close(fd);
+ return AC_FAIL;
+ }
+
+ close(fd);
+ return AC_SUCCESS;
+}