GNUnet 0.22.2
gnunet_regex_service.h
Go to the documentation of this file.
1/*
2 This file is part of GNUnet
3 Copyright (C) 2012, 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 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
39#ifndef GNUNET_REGEX_SERVICE_H
40#define GNUNET_REGEX_SERVICE_H
41
42
43#include "gnunet_util_lib.h"
44
45#ifdef __cplusplus
46extern "C"
47{
48#if 0 /* keep Emacsens' auto-indent happy */
49}
50#endif
51#endif
52
53
57#define GNUNET_REGEX_INITIAL_BYTES 24
58
59
64
69
70
85 const char *regex,
87 uint16_t compression);
88
89
95void
97
98
109typedef void
110(*GNUNET_REGEX_Found)(void *cls,
111 const struct GNUNET_PeerIdentity *id,
112 const struct GNUNET_PeerIdentity *get_path,
113 unsigned int get_path_length,
114 const struct GNUNET_PeerIdentity *put_path,
115 unsigned int put_path_length);
116
117
130struct GNUNET_REGEX_Search *
132 const char *string,
134 void *callback_cls);
135
136
142void
144
145
154void
155GNUNET_REGEX_ipv4toregexsearch (const struct in_addr *ip,
156 uint16_t port,
157 char *rxstr);
158
159
168void
169GNUNET_REGEX_ipv6toregexsearch (const struct in6_addr *ipv6,
170 uint16_t port,
171 char *rxstr);
172
173
183char *
184GNUNET_REGEX_ipv6policy2regex (const char *policy);
185
186
196char *
197GNUNET_REGEX_ipv4policy2regex (const char *policy);
198
199
200#if 0 /* keep Emacsens' auto-indent happy */
201{
202#endif
203#ifdef __cplusplus
204}
205#endif
206
207#endif
208 /* end of group */
210 /* end of group addition */
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:108
static uint16_t port
Port number.
Definition: gnunet-bcd.c:146
static struct GNUNET_IDENTITY_Handle * id
Handle to IDENTITY.
static int ipv6
Option -6: IPv6 requested.
Definition: gnunet-vpn.c:65
struct GNUNET_REGEX_Search * GNUNET_REGEX_search(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *string, GNUNET_REGEX_Found callback, void *callback_cls)
Search for a peer offering a regex matching certain string in the DHT.
char * GNUNET_REGEX_ipv6policy2regex(const char *policy)
Convert an exit policy to a regular expression.
Definition: regex.c:725
void(* GNUNET_REGEX_Found)(void *cls, const struct GNUNET_PeerIdentity *id, const struct GNUNET_PeerIdentity *get_path, unsigned int get_path_length, const struct GNUNET_PeerIdentity *put_path, unsigned int put_path_length)
Search callback function, invoked for every result that was found.
void GNUNET_REGEX_announce_cancel(struct GNUNET_REGEX_Announcement *a)
Stop announcing the regex specified by the given handle.
void GNUNET_REGEX_search_cancel(struct GNUNET_REGEX_Search *s)
Stop search and free all data used by a GNUNET_REGEX_search call.
struct GNUNET_REGEX_Announcement * GNUNET_REGEX_announce(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *regex, struct GNUNET_TIME_Relative refresh_delay, uint16_t compression)
Announce this peer under the given regular expression.
char * GNUNET_REGEX_ipv4policy2regex(const char *policy)
Convert an exit policy to a regular expression.
Definition: regex.c:682
void GNUNET_REGEX_ipv4toregexsearch(const struct in_addr *ip, uint16_t port, char *rxstr)
Create a regex in rxstr from the given ip and port.
Definition: regex.c:37
void GNUNET_REGEX_ipv6toregexsearch(const struct in6_addr *ipv6, uint16_t port, char *rxstr)
Create a regex in rxstr from the given ipv6 and port.
Definition: regex.c:50
The identity of the host (wraps the signing key of the peer).
Handle to store cached data about a regex announce.
char * regex
Message we're sending to the service.
uint16_t compression
Number of characters per edge.
struct GNUNET_TIME_Relative refresh_delay
Frequency of announcements.
Handle to store data about a regex search.
GNUNET_REGEX_Found callback
Function to call with results.
void * callback_cls
Closure for callback.
Time for relative time used by GNUnet, in microseconds.