--- /dev/null
+/* -*-c-*-
+ *
+ * $Id: source.h,v 1.1 1999/07/26 23:33:01 mdw Exp $
+ *
+ * Description of forwarding sources
+ *
+ * (c) 1999 Straylight/Edgeware
+ */
+
+/*----- Licensing notice --------------------------------------------------*
+ *
+ * This file is part of the `fw' port forwarder.
+ *
+ * `fw' is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * `fw' is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with `fw'; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/*----- Revision history --------------------------------------------------*
+ *
+ * $Log: source.h,v $
+ * Revision 1.1 1999/07/26 23:33:01 mdw
+ * Infrastructure for the new design.
+ *
+ */
+
+#ifndef SOURCE_H
+#define SOURCE_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/*----- Header files ------------------------------------------------------*/
+
+#include <stdio.h>
+
+#ifndef SCAN_H
+# include "scan.h"
+#endif
+
+#ifndef TARGET_H
+# include "target.h"
+#endif
+
+/*----- Data structures ---------------------------------------------------*/
+
+/* --- A basic source object --- */
+
+typedef struct source {
+ struct source *next, *prev;
+ struct source_ops *ops;
+ char *desc;
+} source;
+
+/* --- Forwarding source operations --- */
+
+typedef struct source_ops {
+ const char *name; /* Name of this source */
+
+ /* --- @option@ --- *
+ *
+ * Arguments: @scanner *sc@ = scanner to read from
+ * @source *s@ = pointer to source object, or zero if global
+ *
+ * Returns: Nonzero to claim the option.
+ *
+ * Use: Handles an option string from the configuration file.
+ */
+
+ int (*option)(source */*s*/, scanner */*sc*/);
+
+ /* --- @read@ --- *
+ *
+ * Arguments: @scanner *sc@ = pointer to scanner to read from
+ *
+ * Returns: Pointer to a source object to claim, null to reject.
+ *
+ * Use: Parses a source description from the configuration file.
+ * Only the socket source is allowed to omit the prefix on a
+ * source specification.
+ */
+
+ source *(*read)(scanner */*sc*/);
+
+ /* --- @attach@ --- *
+ *
+ * Arguments: @source *s@ = pointer to source
+ * @scanner *sc@ = scanner (for error reporting)
+ * @target *t@ = pointer to target to attach
+ *
+ * Returns: ---
+ *
+ * Use: Attaches a target to a source.
+ */
+
+ void (*attach)(source */*s*/, scanner */*sc*/, target */*t*/);
+
+ /* --- @destroy@ --- *
+ *
+ * Arguments: @source *s@ = pointer to source
+ *
+ * Returns: ---
+ *
+ * Use: Destroys a source. Used when closing the system down, for
+ * example as a result of a signal.
+ */
+
+ void (*destroy)(source */*s*/);
+
+} source_ops;
+
+/*----- Functions provided ------------------------------------------------*/
+
+/* --- @source_add@ --- *
+ *
+ * Arguments: @source *s@ = pointer to a source
+ *
+ * Returns: ---
+ *
+ * Use: Adds a source to the master list. Only do this for passive
+ * sources (e.g., listening sockets), not active sources (e.g.,
+ * executable programs).
+ */
+
+extern void source_add(source */*s*/);
+
+/* --- @source_remove@ --- *
+ *
+ * Arguments: @source *s@ = pointer to a source
+ *
+ * Returns: ---
+ *
+ * Use: Removes a source from the master list.
+ */
+
+extern void source_remove(source */*s*/);
+
+/* --- @source_killall@ --- *
+ *
+ * Arguments: ---
+ *
+ * Returns: ---
+ *
+ * Use: Frees all sources.
+ */
+
+extern void source_killall(void);
+
+/*----- That's all, folks -------------------------------------------------*/
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif