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