projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6a15196
)
iptables plugin: Use the same enum everywhere.
author
Florian Forster
<octo@leeloo.lan.home.verplant.org>
Sat, 2 May 2009 07:37:20 +0000
(09:37 +0200)
committer
Florian Forster
<octo@leeloo.lan.home.verplant.org>
Sat, 2 May 2009 07:37:20 +0000
(09:37 +0200)
src/iptables.c
patch
|
blob
|
history
diff --git
a/src/iptables.c
b/src/iptables.c
index
c8542a5
..
fb887da
100644
(file)
--- a/
src/iptables.c
+++ b/
src/iptables.c
@@
-54,15
+54,19
@@
static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
/*
Each table/chain combo that will be queried goes into this list
*/
/*
Each table/chain combo that will be queried goes into this list
*/
+
+enum protocol_version_e
+{
+ IPV4,
+ IPV6
+};
+typedef enum protocol_version_e protocol_version_t;
+
#ifndef XT_TABLE_MAXNAMELEN
# define XT_TABLE_MAXNAMELEN 32
#endif
typedef struct {
#ifndef XT_TABLE_MAXNAMELEN
# define XT_TABLE_MAXNAMELEN 32
#endif
typedef struct {
- enum
- {
- IPV4,
- IPV6
- } ip_version;
+ protocol_version_t ip_version;
char table[XT_TABLE_MAXNAMELEN];
char chain[XT_TABLE_MAXNAMELEN];
union
char table[XT_TABLE_MAXNAMELEN];
char chain[XT_TABLE_MAXNAMELEN];
union
@@
-85,14
+89,14
@@
static int chain_num = 0;
static int iptables_config (const char *key, const char *value)
{
/* int ip_value; */
static int iptables_config (const char *key, const char *value)
{
/* int ip_value; */
-
enum { IPV4, IPV6 } ip_protocol
;
+
protocol_version_t ip_version
;
if (strcasecmp (key, "Chain") == 0)
if (strcasecmp (key, "Chain") == 0)
- ip_
protocol
= IPV4;
+ ip_
version
= IPV4;
else if (strcasecmp (key, "Chain6") == 0)
else if (strcasecmp (key, "Chain6") == 0)
- ip_
protocol
= IPV6;
+ ip_
version
= IPV6;
- if (( ip_
protocol == IPV4 ) || ( ip_protocol
== IPV6 ))
+ if (( ip_
version == IPV4 ) || ( ip_version
== IPV6 ))
{
ip_chain_t temp, *final, **list;
char *table;
{
ip_chain_t temp, *final, **list;
char *table;
@@
-122,7
+126,7
@@
static int iptables_config (const char *key, const char *value)
*/
/* set IPv4 or IPv6 */
*/
/* set IPv4 or IPv6 */
- temp.ip_version = ip_
protocol
;
+ temp.ip_version = ip_
version
;
/* Chain <table> <chain> [<comment|num> [name]] */
fields_num = strsplit (value_copy, fields, 4);
/* Chain <table> <chain> [<comment|num> [name]] */
fields_num = strsplit (value_copy, fields, 4);