daba84b4eb1b04769da9a1b99e76c8a98104fbf7
[oweals/gnunet.git] / src / include / gnunet_socks.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2001-2013 GNUnet e.V.
4
5      GNUnet is free software: you can redistribute it and/or modify it
6      under the terms of the GNU Affero General Public License as published
7      by the Free Software Foundation, either version 3 of the License,
8      or (at your option) any later version.
9
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      Affero General Public License for more details.
14 */
15
16 /**
17  * @author Jeffrey Burdges
18  *
19  * @file
20  * SOCKS proxy for connections
21  *
22  * @defgroup socks  SOCKS proxy
23  * SOCKS proxy for connections.
24  * @{
25  */
26
27 #ifndef GNUNET_SOCKS_H
28 #define GNUNET_SOCKS_H
29
30 #ifdef __cplusplus
31 extern "C"
32 {
33 #if 0                           /* keep Emacsens' auto-indent happy */
34 }
35 #endif
36 #endif
37
38 #include "gnunet_common.h"
39
40
41 /**
42  * Check if a SOCKS proxy is required by a service.  Do not use local service
43  * if a SOCKS proxy port is configured as this could deanonymize a user.
44  *
45  * @param service_name name of service to connect to
46  * @param cfg configuration to use
47  * @return GNUNET_YES if so, GNUNET_NO if not
48  */
49 int
50 GNUNET_SOCKS_check_service (const char *service_name,
51                             const struct GNUNET_CONFIGURATION_Handle *cfg);
52
53
54 /**
55  * Try to connect to a service configured to use a SOCKS5 proxy.
56  *
57  * @param service_name name of service to connect to
58  * @param cfg configuration to use
59  * @return Connection handle that becomes usable when the handshake completes.
60  *         NULL if SOCKS not configured or not configured properly
61  */
62 struct GNUNET_CONNECTION_Handle *
63 GNUNET_SOCKS_do_connect (const char *service_name,
64                           const struct GNUNET_CONFIGURATION_Handle *cfg);
65
66
67 #if 0                           /* keep Emacsens' auto-indent happy */
68 {
69 #endif
70 #ifdef __cplusplus
71 }
72 #endif
73
74 /* ifndef GNUNET_SOCKS_H */
75 #endif
76
77 /** @} */  /* end of group */
78
79 /* end of gnunet_socks.h */