2 This file is part of GNUnet.
3 (C) 2010 Christian Grothoff
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file vpn/gnunet-helper-vpn-api.h
23 * @brief exposes the API (the convenience-functions) of dealing with the
25 * @author Philipp Toelke
27 #ifndef GNUNET_HELPER_VPN_API_H
28 #define GNUNET_HELPER_VPN_API_H
31 * The handle to a helper.
32 * sometimes a few entries may be made opaque.
34 struct GNUNET_VPN_HELPER_Handle
37 * PipeHandle to receive data from the helper
39 struct GNUNET_DISK_PipeHandle *helper_in;
42 * PipeHandle to send data to the helper
44 struct GNUNET_DISK_PipeHandle *helper_out;
47 * FileHandle to receive data from the helper
49 const struct GNUNET_DISK_FileHandle *fh_from_helper;
52 * FileHandle to send data to the helper
54 const struct GNUNET_DISK_FileHandle *fh_to_helper;
57 * The process id of the helper
59 struct GNUNET_OS_Process *helper_proc;
62 * The Message-Tokenizer that tokenizes the messages comming from the helper
64 struct GNUNET_SERVER_MessageStreamTokenizer *mst;
67 * The client-identifier passed to the mst-callback
72 * The name of the interface
77 * The task called when the helper dies.
78 * Will be called with the handle as cls
80 GNUNET_SCHEDULER_Task restart_task;
84 * @brief Starts a helper and begins reading from it
86 * @param ifname The name of the new interface
87 * @param ipv6addr The IPv6 address of the new interface
88 * @param ipv6prefix The IPv6 prefix length of the new IP
89 * @param ipv4addr The IPv4 address of the new interface
90 * @param ipv4mask The associated netmask
91 * @param process_name How the helper should appear in process-listings
92 * @param restart_task The task called when the helper dies. Will be called with the handle as cls
93 * @param cb A callback for messages from the helper
94 * @param cb_cls Closure for the callback
95 * @param client client_name for the callback
97 * @return A pointer to the new Handle, NULL on error
99 struct GNUNET_VPN_HELPER_Handle *start_helper (const char *ifname,
100 const char *ipv6addr,
101 const char *ipv6prefix,
102 const char *ipv4addr,
103 const char *ipv4mask,
104 const char *process_name,
105 GNUNET_SCHEDULER_Task
107 GNUNET_SERVER_MessageTokenizerCallback
112 * @brief Kills the helper, closes the pipe and free()s the handle
114 void cleanup_helper (struct GNUNET_VPN_HELPER_Handle *);
116 #endif /* end of include guard: GNUNET_HELPER_VPN_API_H */