Provide a `--pidfile' option in `fw'.
[fwd] / privconn.h
CommitLineData
ee599f55 1/* -*-c-*-
2 *
7481fc9c 3 * $Id: privconn.h,v 1.2 2004/04/08 01:36:25 mdw Exp $
ee599f55 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
ee599f55 29#ifndef PRIVCONN_H
30#define PRIVCONN_H
31
32#ifdef __cplusplus
33 extern "C" {
34#endif
35
36/*----- Header files ------------------------------------------------------*/
37
38#include <arpa/inet.h>
39
40#include <mLib/conn.h>
41#include <mLib/sel.h>
42
43/*----- Functions provided ------------------------------------------------*/
44
45/* --- @privconn_split@ --- *
46 *
47 * Arguments: @sel_state *s@ = select state
48 *
49 * Returns: ---
50 *
51 * Use: Splits off the privileged binding code into a separate
52 * process.
53 */
54
55extern void privconn_split(sel_state */*s*/);
56
57/* --- @privconn_adddest@ --- *
58 *
59 * Arguments: @struct in_addr peer@ = address to connect to
60 * @unsigned port@ = port to connect to
61 *
62 * Returns: Index for this destination address, or @-1@ if not
63 * available.
64 *
65 * Use: Adds a valid destination for a privileged connection.
66 */
67
68extern int privconn_adddest(struct in_addr /*peer*/, unsigned /*port*/);
69
70/* --- @privconn_connect@ --- *
71 *
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
78 *
79 * Returns: Zero on success, @-1@ on failure.
80 *
81 * Use: Sets up a privileged connection job.
82 */
83
84extern int privconn_connect(conn */*c*/, sel_state */*s*/,
85 int /*i*/, struct in_addr /*bind*/,
86 void (*/*func*/)(int, void *), void */*p*/);
87
88/*----- That's all, folks -------------------------------------------------*/
89
90#ifdef __cplusplus
91 }
92#endif
93
94#endif