Require mLib 2.0.3 for connection stuff.
[fwd] / privconn.h
CommitLineData
ee599f55 1/* -*-c-*-
2 *
3 * $Id: privconn.h,v 1.1 2003/11/29 20:36:07 mdw Exp $
4 *
5 * Making privileged connections
6 *
7 * (c) 2003 Straylight/Edgeware
8 */
9
10/*----- Licensing notice --------------------------------------------------*
11 *
12 * This file is part of the `fw' port forwarder.
13 *
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.
18 *
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.
23 *
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.
27 */
28
29/*----- Revision history --------------------------------------------------*
30 *
31 * $Log: privconn.h,v $
32 * Revision 1.1 2003/11/29 20:36:07 mdw
33 * Privileged outgoing connections.
34 *
35 */
36
37#ifndef PRIVCONN_H
38#define PRIVCONN_H
39
40#ifdef __cplusplus
41 extern "C" {
42#endif
43
44/*----- Header files ------------------------------------------------------*/
45
46#include <arpa/inet.h>
47
48#include <mLib/conn.h>
49#include <mLib/sel.h>
50
51/*----- Functions provided ------------------------------------------------*/
52
53/* --- @privconn_split@ --- *
54 *
55 * Arguments: @sel_state *s@ = select state
56 *
57 * Returns: ---
58 *
59 * Use: Splits off the privileged binding code into a separate
60 * process.
61 */
62
63extern void privconn_split(sel_state */*s*/);
64
65/* --- @privconn_adddest@ --- *
66 *
67 * Arguments: @struct in_addr peer@ = address to connect to
68 * @unsigned port@ = port to connect to
69 *
70 * Returns: Index for this destination address, or @-1@ if not
71 * available.
72 *
73 * Use: Adds a valid destination for a privileged connection.
74 */
75
76extern int privconn_adddest(struct in_addr /*peer*/, unsigned /*port*/);
77
78/* --- @privconn_connect@ --- *
79 *
80 * Arguments: @conn *c@ = connection structure to fill in
81 * @sel_state *s@ = pointer to select state to attach to
82 * @int i@ = address index to connect to
83 * @struct in_addr bind@ = address to bind to
84 * @void (*func)(int, void *)@ = function to call on connect
85 * @void *p@ = argument for the function
86 *
87 * Returns: Zero on success, @-1@ on failure.
88 *
89 * Use: Sets up a privileged connection job.
90 */
91
92extern int privconn_connect(conn */*c*/, sel_state */*s*/,
93 int /*i*/, struct in_addr /*bind*/,
94 void (*/*func*/)(int, void *), void */*p*/);
95
96/*----- That's all, folks -------------------------------------------------*/
97
98#ifdef __cplusplus
99 }
100#endif
101
102#endif