GNUnet  0.20.0
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
46 extern "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 
68 struct GNUNET_REGEX_Search;
69 
70 
85  const char *regex,
87  uint16_t compression);
88 
89 
95 void
97 
98 
109 typedef 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 
130 struct GNUNET_REGEX_Search *
132  const char *string,
134  void *callback_cls);
135 
136 
142 void
144 
145 
146 #if 0 /* keep Emacsens' auto-indent happy */
147 {
148 #endif
149 #ifdef __cplusplus
150 }
151 #endif
152 
153 #endif
154  /* end of group */
156  /* end of group addition */
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
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.
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.
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.