blob: 9ca1fed031133d40f08c50205a2a17c7a1b6b6a4 [file] [log] [blame]
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001#include <stdio.h>
Bart De Schuymer41e8a192002-06-23 08:03:12 +00002#include <stdlib.h>
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00003#include <sys/socket.h>
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00004#include <getopt.h>
5#include "../include/ebtables_u.h"
6
7static struct option opts[] =
8{
9 {0}
10};
11
12static void print_help()
13{
14 printf("Standard targets: DROP, ACCEPT and CONTINUE\n");
15}
16
17static void init(struct ebt_entry_target *t)
18{
19 ((struct ebt_standard_target *)t)->verdict = EBT_CONTINUE;
20}
21
22static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
23 unsigned int *flags, struct ebt_entry_target **target)
24{
25 return 0;
26}
27
28static void final_check(const struct ebt_u_entry *entry,
Bart De Schuymer41e8a192002-06-23 08:03:12 +000029 const struct ebt_entry_target *target, const char *name, unsigned int hook_mask)
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000030{
31}
32
33static void print(const struct ebt_u_entry *entry,
34 const struct ebt_entry_target *target)
35{
Bart De Schuymer41e8a192002-06-23 08:03:12 +000036 int verdict = ((struct ebt_standard_target *)target)->verdict;
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000037
38 if (verdict == EBT_CONTINUE)
Bart De Schuymer41e8a192002-06-23 08:03:12 +000039 printf("CONTINUE ");
40 else if (verdict == EBT_ACCEPT)
41 printf("ACCEPT ");
42 else if (verdict == EBT_DROP)
43 printf("DROP ");
44 else if (verdict == EBT_RETURN)
45 printf("RETURN ");
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000046 else
Bart De Schuymer41e8a192002-06-23 08:03:12 +000047 print_error("BUG: Bad standard target"); // this is a bug
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000048}
49
50static int compare(const struct ebt_entry_target *t1,
51 const struct ebt_entry_target *t2)
52{
53 return ((struct ebt_standard_target *)t1)->verdict ==
54 ((struct ebt_standard_target *)t2)->verdict;
55}
56
57static struct ebt_u_target standard =
58{
59 EBT_STANDARD_TARGET,
60 sizeof(struct ebt_standard_target) - sizeof(struct ebt_entry_target),
61 print_help,
62 init,
63 parse,
64 final_check,
65 print,
66 compare,
67 opts
68};
69
70static void _init(void) __attribute__ ((constructor));
71static void _init(void)
72{
73 register_target(&standard);
74}