summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-01-04 00:01:35 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-01-04 00:01:35 +0000
commite9c4a161098d204fb8e247bcd1d8add275b42cdb (patch)
tree508d5f1a7720a20bbc174c5f3ea39c82a1d52c7b /sbin
parentd7c7d2ecfc537aaa3a579a56bd6cb368f723c27f (diff)
I do not know where this policy of "one .h file for every .c file" comes
from, but whoever thought of it is stupid.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/pfctl/parse.y6
-rw-r--r--sbin/pfctl/pf_print_state.c5
-rw-r--r--sbin/pfctl/pf_print_state.h42
-rw-r--r--sbin/pfctl/pfctl.c7
-rw-r--r--sbin/pfctl/pfctl.h (renamed from sbin/pfctl/pfctl_radix.h)59
-rw-r--r--sbin/pfctl/pfctl_altq.c4
-rw-r--r--sbin/pfctl/pfctl_altq.h69
-rw-r--r--sbin/pfctl/pfctl_parser.c4
-rw-r--r--sbin/pfctl/pfctl_parser.h5
-rw-r--r--sbin/pfctl/pfctl_radix.c4
-rw-r--r--sbin/pfctl/pfctl_table.c7
-rw-r--r--sbin/pfctl/pfctl_table.h42
12 files changed, 70 insertions, 184 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index c5e0f13e2b2..b1ac854c77c 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.274 2003/01/03 22:22:18 dhartmei Exp $ */
+/* $OpenBSD: parse.y,v 1.275 2003/01/04 00:01:34 deraadt Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -54,10 +54,8 @@
#include <grp.h>
#include <md5.h>
-#include "pf_print_state.h"
#include "pfctl_parser.h"
-#include "pfctl_radix.h"
-#include "pfctl_altq.h"
+#include "pfctl.h"
static struct pfctl *pf = NULL;
static FILE *fin = NULL;
diff --git a/sbin/pfctl/pf_print_state.c b/sbin/pfctl/pf_print_state.c
index f6d8fe02e32..dabece9756d 100644
--- a/sbin/pfctl/pf_print_state.c
+++ b/sbin/pfctl/pf_print_state.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_print_state.c,v 1.15 2003/01/03 21:37:44 cedric Exp $ */
+/* $OpenBSD: pf_print_state.c,v 1.16 2003/01/04 00:01:34 deraadt Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -53,8 +53,7 @@
#include <err.h>
#include "pfctl_parser.h"
-#include "pfctl_radix.h"
-#include "pf_print_state.h"
+#include "pfctl.h"
void print_name(struct pf_addr *, struct pf_addr *, sa_family_t);
diff --git a/sbin/pfctl/pf_print_state.h b/sbin/pfctl/pf_print_state.h
deleted file mode 100644
index dce2ac130bf..00000000000
--- a/sbin/pfctl/pf_print_state.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* $OpenBSD: pf_print_state.h,v 1.8 2002/11/30 13:53:15 mickey Exp $ */
-
-/*
- * Copyright (c) 2001 Daniel Hartmeier
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifndef _PF_PRINT_STATE_H_
-#define _PF_PRINT_STATE_H_
-
-void print_addr(struct pf_addr_wrap *, sa_family_t);
-void print_host(struct pf_state_host *, sa_family_t, int);
-void print_seq(struct pf_state_peer *);
-void print_state(struct pf_state *s, int);
-int unmask(struct pf_addr *, sa_family_t);
-
-#endif /* _PF_PRINT_STATE_H_ */
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index 38d722c9d41..147359db81d 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl.c,v 1.121 2003/01/03 22:57:26 deraadt Exp $ */
+/* $OpenBSD: pfctl.c,v 1.122 2003/01/04 00:01:34 deraadt Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -51,10 +51,7 @@
#include <unistd.h>
#include "pfctl_parser.h"
-#include "pf_print_state.h"
-#include "pfctl_altq.h"
-#include "pfctl_table.h"
-#include "pfctl_radix.h"
+#include "pfctl.h"
void usage(void);
int pfctl_enable(int, int);
diff --git a/sbin/pfctl/pfctl_radix.h b/sbin/pfctl/pfctl.h
index 084eb87b01d..3e9ce99de37 100644
--- a/sbin/pfctl/pfctl_radix.h
+++ b/sbin/pfctl/pfctl.h
@@ -1,7 +1,7 @@
-/* $OpenBSD: pfctl_radix.h,v 1.1 2003/01/03 21:37:44 cedric Exp $ */
+/* $OpenBSD: pfctl.h,v 1.1 2003/01/04 00:01:34 deraadt Exp $ */
/*
- * Copyright (c) 2002 Cedric Berger
+ * Copyright (c) 2001 Daniel Hartmeier
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,10 +30,8 @@
*
*/
-#ifndef _PFCTL_RADIX_H_
-#define _PFCTL_RADIX_H_
-
-#include <net/pfvar.h>
+#ifndef _PFCTL_H_
+#define _PFCTL_H_
void pfr_set_fd(int);
int pfr_get_fd(void);
@@ -54,5 +52,52 @@ int pfr_clr_astats(struct pfr_table *, struct pfr_addr *, int, int *, int);
int pfr_tst_addrs(struct pfr_table *, struct pfr_addr *, int, int *, int);
int pfr_wrap_table(struct pfr_table *, struct pf_addr_wrap *, int *, int);
int pfr_unwrap_table(struct pfr_table *, struct pf_addr_wrap *, int);
+int pfctl_clear_tables(int);
+int pfctl_show_tables(int);
+int pfctl_command_tables(int, char *[], char *, char *, char *, int);
+
+#ifndef DEFAULT_PRIORITY
+#define DEFAULT_PRIORITY 1
+#define DEFAULT_QLIMIT 50
+#endif
+
+/*
+ * generalized service curve used for admission control
+ */
+struct segment {
+ LIST_ENTRY(segment) _next;
+ double x, y, d, m;
+};
+
+struct pf_altq_node {
+ struct pf_altq altq;
+ struct pf_altq_node *next;
+ struct pf_altq_node *children;
+};
+
+void pfctl_insert_altq_node(struct pf_altq_node **,
+ const struct pf_altq);
+struct pf_altq_node *pfctl_find_altq_node(struct pf_altq_node *,
+ const char *, const char *);
+void pfctl_print_altq_node(const struct pf_altq_node *,
+ unsigned);
+void pfctl_free_altq_node(struct pf_altq_node *);
+
+int check_commit_altq(int, int);
+void pfaltq_store(struct pf_altq *);
+void pfaltq_free(struct pf_altq *);
+struct pf_altq *pfaltq_lookup(const char *);
+struct pf_altq *qname_to_pfaltq(const char *, const char *);
+u_int32_t qname_to_qid(const char *, const char *);
+char *qid_to_qname(u_int32_t, const char *);
+
+void print_altq(const struct pf_altq *, unsigned);
+void print_queue(const struct pf_altq *, unsigned);
+
+void print_addr(struct pf_addr_wrap *, sa_family_t);
+void print_host(struct pf_state_host *, sa_family_t, int);
+void print_seq(struct pf_state_peer *);
+void print_state(struct pf_state *s, int);
+int unmask(struct pf_addr *, sa_family_t);
-#endif /* _PFCTL_RADIX_H_ */
+#endif /* _PFCTL_H_ */
diff --git a/sbin/pfctl/pfctl_altq.c b/sbin/pfctl/pfctl_altq.c
index 0415154ea96..bd6b28e1d2a 100644
--- a/sbin/pfctl/pfctl_altq.c
+++ b/sbin/pfctl/pfctl_altq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_altq.c,v 1.28 2003/01/03 21:48:21 deraadt Exp $ */
+/* $OpenBSD: pfctl_altq.c,v 1.29 2003/01/04 00:01:34 deraadt Exp $ */
/*
* Copyright (C) 2002
@@ -49,7 +49,7 @@
#include <altq/altq_hfsc.h>
#include "pfctl_parser.h"
-#include "pfctl_altq.h"
+#include "pfctl.h"
#define is_sc_null(sc) (((sc) == NULL) || ((sc)->m1 == 0 && (sc)->m2 == 0))
diff --git a/sbin/pfctl/pfctl_altq.h b/sbin/pfctl/pfctl_altq.h
deleted file mode 100644
index 86d4acef44f..00000000000
--- a/sbin/pfctl/pfctl_altq.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* $OpenBSD: pfctl_altq.h,v 1.7 2002/12/17 11:29:04 henning Exp $ */
-
-/*
- * Copyright (C) 2002
- * Sony Computer Science Laboratories Inc. All rights reserved.
- * Copyright (C) 2002 Henning Brauer. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef DEFAULT_PRIORITY
-#define DEFAULT_PRIORITY 1
-#define DEFAULT_QLIMIT 50
-#endif
-
-/*
- * generalized service curve used for admission control
- */
-struct segment {
- LIST_ENTRY(segment) _next;
- double x, y, d, m;
-};
-
-struct pf_altq_node {
- struct pf_altq altq;
- struct pf_altq_node *next;
- struct pf_altq_node *children;
-};
-
-void pfctl_insert_altq_node(struct pf_altq_node **,
- const struct pf_altq);
-struct pf_altq_node *pfctl_find_altq_node(struct pf_altq_node *,
- const char *, const char *);
-void pfctl_print_altq_node(const struct pf_altq_node *,
- unsigned);
-void pfctl_free_altq_node(struct pf_altq_node *);
-
-int check_commit_altq(int, int);
-void pfaltq_store(struct pf_altq *);
-void pfaltq_free(struct pf_altq *);
-struct pf_altq *pfaltq_lookup(const char *);
-struct pf_altq *qname_to_pfaltq(const char *, const char *);
-u_int32_t qname_to_qid(const char *, const char *);
-char *qid_to_qname(u_int32_t, const char *);
-
-void print_altq(const struct pf_altq *, unsigned);
-void print_queue(const struct pf_altq *, unsigned);
-
-int eval_pfaltq(struct pfctl *, struct pf_altq *, u_int32_t, u_int16_t);
-int eval_pfqueue(struct pfctl *, struct pf_altq *, u_int32_t, u_int16_t);
diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c
index 6b4d000f4c0..47de8bc677b 100644
--- a/sbin/pfctl/pfctl_parser.c
+++ b/sbin/pfctl/pfctl_parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_parser.c,v 1.124 2002/12/30 23:46:54 mcbride Exp $ */
+/* $OpenBSD: pfctl_parser.c,v 1.125 2003/01/04 00:01:34 deraadt Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -51,7 +51,7 @@
#include <err.h>
#include "pfctl_parser.h"
-#include "pf_print_state.h"
+#include "pfctl.h"
void print_op (u_int8_t, const char *, const char *);
void print_port (u_int8_t, u_int16_t, u_int16_t, char *);
diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h
index f36bb4dbaea..8be11417b38 100644
--- a/sbin/pfctl/pfctl_parser.h
+++ b/sbin/pfctl/pfctl_parser.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_parser.h,v 1.37 2002/12/22 14:19:29 dhartmei Exp $ */
+/* $OpenBSD: pfctl_parser.h,v 1.38 2003/01/04 00:01:34 deraadt Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -85,6 +85,9 @@ void print_binat(struct pf_rule *, int);
void print_rdr(struct pf_rule *, int);
void print_status(struct pf_status *);
+int eval_pfaltq(struct pfctl *, struct pf_altq *, u_int32_t, u_int16_t);
+int eval_pfqueue(struct pfctl *, struct pf_altq *, u_int32_t, u_int16_t);
+
struct icmptypeent {
char *name;
u_int8_t type;
diff --git a/sbin/pfctl/pfctl_radix.c b/sbin/pfctl/pfctl_radix.c
index 68e8c417381..08de265eb5d 100644
--- a/sbin/pfctl/pfctl_radix.c
+++ b/sbin/pfctl/pfctl_radix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_radix.c,v 1.5 2003/01/03 22:47:51 deraadt Exp $ */
+/* $OpenBSD: pfctl_radix.c,v 1.6 2003/01/04 00:01:34 deraadt Exp $ */
/*
* Copyright (c) 2002 Cedric Berger
@@ -43,7 +43,7 @@
#include <unistd.h>
#include <fcntl.h>
-#include "pfctl_radix.h"
+#include "pfctl.h"
extern int dev;
diff --git a/sbin/pfctl/pfctl_table.c b/sbin/pfctl/pfctl_table.c
index e065492abae..7db623f3771 100644
--- a/sbin/pfctl/pfctl_table.c
+++ b/sbin/pfctl/pfctl_table.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_table.c,v 1.10 2003/01/03 23:31:26 cedric Exp $ */
+/* $OpenBSD: pfctl_table.c,v 1.11 2003/01/04 00:01:34 deraadt Exp $ */
/*
* Copyright (c) 2002 Cedric Berger
@@ -52,11 +52,8 @@
#include <ctype.h>
#include <assert.h>
-#include "pfctl_table.h"
-#include "pfctl_radix.h"
+#include "pfctl.h"
#include "pfctl_parser.h"
-#include "pf_print_state.h"
-
#define BUF_SIZE 256
diff --git a/sbin/pfctl/pfctl_table.h b/sbin/pfctl/pfctl_table.h
deleted file mode 100644
index 650438271cc..00000000000
--- a/sbin/pfctl/pfctl_table.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* $OpenBSD: pfctl_table.h,v 1.1 2003/01/03 21:37:44 cedric Exp $ */
-
-/*
- * Copyright (c) 2002 Cedric Berger
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifndef _PFCTL_TABLE_H_
-#define _PFCTL_TABLE_H_
-
-#include <net/pfvar.h>
-
-int pfctl_clear_tables(int);
-int pfctl_show_tables(int);
-int pfctl_command_tables(int, char *[], char *, char *, char *, int);
-
-#endif /* _PFCTL_TABLE_H_ */