1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
/*
This file is part of GNUnet.
(C) 2010 Christian Grothoff
GNUnet 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 3, or (at your
option) any later version.
GNUnet 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 GNUnet; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/**
* @file vpn/gnunet-helper-vpn-api.h
* @brief exposes the API (the convenience-functions) of dealing with the
* helper-vpn
* @author Philipp Toelke
*/
#ifndef GNUNET_HELPER_VPN_API_H
#define GNUNET_HELPER_VPN_API_H
/**
* The handle to a helper.
* sometimes a few entries may be made opaque.
*/
struct GNUNET_VPN_HELPER_Handle
{
/**
* PipeHandle to receive data from the helper
*/
struct GNUNET_DISK_PipeHandle *helper_in;
/**
* PipeHandle to send data to the helper
*/
struct GNUNET_DISK_PipeHandle *helper_out;
/**
* FileHandle to receive data from the helper
*/
const struct GNUNET_DISK_FileHandle *fh_from_helper;
/**
* FileHandle to send data to the helper
*/
const struct GNUNET_DISK_FileHandle *fh_to_helper;
/**
* The process id of the helper
*/
struct GNUNET_OS_Process *helper_proc;
/**
* The Message-Tokenizer that tokenizes the messages comming from the helper
*/
struct GNUNET_SERVER_MessageStreamTokenizer *mst;
/**
* The client-identifier passed to the mst-callback
*/
void *client;
/**
* The name of the interface
*/
char *ifname;
/**
* The task called when the helper dies.
* Will be called with the handle as cls
*/
GNUNET_SCHEDULER_Task restart_task;
};
/**
* @brief Starts a helper and begins reading from it
*
* @param ifname The name of the new interface
* @param ipv6addr The IPv6 address of the new interface
* @param ipv6prefix The IPv6 prefix length of the new IP
* @param ipv4addr The IPv4 address of the new interface
* @param ipv4mask The associated netmask
* @param process_name How the helper should appear in process-listings
* @param restart_task The task called when the helper dies. Will be called with the handle as cls
* @param cb A callback for messages from the helper
* @param cb_cls Closure for the callback
*
* @return A pointer to the new Handle, NULL on error
*/
struct GNUNET_VPN_HELPER_Handle *
start_helper (const char *ifname, const char *ipv6addr, const char *ipv6prefix,
const char *ipv4addr, const char *ipv4mask,
const char *process_name, GNUNET_SCHEDULER_Task restart_task,
GNUNET_SERVER_MessageTokenizerCallback cb, void *cb_cls);
/**
* @brief Kills the helper, closes the pipe and free()s the handle
*/
void
cleanup_helper (struct GNUNET_VPN_HELPER_Handle *);
#endif /* end of include guard: GNUNET_HELPER_VPN_API_H */
|