X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fsn_network.h;h=f94a2377cc9dc740bdf9e382238e8f26a465ac8e;hb=785cb745f68b61aa83820a4f85a8c91a0e015228;hp=2e92898935e4223128a10fb52c010b0a375c698e;hpb=8be763371ce43036e9e9f43bbecc954d1f90d8b8;p=sort-networks.git diff --git a/src/sn_network.h b/src/sn_network.h index 2e92898..f94a237 100644 --- a/src/sn_network.h +++ b/src/sn_network.h @@ -356,6 +356,20 @@ int sn_network_serialize (sn_network_t *n, char **ret_buffer, */ sn_network_t *sn_network_unserialize (char *buffer, size_t buffer_size); +/** + * Compares two networks and returns zero if they are equal. If they are not + * equal, a number greater than zero or less than zero is returned in a + * consistent matter, so this function can be used to sort networks and detect + * duplicates. It is strongly recommended that you call sn_network_unify() + * before comparing two networks, because they internal structure does matter + * for this function. + * + * \return Zero if the two networks are equal, non-zero otherwise. Return + * values are consistent so this function can be used to sort networks. + * \see sn_network_unify + */ +int sn_network_compare (const sn_network_t *n0, const sn_network_t *n1); + uint64_t sn_network_get_hashval (const sn_network_t *n); #endif /* SN_NETWORK_H */