3 * $Id: privconn.h,v 1.2 2004/04/08 01:36:25 mdw Exp $
5 * Making privileged connections
7 * (c) 2003 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.
36 /*----- Header files ------------------------------------------------------*/
38 #include <arpa/inet.h>
40 #include <mLib/conn.h>
43 /*----- Functions provided ------------------------------------------------*/
45 /* --- @privconn_split@ --- *
47 * Arguments: @sel_state *s@ = select state
51 * Use: Splits off the privileged binding code into a separate
55 extern void privconn_split(sel_state */
*s*/
);
57 /* --- @privconn_adddest@ --- *
59 * Arguments: @struct in_addr peer@ = address to connect to
60 * @unsigned port@ = port to connect to
62 * Returns: Index for this destination address, or @-1@ if not
65 * Use: Adds a valid destination for a privileged connection.
68 extern int privconn_adddest(struct in_addr
/*peer*/, unsigned /*port*/);
70 /* --- @privconn_connect@ --- *
72 * Arguments: @conn *c@ = connection structure to fill in
73 * @sel_state *s@ = pointer to select state to attach to
74 * @int i@ = address index to connect to
75 * @struct in_addr bind@ = address to bind to
76 * @void (*func)(int, void *)@ = function to call on connect
77 * @void *p@ = argument for the function
79 * Returns: Zero on success, @-1@ on failure.
81 * Use: Sets up a privileged connection job.
84 extern int privconn_connect(conn */
*c*/
, sel_state */
*s*/
,
85 int /*i*/, struct in_addr
/*bind*/,
86 void (*/
*func*/
)(int, void *), void */
*p*/
);
88 /*----- That's all, folks -------------------------------------------------*/