iptables-1.2.9-2.3.1.src.rpm
[iptables.git] / extensions / libip6t_eui64.c
1 /* Shared library add-on to ip6tables to add EUI64 address checking support. */
2 #include <stdio.h>
3 #include <netdb.h>
4 #include <string.h>
5 #include <stdlib.h>
6 #include <getopt.h>
7 #if defined(__GLIBC__) && __GLIBC__ == 2
8 #include <net/ethernet.h>
9 #else
10 #include <linux/if_ether.h>
11 #endif
12 #include <ip6tables.h>
13
14 /* Function which prints out usage message. */
15 static void
16 help(void)
17 {
18         printf(
19 "eui64 v%s options:\n"
20 " This module hasn't got any option\n"
21 " This module checks for EUI64 IPv6 addresses\n"
22 "\n", IPTABLES_VERSION);
23 }
24
25 static struct option opts[] = {
26         {0}
27 };
28
29 /* Initialize the match. */
30 static void
31 init(struct ip6t_entry_match *m, unsigned int *nfcache)
32 {
33         /* Can't cache this */
34         *nfcache |= NFC_UNKNOWN;
35 }
36
37 /* Function which parses command options; returns true if it
38    ate an option */
39 static int
40 parse(int c, char **argv, int invert, unsigned int *flags,
41       const struct ip6t_entry *entry,
42       unsigned int *nfcache,
43       struct ip6t_entry_match **match)
44 {
45         return 0;
46 }
47
48 /* Final check */
49 static void final_check(unsigned int flags)
50 {
51 }
52
53 /* Prints out the matchinfo. */
54 static void
55 print(const struct ip6t_ip6 *ip,
56       const struct ip6t_entry_match *match,
57       int numeric)
58 {
59         printf("eui64 ");
60 }
61
62 /* Saves the union ip6t_matchinfo in parsable form to stdout. */
63 static void save(const struct ip6t_ip6 *ip, const struct ip6t_entry_match *match)
64 {
65
66 }
67
68 static
69 struct ip6tables_match eui64
70 = { NULL,
71     "eui64",
72     IPTABLES_VERSION,
73     IP6T_ALIGN(sizeof(int)),
74     IP6T_ALIGN(sizeof(int)),
75     &help,
76     &init,
77     &parse,
78     &final_check,
79     &print,
80     &save,
81     opts
82 };
83
84 void _init(void)
85 {
86         register_match6(&eui64);
87 }