summaryrefslogtreecommitdiff
path: root/package/ramips/applications/hwnat/src/ac_api.c
diff options
context:
space:
mode:
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;
+}