3 * Description of forwarding sources
5 * (c) 1999 Straylight/Edgeware
8 /*----- Licensing notice --------------------------------------------------*
10 * This file is part of the `fw' port forwarder.
12 * `fw' is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * `fw' is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with `fw'; if not, write to the Free Software Foundation,
24 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 /*----- Header files ------------------------------------------------------*/
46 /*----- Data structures ---------------------------------------------------*/
48 /* --- A basic source object --- */
50 typedef struct source
{
51 struct source
*next
, *prev
;
52 struct source_ops
*ops
;
56 /* --- Forwarding source operations --- */
58 typedef struct source_ops
{
59 const char *name
; /* Name of this source */
63 * Arguments: @scanner *sc@ = scanner to read from
64 * @source *s@ = pointer to source object, or zero if global
66 * Returns: Nonzero to claim the option.
68 * Use: Handles an option string from the configuration file.
71 int (*option
)(source */
*s*/
, scanner */
*sc*/
);
75 * Arguments: @scanner *sc@ = pointer to scanner to read from
77 * Returns: Pointer to a source object to claim, null to reject.
79 * Use: Parses a source description from the configuration file.
80 * Only the socket source is allowed to omit the prefix on a
81 * source specification.
84 source
*(*read
)(scanner */
*sc*/
);
88 * Arguments: @source *s@ = pointer to source
89 * @scanner *sc@ = scanner (for error reporting)
90 * @target *t@ = pointer to target to attach
94 * Use: Attaches a target to a source.
97 void (*attach
)(source */
*s*/
, scanner */
*sc*/
, target */
*t*/
);
99 /* --- @destroy@ --- *
101 * Arguments: @source *s@ = pointer to source
105 * Use: Destroys a source. Used when closing the system down, for
106 * example as a result of a signal.
109 void (*destroy
)(source */
*s*/
);
113 /*----- Functions provided ------------------------------------------------*/
115 /* --- @source_add@ --- *
117 * Arguments: @source *s@ = pointer to a source
121 * Use: Adds a source to the master list. Only do this for passive
122 * sources (e.g., listening sockets), not active sources (e.g.,
123 * executable programs).
126 extern void source_add(source */
*s*/
);
128 /* --- @source_remove@ --- *
130 * Arguments: @source *s@ = pointer to a source
134 * Use: Removes a source from the master list.
137 extern void source_remove(source */
*s*/
);
139 /* --- @source_killall@ --- *
145 * Use: Frees all sources.
148 extern void source_killall(void);
150 /*----- That's all, folks -------------------------------------------------*/