Advertise capabilities via RegEx and discover respective peers using matching strings. More...
Macros | |
#define | GNUNET_REGEX_INITIAL_BYTES 24 |
Constant for how many bytes the initial string regex should have. More... | |
Typedefs | |
typedef 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. More... | |
Functions | |
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. More... | |
void | GNUNET_REGEX_announce_cancel (struct GNUNET_REGEX_Announcement *a) |
Stop announcing the regex specified by the given handle. More... | |
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. More... | |
void | GNUNET_REGEX_search_cancel (struct GNUNET_REGEX_Search *s) |
Stop search and free all data used by a GNUNET_REGEX_search call. More... | |
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. More... | |
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. More... | |
char * | GNUNET_REGEX_ipv6policy2regex (const char *policy) |
Convert an exit policy to a regular expression. More... | |
char * | GNUNET_REGEX_ipv4policy2regex (const char *policy) |
Convert an exit policy to a regular expression. More... | |
Advertise capabilities via RegEx and discover respective peers using matching strings.
#define GNUNET_REGEX_INITIAL_BYTES 24 |
Constant for how many bytes the initial string regex should have.
Definition at line 57 of file gnunet_regex_service.h.
typedef 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.
cls | Closure provided in GNUNET_REGEX_search. |
id | Peer providing a regex that matches the string. |
get_path | Path of the get request. |
get_path_length | Length of get_path. |
put_path | Path of the put request. |
put_path_length | Length of the put_path. |
Definition at line 109 of file gnunet_regex_service.h.
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.
Does not free resources, must call GNUNET_REGEX_announce_cancel for that.
cfg | configuration to use |
regex | Regular expression to announce. |
refresh_delay | after what delay should the announcement be repeated? |
compression | How many characters per edge can we squeeze? |
Announce this peer under the given regular expression.
cfg | configuration to use |
regex | Regular expression to announce. |
refresh_delay | after what delay should the announcement be repeated? |
compression | How many characters per edge can we squeeze? |
Definition at line 139 of file regex_api_announce.c.
References _, announce_reconnect(), cfg, GNUNET_REGEX_Announcement::cfg, GNUNET_REGEX_Announcement::compression, GNUNET_break, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_MAX_MESSAGE_SIZE, GNUNET_new, GNUNET_strdup, GNUNET_REGEX_Announcement::mq, GNUNET_REGEX_Announcement::refresh_delay, and GNUNET_REGEX_Announcement::regex.
Referenced by run().
void GNUNET_REGEX_announce_cancel | ( | struct GNUNET_REGEX_Announcement * | a | ) |
Stop announcing the regex specified by the given handle.
a | handle returned by a previous GNUNET_REGEX_announce call. |
Definition at line 173 of file regex_api_announce.c.
References GNUNET_free, GNUNET_MQ_destroy(), GNUNET_REGEX_Announcement::mq, and GNUNET_REGEX_Announcement::regex.
Referenced by cleanup().
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.
The search runs until GNUNET_REGEX_search_cancel is called, even if results are returned.
cfg | configuration to use |
string | String to match against the regexes in the DHT. |
callback | Callback for found peers. |
callback_cls | Closure for callback . |
Definition at line 189 of file regex_api_search.c.
References _, GNUNET_REGEX_Search::callback, GNUNET_REGEX_Search::callback_cls, cfg, GNUNET_REGEX_Search::cfg, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_MAX_MESSAGE_SIZE, GNUNET_new, GNUNET_strdup, LOG, GNUNET_REGEX_Search::mq, search_reconnect(), and GNUNET_REGEX_Search::string.
Referenced by create_channel_to_destination().
void GNUNET_REGEX_search_cancel | ( | struct GNUNET_REGEX_Search * | s | ) |
Stop search and free all data used by a GNUNET_REGEX_search call.
s | Handle returned by a previous GNUNET_REGEX_search call. |
Definition at line 225 of file regex_api_search.c.
References GNUNET_free, GNUNET_MQ_destroy(), GNUNET_REGEX_Search::mq, and GNUNET_REGEX_Search::string.
Referenced by free_channel_state(), and handle_regex_result().
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.
ip | IPv4 representation. |
port | destination port |
rxstr | generated regex, must be at least GNUNET_TUN_IPV4_REGEXLEN bytes long. |
Definition at line 37 of file regex.c.
References GNUNET_snprintf(), GNUNET_TUN_IPV4_REGEXLEN, and port.
Referenced by create_channel_to_destination().
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.
ipv6 | IPv6 representation. |
port | destination port |
rxstr | generated regex, must be at least GNUNET_TUN_IPV6_REGEXLEN bytes long. |
Definition at line 50 of file regex.c.
References GNUNET_snprintf(), GNUNET_TUN_IPV6_REGEXLEN, ipv6, and port.
Referenced by create_channel_to_destination().
char * GNUNET_REGEX_ipv6policy2regex | ( | const char * | policy | ) |
Convert an exit policy to a regular expression.
The exit policy specifies a set of subnets this peer is willing to serve as an exit for; the resulting regular expression will match the IPv6 address strings as returned by GNUNET_REGEX_ipv6toregexsearch.
policy | exit policy specification |
Definition at line 725 of file regex.c.
References GNUNET_asprintf(), GNUNET_free, GNUNET_STRINGS_parse_ipv6_policy(), ipv6_to_regex(), line, GNUNET_STRINGS_IPv6NetworkPolicy::network, and zero.
Referenced by run().
char * GNUNET_REGEX_ipv4policy2regex | ( | const char * | policy | ) |
Convert an exit policy to a regular expression.
The exit policy specifies a set of subnets this peer is willing to serve as an exit for; the resulting regular expression will match the IPv4 address strings as returned by GNUNET_REGEX_ipv4toregexsearch.
policy | exit policy specification |
Definition at line 682 of file regex.c.
References GNUNET_asprintf(), GNUNET_free, GNUNET_STRINGS_parse_ipv4_policy(), ipv4_to_regex(), line, and GNUNET_STRINGS_IPv4NetworkPolicy::network.
Referenced by run().