3 * Produce ACL rules for various products from a packet.
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 2006 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #ifndef __UI_FIREWALL_RULES_H__
13 #define __UI_FIREWALL_RULES_H__
17 #endif /* __cplusplus */
33 /** Fetch the number of firewall products.
34 * @return The number of firewall products. Should be used as the index for
35 * the rest of the functions below.
37 size_t firewall_product_count(void);
40 * Given an index, return the product name.
41 * @param product_idx Product index.
42 * @return Product name or "Unknown".
44 const char *firewall_product_name(size_t product_idx
);
47 * Given an index, return the product's rule hint.
48 * @param product_idx Product index.
49 * @return Product rule hint, e.g. "Change le0 to a valid interface." or "".
51 const char *firewall_product_rule_hint(size_t product_idx
);
54 * @param product_idx Product index.
55 * @return The comment prefix, e.g. "#" or an empty string.
57 const char *firewall_product_comment_prefix(size_t product_idx
);
59 /* Syntax function prototypes */
60 typedef void (*syntax_func
)(GString
*rtxt
, char *addr
, uint32_t port
, port_type ptype
, bool inbound
, bool deny
);
62 /** MAC filter function
63 * @param product_idx Product index.
64 * @return A pointer to the MAC filter function or NULL.
66 syntax_func
firewall_product_mac_func(size_t product_idx
);
68 /** IPv4 filter function
69 * @param product_idx Product index.
70 * @return A pointer to the IPv4 filter function or NULL.
72 syntax_func
firewall_product_ipv4_func(size_t product_idx
);
74 /** Port filter function
75 * @param product_idx Product index.
76 * @return A pointer to the port filter function or NULL.
78 syntax_func
firewall_product_port_func(size_t product_idx
);
80 /** IPv4+port filter function
81 * @param product_idx Product index.
82 * @return A pointer to the IPv4+port filter function or NULL.
84 syntax_func
firewall_product_ipv4_port_func(size_t product_idx
);
86 /** Product inbound support
87 * Given an index, return the product's ability to support inbound rules.
88 * @param product_idx Product index.
89 * @return true or false.
91 bool firewall_product_does_inbound(size_t product_idx
);
95 #endif /* __cplusplus */
97 #endif /* __UI_FIREWALL_RULES_H__ */