libxt_standard.c revision d01454062d0265f118c1b721740997cb93ef8cdb
1/* Shared library add-on to iptables for standard target support. */
2#include <stdio.h>
3#include <netdb.h>
4#include <string.h>
5#include <stdlib.h>
6#include <limits.h>
7#include <getopt.h>
8#include <xtables.h>
9
10/* Function which prints out usage message. */
11static void
12help(void)
13{
14	printf(
15"Standard v%s options:\n"
16"(If target is DROP, ACCEPT, RETURN or nothing)\n", IPTABLES_VERSION);
17}
18
19/* Initialize the target. */
20static void
21init(struct xt_entry_target *t, unsigned int *nfcache)
22{
23}
24
25/* Function which parses command options; returns true if it
26   ate an option */
27static int
28parse(int c, char **argv, int invert, unsigned int *flags,
29      const void *entry,
30      struct xt_entry_target **target)
31{
32	return 0;
33}
34
35/* Final check; don't care. */
36static void final_check(unsigned int flags)
37{
38}
39
40/* Saves the targinfo in parsable form to stdout. */
41static void
42save(const void *ip, const struct xt_entry_target *target)
43{
44}
45
46static
47struct xtables_target standard = {
48	.family		= AF_INET,
49	.name		= "standard",
50	.version	= IPTABLES_VERSION,
51	.size		= XT_ALIGN(sizeof(int)),
52	.userspacesize	= XT_ALIGN(sizeof(int)),
53	.help		= &help,
54	.init		= &init,
55	.parse		= &parse,
56	.final_check	= &final_check,
57	.print		= NULL,
58	.save		= &save,
59};
60
61static
62struct xtables_target standard6 = {
63	.family		= AF_INET6,
64	.name		= "standard",
65	.version	= IPTABLES_VERSION,
66	.size		= XT_ALIGN(sizeof(int)),
67	.userspacesize	= XT_ALIGN(sizeof(int)),
68	.help		= &help,
69	.init		= &init,
70	.parse		= &parse,
71	.final_check	= &final_check,
72	.print		= NULL,
73	.save		= &save,
74};
75
76void _init(void)
77{
78	xtables_register_target(&standard);
79	xtables_register_target(&standard6);
80}
81