diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-08-22 13:41:23 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-08-22 13:41:23 +0000 |
commit | 802a9598bed7f149466072f6e6834559bab2cd2e (patch) | |
tree | fc2e6c81d202299b45725831966af818428d05d8 /src/transport/plugin_transport_http_common.h | |
parent | 014487cd170b00d258264cc86392b8d91bdf0616 (diff) | |
download | gnunet-802a9598bed7f149466072f6e6834559bab2cd2e.tar.gz gnunet-802a9598bed7f149466072f6e6834559bab2cd2e.zip |
changes
Diffstat (limited to 'src/transport/plugin_transport_http_common.h')
-rw-r--r-- | src/transport/plugin_transport_http_common.h | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/src/transport/plugin_transport_http_common.h b/src/transport/plugin_transport_http_common.h new file mode 100644 index 000000000..b29801d24 --- /dev/null +++ b/src/transport/plugin_transport_http_common.h | |||
@@ -0,0 +1,85 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Christian Grothoff (and other contributing authors) | ||
4 | |||
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. | ||
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 | General Public License for more details. | ||
14 | |||
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. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file transport/plugin_transport_http_common.c | ||
23 | * @brief functionality shared by http client and server transport service plugin | ||
24 | * @author Matthias Wachs | ||
25 | */ | ||
26 | |||
27 | #include "platform.h" | ||
28 | #include "gnunet_common.h" | ||
29 | |||
30 | /** | ||
31 | * Convert the transports address to a nice, human-readable | ||
32 | * format. | ||
33 | * | ||
34 | * @param cls closure | ||
35 | * @param type name of the transport that generated the address | ||
36 | * @param addr one of the addresses of the host, NULL for the last address | ||
37 | * the specific address format depends on the transport | ||
38 | * @param addrlen length of the address | ||
39 | * @param numeric should (IP) addresses be displayed in numeric form? | ||
40 | * @param timeout after how long should we give up? | ||
41 | * @param asc function to call on each string | ||
42 | * @param asc_cls closure for asc | ||
43 | */ | ||
44 | void | ||
45 | http_common_plugin_address_pretty_printer (void *cls, const char *type, | ||
46 | const void *addr, size_t addrlen, | ||
47 | int numeric, | ||
48 | struct GNUNET_TIME_Relative timeout, | ||
49 | GNUNET_TRANSPORT_AddressStringCallback | ||
50 | asc, void *asc_cls); | ||
51 | |||
52 | /** | ||
53 | * Function called for a quick conversion of the binary address to | ||
54 | * a numeric address. Note that the caller must not free the | ||
55 | * address and that the next call to this function is allowed | ||
56 | * to override the address again. | ||
57 | * | ||
58 | * @param cls closure | ||
59 | * @param addr binary address | ||
60 | * @param addrlen length of the address | ||
61 | * @return string representing the same address | ||
62 | */ | ||
63 | const char * | ||
64 | http_common_plugin_address_to_string (void *cls, const void *addr, size_t addrlen); | ||
65 | |||
66 | /** | ||
67 | * Function called to convert a string address to | ||
68 | * a binary address. | ||
69 | * | ||
70 | * @param cls closure ('struct Plugin*') | ||
71 | * @param addr string address | ||
72 | * @param addrlen length of the address | ||
73 | * @param buf location to store the buffer | ||
74 | * If the function returns GNUNET_SYSERR, its contents are undefined. | ||
75 | * @param added length of created address | ||
76 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | ||
77 | */ | ||
78 | int | ||
79 | http_common_plugin_string_to_address (void *cls, | ||
80 | const char *addr, | ||
81 | uint16_t addrlen, | ||
82 | void **buf, | ||
83 | size_t *added); | ||
84 | |||
85 | /* end of plugin_transport_http_common.c */ | ||