/*
This file is part of GNUnet.
- Copyright (C) 2013 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2013 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
* Message part, as it arrived from the network.
* @param message_id
* Message counter, monotonically increasing from 1.
+ * @param flags
+ * OR'ed GNUNET_PSYC_MessageFlags
+ * @param fragment_offset
+ * Multicast message fragment offset.
+ * @param tmit_flags
+ * OR'ed GNUNET_PSYC_MasterTransmitFlags
* @param nym
* The sender of the message.
* Can be NULL if the message is not connected to a pseudonym.
- * @param flags
- * OR'ed GNUNET_PSYC_MessageFlags
* @param method_name
* Original method name from PSYC.
* May be more specific than the registered method name due to
*/
typedef void
(*GNUNET_PSYC_MethodCallback) (void *cls,
- const struct GNUNET_PSYC_MessageMethod *msg,
+ const struct GNUNET_PSYC_MessageHeader *msg,
+ const struct GNUNET_PSYC_MessageMethod *meth,
uint64_t message_id,
- uint32_t flags,
- const struct GNUNET_CRYPTO_EcdsaPublicKey *nym_pub_key,
const char *method_name);
* Closure.
* @param message_id
* Message ID this data fragment belongs to.
+ * @param flags
+ * OR'ed GNUNET_PSYC_MessageFlags
+ * @param fragment_offset
+ * Multicast message fragment offset.
* @param msg
* Message part, as it arrived from the network.
* @param oper
*/
typedef void
(*GNUNET_PSYC_ModifierCallback) (void *cls,
- const struct GNUNET_MessageHeader *msg,
+ const struct GNUNET_PSYC_MessageHeader *msg,
+ const struct GNUNET_MessageHeader *pmsg,
uint64_t message_id,
enum GNUNET_PSYC_Operator oper,
const char *name,
*
* @param cls
* Closure.
- * @param message_id
- * Message ID this data fragment belongs to.
* @param msg
* Message part, as it arrived from the network.
- * @param data_offset
- * Byte offset of @a data in the overall data of the method.
- * @param data_size
- * Number of bytes in @a data.
+ * @param message_id
+ * Message ID this data fragment belongs to.
+ * @param flags
+ * OR'ed GNUNET_PSYC_MessageFlags
+ * @param fragment_offset
+ * Multicast message fragment offset.
* @param data
* Data stream given to the method.
+ * @param data_size
+ * Number of bytes in @a data.
* @param end
* End of message?
* #GNUNET_NO if there are further fragments,
*/
typedef void
(*GNUNET_PSYC_DataCallback) (void *cls,
- const struct GNUNET_MessageHeader *msg,
+ const struct GNUNET_PSYC_MessageHeader *msg,
+ const struct GNUNET_MessageHeader *pmsg,
uint64_t message_id,
- uint64_t data_offset,
const void *data,
uint16_t data_size);
* Message part, as it arrived from the network.
* @param message_id
* Message ID this data fragment belongs to.
+ * @param flags
+ * OR'ed GNUNET_PSYC_MessageFlags
+ * @param fragment_offset
+ * Multicast message fragment offset.
* @param cancelled
* #GNUNET_YES if the message was cancelled,
* #GNUNET_NO if the message is complete.
*/
typedef void
(*GNUNET_PSYC_EndOfMessageCallback) (void *cls,
- const struct GNUNET_MessageHeader *msg,
+ const struct GNUNET_PSYC_MessageHeader *msg,
+ const struct GNUNET_MessageHeader *pmsg,
uint64_t message_id,
- uint8_t cancelled);
+ uint8_t is_cancelled);
/**
void
GNUNET_PSYC_slicer_method_add (struct GNUNET_PSYC_Slicer *slicer,
const char *method_name,
+ GNUNET_PSYC_MessageCallback msg_cb,
GNUNET_PSYC_MethodCallback method_cb,
GNUNET_PSYC_ModifierCallback modifier_cb,
GNUNET_PSYC_DataCallback data_cb,
* @param method_name
* Name of the method to remove.
* @param method_cb
- * Method handler.
+ * Only remove matching method handler, or NULL.
* @param modifier_cb
- * Modifier handler.
+ * Only remove matching modifier handler, or NULL.
* @param data_cb
- * Data handler.
+ * Only remove matching data handler, or NULL.
* @param eom_cb
- * End of message handler.
+ * Only remove matching End of Message handler, or NULL.
*
* @return #GNUNET_OK if a method handler was removed,
* #GNUNET_NO if no handler matched the given method name and callbacks.
int
GNUNET_PSYC_slicer_method_remove (struct GNUNET_PSYC_Slicer *slicer,
const char *method_name,
+ GNUNET_PSYC_MessageCallback msg_cb,
GNUNET_PSYC_MethodCallback method_cb,
GNUNET_PSYC_ModifierCallback modifier_cb,
GNUNET_PSYC_DataCallback data_cb,
*/
void
GNUNET_PSYC_slicer_modifier_add (struct GNUNET_PSYC_Slicer *slicer,
- const char *object_filter,
- GNUNET_PSYC_ModifierCallback modifier_cb,
- void *cls);
+ const char *object_filter,
+ GNUNET_PSYC_ModifierCallback modifier_cb,
+ void *cls);
/**
*/
int
GNUNET_PSYC_slicer_modifier_remove (struct GNUNET_PSYC_Slicer *slicer,
- const char *object_filter,
- GNUNET_PSYC_ModifierCallback modifier_cb);
+ const char *object_filter,
+ GNUNET_PSYC_ModifierCallback modifier_cb);
+
+
+/**
+ * Process an incoming message and call matching handlers.
+ *
+ * @param slicer
+ * The slicer to use.
+ * @param msg
+ * The message as it arrived from the network.
+ */
+void
+GNUNET_PSYC_slicer_message (struct GNUNET_PSYC_Slicer *slicer,
+ const struct GNUNET_PSYC_MessageHeader *msg);
/**
* Process an incoming message part and call matching handlers.
*
- * @param cls
- * Closure.
+ * @param slicer
+ * The slicer to use.
* @param message_id
* ID of the message.
* @param flags
* Flags for the message.
* @see enum GNUNET_PSYC_MessageFlags
+ * @param fragment offset
+ * Fragment offset of the message.
* @param msg
- * The message part. as it arrived from the network.
+ * The message part as it arrived from the network.
+ */
+void
+GNUNET_PSYC_slicer_message_part (struct GNUNET_PSYC_Slicer *slicer,
+ const struct GNUNET_PSYC_MessageHeader *msg,
+ const struct GNUNET_MessageHeader *pmsg);
+
+
+/**
+ * Remove all registered method handlers.
+ *
+ * @param slicer
+ * Slicer to clear.
+ */
+void
+GNUNET_PSYC_slicer_method_clear (struct GNUNET_PSYC_Slicer *slicer);
+
+
+/**
+ * Remove all registered modifier handlers.
+ *
+ * @param slicer
+ * Slicer to clear.
+ */
+void
+GNUNET_PSYC_slicer_modifier_clear (struct GNUNET_PSYC_Slicer *slicer);
+
+
+/**
+ * Remove all registered method & modifier handlers.
+ *
+ * @param slicer
+ * Slicer to clear.
*/
void
-GNUNET_PSYC_slicer_message (void *cls,
- const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_pub_key,
- uint64_t message_id,
- uint32_t flags,
- uint64_t fragment_offset,
- const struct GNUNET_MessageHeader *msg);
+GNUNET_PSYC_slicer_clear (struct GNUNET_PSYC_Slicer *slicer);
/**