Tomato 1.28
[tomato.git] / release / src / router / iptables / extensions / libipt_exp.c
blob6fc389029cddb232574e36c22ba1fa7fd828da8e
1 /*
3 Experimental Netfilter Crap
4 Copyright (C) 2006 Jonathan Zarate
6 */
8 #include <stdio.h>
9 #include <string.h>
10 #include <stdlib.h>
11 #include <getopt.h>
13 #include <iptables.h>
14 #include <linux/netfilter_ipv4/ipt_exp.h>
17 static void help(void)
19 printf(
20 "exp match v0.00 options:\n"
21 " how should I know?!\n");
24 static void init(struct ipt_entry_match *m, unsigned int *nfcache)
26 *nfcache |= NFC_UNKNOWN;
29 static struct option opts[] = {
30 { .name = "foo", .has_arg = 0, .flag = 0, .val = '1' },
31 { .name = 0 }
34 static int parse(int c, char **argv, int invert, unsigned int *flags,
35 const struct ipt_entry *entry, unsigned int *nfcache,
36 struct ipt_entry_match **match)
38 struct ipt_exp_info *info;
40 if ((c < '1') || (c > '1')) return 0;
42 // reserved
44 info = (struct ipt_exp_info *)(*match)->data;
45 switch (c) {
46 case '1':
47 info->dummy = 1; // blah
48 break;
50 return 1;
53 static void final_check(unsigned int flags)
57 static void print(const struct ipt_ip *ip, const struct ipt_entry_match *match, int numeric)
59 printf("exp ");
62 static void save(const struct ipt_ip *ip, const struct ipt_entry_match *match)
67 static struct iptables_match exp_match = {
68 .name = "exp",
69 .version = IPTABLES_VERSION,
70 .size = IPT_ALIGN(sizeof(struct ipt_exp_info)),
71 .userspacesize = IPT_ALIGN(sizeof(struct ipt_exp_info)),
72 .help = &help,
73 .init = &init,
74 .parse = &parse,
75 .final_check = &final_check,
76 .print = &print,
77 .save = &save,
78 .extra_opts = opts
81 void _init(void)
83 register_match(&exp_match);