Privileged outgoing connections.
[fwd] / privconn.h
diff --git a/privconn.h b/privconn.h
new file mode 100644 (file)
index 0000000..857f278
--- /dev/null
@@ -0,0 +1,102 @@
+/* -*-c-*-
+ *
+ * $Id: privconn.h,v 1.1 2003/11/29 20:36:07 mdw Exp $
+ *
+ * Making privileged connections
+ *
+ * (c) 2003 Straylight/Edgeware
+ */
+
+/*----- Licensing notice --------------------------------------------------* 
+ *
+ * This file is part of the `fw' port forwarder.
+ *
+ * `fw' is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * `fw' is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with `fw'; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/*----- Revision history --------------------------------------------------* 
+ *
+ * $Log: privconn.h,v $
+ * Revision 1.1  2003/11/29 20:36:07  mdw
+ * Privileged outgoing connections.
+ *
+ */
+
+#ifndef PRIVCONN_H
+#define PRIVCONN_H
+
+#ifdef __cplusplus
+  extern "C" {
+#endif
+
+/*----- Header files ------------------------------------------------------*/
+
+#include <arpa/inet.h>
+
+#include <mLib/conn.h>
+#include <mLib/sel.h>
+
+/*----- Functions provided ------------------------------------------------*/
+
+/* --- @privconn_split@ --- *
+ *
+ * Arguments:  @sel_state *s@ = select state
+ *
+ * Returns:    ---
+ *
+ * Use:                Splits off the privileged binding code into a separate
+ *             process.
+ */
+
+extern void privconn_split(sel_state */*s*/);
+
+/* --- @privconn_adddest@ --- *
+ *
+ * Arguments:  @struct in_addr peer@ = address to connect to
+ *             @unsigned port@ = port to connect to
+ *
+ * Returns:    Index for this destination address, or @-1@ if not
+ *             available.
+ *
+ * Use:                Adds a valid destination for a privileged connection.
+ */
+
+extern int privconn_adddest(struct in_addr /*peer*/, unsigned /*port*/);
+
+/* --- @privconn_connect@ --- *
+ *
+ * Arguments:  @conn *c@ = connection structure to fill in
+ *             @sel_state *s@ = pointer to select state to attach to
+ *             @int i@ = address index to connect to
+ *             @struct in_addr bind@ = address to bind to
+ *             @void (*func)(int, void *)@ = function to call on connect
+ *             @void *p@ = argument for the function
+ *
+ * Returns:    Zero on success, @-1@ on failure.
+ *
+ * Use:                Sets up a privileged connection job.
+ */
+
+extern int privconn_connect(conn */*c*/, sel_state */*s*/,
+                           int /*i*/, struct in_addr /*bind*/,
+                           void (*/*func*/)(int, void *), void */*p*/);
+
+/*----- That's all, folks -------------------------------------------------*/
+
+#ifdef __cplusplus
+  }
+#endif
+
+#endif