Debian Codegraph @

src/expect/setter.c

raw
1 /*
2 * (C) 2005-2011 by Pablo Neira Ayuso <[email protected]>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */
9
10 #include "internal/internal.h"
11
12 static void set_exp_attr_master(struct nf_expect *exp, const void *value)
13 {
14 exp->master = *((struct nfct_tuple_head *) value);
15 }
16
17 static void set_exp_attr_expected(struct nf_expect *exp, const void *value)
18 {
19 exp->expected = *((struct nfct_tuple_head *) value);
20 }
21
22 static void set_exp_attr_mask(struct nf_expect *exp, const void *value)
23 {
24 exp->mask = *((struct nfct_tuple_head *) value);
25 }
26
27 static void set_exp_attr_timeout(struct nf_expect *exp, const void *value)
28 {
29 exp->timeout = *((uint32_t *) value);
30 }
31
32 static void set_exp_attr_zone(struct nf_expect *exp, const void *value)
33 {
34 exp->zone = *((uint16_t *) value);
35 }
36
37 static void set_exp_attr_flags(struct nf_expect *exp, const void *value)
38 {
39 exp->flags = *((uint32_t *) value);
40 }
41
42 static void set_exp_attr_class(struct nf_expect *exp, const void *value)
43 {
44 exp->class = *((uint32_t *) value);
45 }
46
47 static void set_exp_attr_helper_name(struct nf_expect *exp, const void *value)
48 {
49 snprintf(exp->helper_name, NFCT_HELPER_NAME_MAX, "%s", (char *)value);
50 }
51
52 static void set_exp_attr_nat_dir(struct nf_expect *exp, const void *value)
53 {
54 exp->nat_dir = *((uint32_t *) value);
55 }
56
57 static void set_exp_attr_nat_tuple(struct nf_expect *exp, const void *value)
58 {
59 exp->nat = *((struct nfct_tuple_head *) value);
60 }
61
62 static void set_exp_attr_expectfn(struct nf_expect *exp, const void *value)
63 {
64 snprintf(exp->expectfn, __NFCT_EXPECTFN_MAX, "%s", (char *)value);
65 }
66
67 const set_exp_attr set_exp_attr_array[ATTR_EXP_MAX] = {
68 [ATTR_EXP_MASTER] = set_exp_attr_master,
69 [ATTR_EXP_EXPECTED] = set_exp_attr_expected,
70 [ATTR_EXP_MASK] = set_exp_attr_mask,
71 [ATTR_EXP_TIMEOUT] = set_exp_attr_timeout,
72 [ATTR_EXP_ZONE] = set_exp_attr_zone,
73 [ATTR_EXP_FLAGS] = set_exp_attr_flags,
74 [ATTR_EXP_HELPER_NAME] = set_exp_attr_helper_name,
75 [ATTR_EXP_CLASS] = set_exp_attr_class,
76 [ATTR_EXP_NAT_TUPLE] = set_exp_attr_nat_tuple,
77 [ATTR_EXP_NAT_DIR] = set_exp_attr_nat_dir,
78 [ATTR_EXP_FN] = set_exp_attr_expectfn,
79 };