update epan/dissectors/pidl/drsuapi/drsuapi.idl from samba
[wireshark-sm.git] / ui / firewall_rules.h
blob456cf61f33b6ba64350538500da7d3e996a65b40
1 /** @file
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__
15 #ifdef __cplusplus
16 extern "C" {
17 #endif /* __cplusplus */
19 /* Rule types */
20 typedef enum {
21 RT_NONE,
22 RT_MAC_SRC,
23 RT_MAC_DST,
24 RT_IPv4_SRC,
25 RT_IPv4_DST,
26 RT_PORT_SRC,
27 RT_PORT_DST,
28 RT_IPv4_PORT_SRC,
29 RT_IPv4_PORT_DST,
30 NUM_RULE_TYPES
31 } rule_type_e;
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);
39 /** Product name
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);
46 /** Product rule hint
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);
53 /** Comment prefix
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);
93 #ifdef __cplusplus
95 #endif /* __cplusplus */
97 #endif /* __UI_FIREWALL_RULES_H__ */