namecache for the GNUnet naming system More...
#include "gnunet_util_lib.h"#include "gnunet_statistics_service.h"#include "gnunet_namecache_plugin.h"#include "namecache.h"Go to the source code of this file.
Data Structures | |
| struct | NamecacheClient |
| A namecache client. More... | |
| struct | LookupBlockContext |
| Context for name lookups passed from handle_lookup_block to handle_lookup_block_it as closure. More... | |
Macros | |
| #define | LOG_STRERROR_FILE(kind, syscall, filename) |
Variables | |
| static const struct GNUNET_CONFIGURATION_Handle * | GSN_cfg |
| Configuration handle. | |
| static struct GNUNET_STATISTICS_Handle * | statistics |
| Handle to the statistics service. | |
| static struct GNUNET_NAMECACHE_PluginFunctions * | GSN_database |
| Database handle. | |
| static char * | db_lib_name |
| Name of the database plugin. | |
namecache for the GNUnet naming system
Definition in file gnunet-service-namecache.c.
| #define LOG_STRERROR_FILE | ( | kind, | |
| syscall, | |||
| filename | |||
| ) |
Definition at line 32 of file gnunet-service-namecache.c.
|
static |
Task run during shutdown.
| cls | unused |
Definition at line 82 of file gnunet-service-namecache.c.
References db_lib_name, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_NO, GNUNET_PLUGIN_unload(), GNUNET_STATISTICS_destroy(), GSN_database, and statistics.
|
static |
Called whenever a client is disconnected.
Frees our resources associated with that client.
| cls | closure |
| client | identification of the client |
| app_ctx | the struct NamecacheClient for this client |
Definition at line 109 of file gnunet-service-namecache.c.
References NamecacheClient::client, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, and nc.
|
static |
Add a client to our list of active clients.
| cls | NULL |
| client | client to add |
| mq | queue to talk to client |
Definition at line 131 of file gnunet-service-namecache.c.
References NamecacheClient::client, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_new, mq, and nc.
|
static |
A GNUNET_NAMECACHE_BlockCallback for name lookups in handle_lookup_block.
| cls | a struct LookupNameContext * with information about the request |
| block | the block |
Definition at line 177 of file gnunet-service-namecache.c.
References bsize, env, LookupBlockResponseMessage::expire, LookupBlockResponseMessage::gns_header, GNUNET_ERROR_TYPE_DEBUG, GNUNET_GNSRECORD_block_get_expiration(), GNUNET_GNSRECORD_block_get_size(), GNUNET_log, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_NAMECACHE_LOOKUP_BLOCK_RESPONSE, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_TIME_absolute_hton(), NamecacheClient::mq, LookupBlockContext::nc, GNUNET_NAMECACHE_Header::r_id, LookupBlockContext::request_id, and statistics.
Referenced by handle_lookup_block().
|
static |
Handles a GNUNET_MESSAGE_TYPE_NAMECACHE_LOOKUP_BLOCK message.
| cls | a struct NamecacheClient * |
| ln_msg | the inbound message |
Definition at line 213 of file gnunet-service-namecache.c.
References GNUNET_NAMECACHE_PluginFunctions::cls, env, LookupBlockMessage::gns_header, LookupBlockResponseMessage::gns_header, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MESSAGE_TYPE_NAMECACHE_LOOKUP_BLOCK_RESPONSE, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_NO, GNUNET_OK, GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), GNUNET_STATISTICS_update(), GNUNET_SYSERR, GSN_database, handle_lookup_block_it(), GNUNET_NAMECACHE_PluginFunctions::lookup_block, nc, LookupBlockContext::nc, LookupBlockMessage::query, GNUNET_NAMECACHE_Header::r_id, LookupBlockContext::request_id, ret, statistics, and LookupBlockContext::status.
|
static |
Check a GNUNET_MESSAGE_TYPE_NAMECACHE_BLOCK_CACHE message.
| cls | our struct NamecacheClient |
| rp_msg | message to process |
Definition at line 267 of file gnunet-service-namecache.c.
References GNUNET_OK.
|
static |
Handles a GNUNET_MESSAGE_TYPE_NAMECACHE_BLOCK_CACHE message.
| cls | our struct NamecacheClient |
| rp_msg | message to process |
Definition at line 281 of file gnunet-service-namecache.c.
References GNUNET_NAMECACHE_PluginFunctions::cache_block, GNUNET_NAMECACHE_PluginFunctions::cls, env, BlockCacheMessage::gns_header, BlockCacheResponseMessage::gns_header, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_malloc, GNUNET_MESSAGE_TYPE_NAMECACHE_BLOCK_CACHE_RESPONSE, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_NO, GNUNET_SERVICE_client_continue(), GNUNET_STATISTICS_update(), GSN_database, GNUNET_NAMECACHE_Header::header, nc, BlockCacheResponseMessage::op_result, GNUNET_NAMECACHE_Header::r_id, res, GNUNET_MessageHeader::size, statistics, and GNUNET_GNSRECORD_Block::type.
|
static |
Process namecache requests.
| cls | closure |
| cfg | configuration to use |
| service | the initialized service |
Definition at line 323 of file gnunet-service-namecache.c.
References cfg, cleanup_task, db_lib_name, GNUNET_asprintf(), GNUNET_CONFIGURATION_get_value_string(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_OK, GNUNET_OS_project_data_gnunet(), GNUNET_PLUGIN_load(), GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_STATISTICS_create(), GSN_cfg, GSN_database, and statistics.
| GNUNET_SERVICE_MAIN | ( | GNUNET_OS_project_data_gnunet() | , |
| "namecache" | , | ||
| GNUNET_SERVICE_OPTION_NONE | , | ||
| & | run, | ||
| & | client_connect_cb, | ||
| & | client_disconnect_cb, | ||
| NULL | , | ||
| GNUNET_MQ_hd_fixed_size(lookup_block, GNUNET_MESSAGE_TYPE_NAMECACHE_LOOKUP_BLOCK, struct LookupBlockMessage, NULL) | , | ||
| GNUNET_MQ_hd_var_size(block_cache, GNUNET_MESSAGE_TYPE_NAMECACHE_BLOCK_CACHE, struct BlockCacheMessage, NULL) | , | ||
| GNUNET_MQ_handler_end() | |||
| ) |
Define "main" method using service macro.
|
static |
Configuration handle.
Definition at line 58 of file gnunet-service-namecache.c.
Referenced by run().
|
static |
Handle to the statistics service.
Definition at line 63 of file gnunet-service-namecache.c.
Referenced by cleanup_task(), handle_block_cache(), handle_lookup_block(), handle_lookup_block_it(), and run().
|
static |
Database handle.
Definition at line 68 of file gnunet-service-namecache.c.
Referenced by cleanup_task(), handle_block_cache(), handle_lookup_block(), and run().
|
static |
Name of the database plugin.
Definition at line 73 of file gnunet-service-namecache.c.
Referenced by cleanup_task(), run(), and run().