fr_io_signal_t error; //!< There was an error on the socket.
fr_io_open_t close; //!< Close the transport.
fr_io_nak_t nak; //!< Function to send a NAK.
+ fr_io_data_cmp_t compare; //!< compare two packets
void *private; //!< any private APIs it needs to export.
} fr_app_io_t;
*/
typedef void (*fr_io_data_vnode_t)(void *instance, uint32_t fflags);
+/** Compare two packets for storing in a duplicate detection tree.
+ *
+ * We presume that the packets are well formed.
+ *
+ * The comparison should be stable. i.e. compare the packets a field
+ * at a time. If the field is different, return the result from that
+ * field.
+ *
+ * The comparison order of the fields should be "very different" to
+ * "much the same". The packets are put into an rbtree, so having a
+ * large fanout at the top is useful.
+ *
+ * Note that this function should not check if the packets are
+ * completely identical. Instead, if checks whether or not the
+ * packets take the same place in any dedup tree.
+ *
+ * @param[in] instance the context for this function
+ * @param[in] packet1 one packet
+ * @param[in] packet2 a second packet
+ * @return
+ * - <0 on packet one "smaller" than packet two
+ * - >0 on packet two "larger" than packet one
+ * - =0 on the two packets being identical
+ */
+typedef int (*fr_io_data_cmp_t)(void const *instance, void const *packet1, void const *packet2);
+
/** Handle a close or error on the socket.
*
* In general, the only thing to do on errors is to close the