daemon to restrict incoming connections from other peers at the transport layer of a peer More...
Go to the source code of this file.
Macros | |
#define | LOG(type, ...) GNUNET_log (type, __VA_ARGS__) |
Logging shorthand. More... | |
#define | DEBUG(...) LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__) |
Debug logging shorthand. More... | |
#define | ACCESS_ALLOW 1 |
Allow access from the peers read from the whitelist. More... | |
#define | ACCESS_DENY 0 |
Deny access from the peers read from the blacklist. More... | |
Functions | |
static void | cleanup_map () |
Cleaup and destroy the map. More... | |
static void | do_shutdown (void *cls) |
Shutdown task to cleanup our resources and exit. More... | |
static int | check_access (void *cls, const struct GNUNET_PeerIdentity *pid) |
Function that decides if a connection is acceptable or not. More... | |
static void | setup_ac (const char *fname, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Setup the access control by reading the given file containing peer identities and then establishing blacklist handler with the peer's transport service. More... | |
static void | run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) |
Main function that will be run. More... | |
int | main (int argc, char *const *argv) |
The main function. More... | |
Variables | |
static struct GNUNET_CONTAINER_MultiPeerMap * | map |
The map to store the peer identities to allow/deny. More... | |
static struct GNUNET_PeerIdentity * | ilist |
The array of peer identities we read from whitelist/blacklist. More... | |
static struct GNUNET_TRANSPORT_Blacklist * | bh |
The blacklist handle we obtain from transport when we register ourselves for access control. More... | |
static int | mode |
Are we allowing or denying access from peers. More... | |
daemon to restrict incoming connections from other peers at the transport layer of a peer
Definition in file gnunet-daemon-testbed-blacklist.c.
#define LOG | ( | type, | |
... | |||
) | GNUNET_log (type, __VA_ARGS__) |
Logging shorthand.
Definition at line 37 of file gnunet-daemon-testbed-blacklist.c.
#define DEBUG | ( | ... | ) | LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__) |
Debug logging shorthand.
Definition at line 43 of file gnunet-daemon-testbed-blacklist.c.
#define ACCESS_ALLOW 1 |
Allow access from the peers read from the whitelist.
Definition at line 49 of file gnunet-daemon-testbed-blacklist.c.
#define ACCESS_DENY 0 |
Deny access from the peers read from the blacklist.
Definition at line 54 of file gnunet-daemon-testbed-blacklist.c.
|
static |
Cleaup and destroy the map.
Definition at line 82 of file gnunet-daemon-testbed-blacklist.c.
References GNUNET_CONTAINER_multipeermap_destroy(), and map.
Referenced by do_shutdown(), and setup_ac().
|
static |
Shutdown task to cleanup our resources and exit.
cls | NULL |
Definition at line 98 of file gnunet-daemon-testbed-blacklist.c.
References bh, cleanup_map(), and GNUNET_TRANSPORT_blacklist_cancel().
Referenced by setup_ac().
|
static |
Function that decides if a connection is acceptable or not.
cls | closure |
pid | peer to approve or disapproave |
Definition at line 114 of file gnunet-daemon-testbed-blacklist.c.
References ACCESS_DENY, GNUNET_CONTAINER_multipeermap_contains(), GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, map, mode, and pid.
Referenced by setup_ac().
|
static |
Setup the access control by reading the given file containing peer identities and then establishing blacklist handler with the peer's transport service.
fname | the filename to read the list of peer identities |
cfg | the configuration for connecting to the peer's transport service |
Definition at line 136 of file gnunet-daemon-testbed-blacklist.c.
References bh, cfg, check_access(), cleanup_map(), do_shutdown(), GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_CONTAINER_multipeermap_create(), GNUNET_CONTAINER_multipeermap_put(), GNUNET_DISK_file_size(), GNUNET_DISK_fn_read(), GNUNET_free, GNUNET_malloc_large, GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_shutdown(), GNUNET_SYSERR, GNUNET_TRANSPORT_blacklist(), GNUNET_YES, ilist, and map.
Referenced by run().
|
static |
Main function that will be run.
cls | closure |
args | remaining command-line arguments |
cfgfile | name of the configuration file used (for saving, can be NULL!) |
c | configuration |
Definition at line 184 of file gnunet-daemon-testbed-blacklist.c.
References ACCESS_ALLOW, ACCESS_DENY, GNUNET_asprintf(), GNUNET_break, GNUNET_CONFIGURATION_get_value_filename(), GNUNET_DISK_file_test(), GNUNET_free, GNUNET_OK, GNUNET_YES, mode, and setup_ac().
Referenced by main().
int main | ( | int | argc, |
char *const * | argv | ||
) |
The main function.
argc | number of arguments from the command line |
argv | command line arguments |
Definition at line 234 of file gnunet-daemon-testbed-blacklist.c.
References _, GNUNET_free_nz, GNUNET_GETOPT_OPTION_END, GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_STRINGS_get_utf8_args(), options, ret, and run().
|
static |
The map to store the peer identities to allow/deny.
Definition at line 59 of file gnunet-daemon-testbed-blacklist.c.
Referenced by check_access(), cleanup_map(), and setup_ac().
|
static |
The array of peer identities we read from whitelist/blacklist.
Definition at line 64 of file gnunet-daemon-testbed-blacklist.c.
Referenced by setup_ac().
|
static |
The blacklist handle we obtain from transport when we register ourselves for access control.
Definition at line 70 of file gnunet-daemon-testbed-blacklist.c.
Referenced by do_shutdown(), GNUNET_HELLO_builder_from_block(), and setup_ac().
|
static |
Are we allowing or denying access from peers.
Definition at line 75 of file gnunet-daemon-testbed-blacklist.c.
Referenced by check_access(), and run().