sqlite3_stmt *select_message_fragment;
/**
- * Precompiled SQL for counters_get_master()
+ * Precompiled SQL for counters_get_message()
*/
- sqlite3_stmt *select_counters_master;
+ sqlite3_stmt *select_counters_message;
/**
- * Precompiled SQL for counters_get_slave()
+ * Precompiled SQL for counters_get_state()
*/
- sqlite3_stmt *select_max_state_message_id;
+ sqlite3_stmt *select_counters_state;
/**
* Precompiled SQL for state_modify_end()
&plugin->select_membership);
sql_prepare (plugin->dbh,
- "INSERT INTO messages\n"
+ "INSERT OR IGNORE INTO messages\n"
" (channel_id, hop_counter, signature, purpose,\n"
" fragment_id, fragment_offset, message_id,\n"
" group_generation, multicast_flags, psycstore_flags, data)\n"
"FROM messages\n"
"WHERE channel_id = (SELECT id FROM channels WHERE pub_key = ?)\n"
"ORDER BY fragment_id DESC LIMIT 1;",
- &plugin->select_counters_master);
+ &plugin->select_counters_message);
sql_prepare (plugin->dbh,
"SELECT max_state_message_id\n"
"FROM channels\n"
"WHERE pub_key = ? AND max_state_message_id IS NOT NULL;",
- &plugin->select_max_state_message_id);
+ &plugin->select_counters_state);
sql_prepare (plugin->dbh,
"UPDATE channels\n"
GNUNET_free_non_null (plugin->fn);
}
-/**
+/**
* Execute a prepared statement with a @a channel_key argument.
*
* @param plugin Plugin handle.
* @param stmt Statement to execute.
* @param channel_key Public key of the channel.
- *
+ *
* @return #GNUNET_OK on success, else #GNUNET_SYSERR
*/
static int
exec_channel (struct Plugin *plugin, sqlite3_stmt *stmt,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key)
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key)
{
if (SQLITE_OK != sqlite3_bind_blob (stmt, 1, channel_key,
sizeof (*channel_key), SQLITE_STATIC))
static int
channel_key_store (struct Plugin *plugin,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key)
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key)
{
sqlite3_stmt *stmt = plugin->insert_channel_key;
static int
slave_key_store (struct Plugin *plugin,
- const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key)
+ const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key)
{
sqlite3_stmt *stmt = plugin->insert_slave_key;
}
-/**
+/**
* Store join/leave events for a PSYC channel in order to be able to answer
* membership test queries later.
*
*/
static int
membership_store (void *cls,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
- const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key,
int did_join,
uint64_t announced_at,
uint64_t effective_since,
return GNUNET_OK;
}
-/**
+/**
* Test if a member was admitted to the channel at the given message ID.
*
* @see GNUNET_PSYCSTORE_membership_test()
- *
+ *
* @return #GNUNET_YES if the member was admitted, #GNUNET_NO if not,
* #GNUNET_SYSERR if there was en error.
*/
static int
membership_test (void *cls,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
- const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key,
uint64_t message_id)
{
struct Plugin *plugin = cls;
return ret;
}
-/**
+/**
* Store a message fragment sent to a channel.
*
* @see GNUNET_PSYCSTORE_fragment_store()
- *
+ *
* @return #GNUNET_OK on success, else #GNUNET_SYSERR
*/
static int
fragment_store (void *cls,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
const struct GNUNET_MULTICAST_MessageHeader *msg,
uint32_t psycstore_flags)
{
return GNUNET_OK;
}
-/**
+/**
* Set additional flags for a given message.
*
* They are OR'd with any existing flags set.
- *
+ *
* @return #GNUNET_OK on success, else #GNUNET_SYSERR
*/
static int
message_add_flags (void *cls,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
uint64_t message_id,
uint64_t psycstore_flags)
{
return cb (cb_cls, (void *) msg, sqlite3_column_int64 (stmt, 8));
}
-/**
+/**
* Retrieve a message fragment by fragment ID.
*
* @see GNUNET_PSYCSTORE_fragment_get()
- *
+ *
* @return #GNUNET_OK on success, else #GNUNET_SYSERR
*/
static int
fragment_get (void *cls,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
uint64_t fragment_id,
GNUNET_PSYCSTORE_FragmentCallback cb,
void *cb_cls)
return ret;
}
-/**
+/**
* Retrieve all fragments of a message.
*
* @see GNUNET_PSYCSTORE_message_get()
- *
+ *
* @return #GNUNET_OK on success, else #GNUNET_SYSERR
*/
static int
message_get (void *cls,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
uint64_t message_id,
uint64_t *returned_fragments,
GNUNET_PSYCSTORE_FragmentCallback cb,
return ret;
}
-/**
+/**
* Retrieve a fragment of message specified by its message ID and fragment
* offset.
*
* @see GNUNET_PSYCSTORE_message_get_fragment()
- *
+ *
* @return #GNUNET_OK on success, else #GNUNET_SYSERR
*/
static int
message_get_fragment (void *cls,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
uint64_t message_id,
uint64_t fragment_offset,
GNUNET_PSYCSTORE_FragmentCallback cb,
return ret;
}
-/**
- * Retrieve latest values of counters for a channel master.
+/**
+ * Retrieve the max. values of message counters for a channel.
+ *
+ * @see GNUNET_PSYCSTORE_counters_get()
*
- * @see GNUNET_PSYCSTORE_counters_get_master()
- *
* @return #GNUNET_OK on success, else #GNUNET_SYSERR
*/
static int
-counters_get_master (void *cls,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
- uint64_t *fragment_id,
- uint64_t *message_id,
- uint64_t *group_generation)
+counters_message_get (void *cls,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
+ uint64_t *max_fragment_id,
+ uint64_t *max_message_id,
+ uint64_t *max_group_generation)
{
struct Plugin *plugin = cls;
- sqlite3_stmt *stmt = plugin->select_counters_master;
+ sqlite3_stmt *stmt = plugin->select_counters_message;
int ret = GNUNET_SYSERR;
if (SQLITE_OK != sqlite3_bind_blob (stmt, 1, channel_key,
ret = GNUNET_NO;
break;
case SQLITE_ROW:
- *fragment_id = sqlite3_column_int64 (stmt, 0);
- *message_id = sqlite3_column_int64 (stmt, 1);
- *group_generation = sqlite3_column_int64 (stmt, 2);
+ *max_fragment_id = sqlite3_column_int64 (stmt, 0);
+ *max_message_id = sqlite3_column_int64 (stmt, 1);
+ *max_group_generation = sqlite3_column_int64 (stmt, 2);
ret = GNUNET_OK;
break;
default:
return ret;
}
-/**
- * Retrieve latest values of counters for a channel slave.
+/**
+ * Retrieve the max. values of state counters for a channel.
+ *
+ * @see GNUNET_PSYCSTORE_counters_get()
*
- * @see GNUNET_PSYCSTORE_counters_get_slave()
- *
* @return #GNUNET_OK on success, else #GNUNET_SYSERR
*/
static int
-counters_get_slave (void *cls,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
- uint64_t *max_state_msg_id)
+counters_state_get (void *cls,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
+ uint64_t *max_state_message_id)
{
struct Plugin *plugin = cls;
- sqlite3_stmt *stmt = plugin->select_max_state_message_id;
+ sqlite3_stmt *stmt = plugin->select_counters_state;
int ret = GNUNET_SYSERR;
if (SQLITE_OK != sqlite3_bind_blob (stmt, 1, channel_key,
ret = GNUNET_NO;
break;
case SQLITE_ROW:
- *max_state_msg_id = sqlite3_column_int64 (stmt, 0);
+ *max_state_message_id = sqlite3_column_int64 (stmt, 0);
ret = GNUNET_OK;
break;
default:
}
-/**
+/**
* Set a state variable to the given value.
- *
+ *
* @return #GNUNET_OK on success, else #GNUNET_SYSERR
*/
static int
state_set (struct Plugin *plugin, sqlite3_stmt *stmt,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
const char *name, const void *value, size_t value_size)
{
int ret = GNUNET_SYSERR;
static int
update_message_id (struct Plugin *plugin, sqlite3_stmt *stmt,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
uint64_t message_id)
{
if (SQLITE_OK != sqlite3_bind_int64 (stmt, 1, message_id)
*/
static int
state_modify_begin (void *cls,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
uint64_t message_id, uint64_t state_delta)
{
struct Plugin *plugin = cls;
}
-/**
+/**
* Set the current value of state variable.
*
* @see GNUNET_PSYCSTORE_state_modify()
- *
+ *
* @return #GNUNET_OK on success, else #GNUNET_SYSERR
*/
static int
state_modify_set (void *cls,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
const char *name, const void *value, size_t value_size)
{
struct Plugin *plugin = cls;
*/
static int
state_modify_end (void *cls,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
uint64_t message_id)
{
struct Plugin *plugin = cls;
*/
static int
state_sync_begin (void *cls,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key)
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key)
{
struct Plugin *plugin = cls;
return exec_channel (plugin, plugin->delete_state_sync, channel_key);
}
-/**
+/**
* Set the current value of state variable.
*
* @see GNUNET_PSYCSTORE_state_modify()
- *
+ *
* @return #GNUNET_OK on success, else #GNUNET_SYSERR
*/
static int
state_sync_set (void *cls,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
const char *name, const void *value, size_t value_size)
{
struct Plugin *plugin = cls;
*/
static int
state_sync_end (void *cls,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
uint64_t message_id)
{
struct Plugin *plugin = cls;
}
-/**
+/**
* Reset the state of a channel.
*
* @see GNUNET_PSYCSTORE_state_reset()
- *
+ *
* @return #GNUNET_OK on success, else #GNUNET_SYSERR
*/
static int
-state_reset (void *cls, const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key)
+state_reset (void *cls, const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key)
{
struct Plugin *plugin = cls;
return exec_channel (plugin, plugin->delete_state, channel_key);
}
-/**
+/**
* Update signed values of state variables in the state store.
*
* @see GNUNET_PSYCSTORE_state_hash_update()
- *
+ *
* @return #GNUNET_OK on success, else #GNUNET_SYSERR
*/
static int
state_update_signed (void *cls,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key)
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key)
{
struct Plugin *plugin = cls;
return exec_channel (plugin, plugin->update_state_signed, channel_key);
}
-/**
+/**
* Retrieve a state variable by name.
*
* @see GNUNET_PSYCSTORE_state_get()
- *
+ *
* @return #GNUNET_OK on success, else #GNUNET_SYSERR
*/
static int
-state_get (void *cls, const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+state_get (void *cls, const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
const char *name, GNUNET_PSYCSTORE_StateCallback cb, void *cb_cls)
{
struct Plugin *plugin = cls;
}
-/**
+/**
* Retrieve all state variables for a channel with the given prefix.
*
* @see GNUNET_PSYCSTORE_state_get_prefix()
- *
+ *
* @return #GNUNET_OK on success, else #GNUNET_SYSERR
*/
static int
-state_get_prefix (void *cls, const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+state_get_prefix (void *cls, const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
const char *name, GNUNET_PSYCSTORE_StateCallback cb,
void *cb_cls)
{
}
-/**
+/**
* Retrieve all signed state variables for a channel.
*
* @see GNUNET_PSYCSTORE_state_get_signed()
- *
+ *
* @return #GNUNET_OK on success, else #GNUNET_SYSERR
*/
static int
state_get_signed (void *cls,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
GNUNET_PSYCSTORE_StateCallback cb, void *cb_cls)
{
struct Plugin *plugin = cls;
}
-/**
+/**
* Entry point for the plugin.
*
* @param cls The struct GNUNET_CONFIGURATION_Handle.
api->fragment_get = &fragment_get;
api->message_get = &message_get;
api->message_get_fragment = &message_get_fragment;
- api->counters_get_master = &counters_get_master;
- api->counters_get_slave = &counters_get_slave;
+ api->counters_message_get = &counters_message_get;
+ api->counters_state_get = &counters_state_get;
api->state_modify_begin = &state_modify_begin;
api->state_modify_set = &state_modify_set;
api->state_modify_end = &state_modify_end;