3 * $Id: target.h,v 1.3 2003/11/29 20:36:07 mdw Exp $
5 * Description of forwarding targets
7 * (c) 1999 Straylight/Edgeware
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of the `fw' port forwarder.
14 * `fw' is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * `fw' is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with `fw'; if not, write to the Free Software Foundation,
26 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 /*----- Revision history --------------------------------------------------*
32 * Revision 1.3 2003/11/29 20:36:07 mdw
33 * Privileged outgoing connections.
35 * Revision 1.2 2003/11/25 14:08:23 mdw
36 * Debianization. Socket target options. Internet binding.
38 * Revision 1.1 1999/07/26 23:33:01 mdw
39 * Infrastructure for the new design.
50 /*----- Header files ------------------------------------------------------*/
62 /*----- Data structures ---------------------------------------------------*/
64 /* --- A basic target object --- */
66 typedef struct target
{
67 struct target_ops
*ops
;
71 /* --- Forwarding target operations --- */
73 typedef struct target_ops
{
74 const char *name
; /* Name of this target */
78 * Arguments: @target *t@ = pointer to target object, or zero if global
79 * @scanner *sc@ = scanner to read from
81 * Returns: Nonzero to claim the option.
83 * Use: Handles an option string from the configuration file.
86 int (*option
)(target */
*t*/
, scanner */
*sc*/
);
90 * Arguments: @scanner *sc@ = pointer to scanner to read from
92 * Returns: Pointer to a target object to claim, null to reject.
94 * Use: Parses a target description from the configuration file.
95 * Only the socket target is allowed to omit the prefix on a
96 * target specification.
99 target
*(*read
)(scanner */
*sc*/
);
101 /* --- @confirm@ --- *
103 * Arguments: @target *t@ = pointer to target
107 * Use: Confirms configuration of a target.
110 void (*confirm
)(target */
*t*/
);
112 /* --- @create@ --- *
114 * Arguments: @target *t@ = pointer to target
115 * @const char *desc@ = description of connection
117 * Returns: Pointer to a created endpoint.
119 * Use: Generates a target endpoint for communication.
122 endpt
*(*create
)(target */
*t*/
, const char */
*desc*/
);
124 /* --- @destroy@ --- *
126 * Arguments: @target *t@ = pointer to target
130 * Use: Destroys a target.
133 void (*destroy
)(target */
*t*/
);
137 /*----- That's all, folks -------------------------------------------------*/