]> git.meshlink.io Git - meshlink/blobdiff - src/meshlink.h
Merge branch 'address_hint_api' into discovery
[meshlink] / src / meshlink.h
index b3059c39a73c50bab102f92b57647bd37847d92b..8a101741635ba4f60f7bec8be3ce3e1e8012dbda 100644 (file)
@@ -44,8 +44,15 @@ typedef struct meshlink_channel meshlink_channel_t;
 /// Code of most recent error encountered.
 typedef enum {
        MESHLINK_OK,     ///< Everything is fine
+       MESHLINK_EINVAL, ///< Invalid parameter(s) to function call
        MESHLINK_ENOMEM, ///< Out of memory
        MESHLINK_ENOENT, ///< Node is not known
+       MESHLINK_EEXIST, ///< Node already exists
+       MESHLINK_EINTERNAL, ///< MeshLink internal error
+       MESHLINK_ERESOLV, ///< MeshLink could not resolve a hostname
+       MESHLINK_ESTORAGE, ///< MeshLink coud not load or write data from/to disk
+       MESHLINK_ENETWORK, ///< MeshLink encountered a network error
+       MESHLINK_EPEER, ///< A peer caused an error
 } meshlink_errno_t;
 
 /// A variable holding the last encountered error from MeshLink.
@@ -59,6 +66,8 @@ extern __thread meshlink_errno_t meshlink_errno;
 #ifndef MESHLINK_INTERNAL_H
 
 struct meshlink_handle {
+       const char *name;
+       void *priv;
 };
 
 struct meshlink_node {
@@ -268,6 +277,18 @@ extern ssize_t meshlink_get_pmtu(meshlink_handle_t *mesh, meshlink_node_t *desti
  */
 extern meshlink_node_t *meshlink_get_node(meshlink_handle_t *mesh, const char *name);
 
+/// Get the fingerprint of a node's public key.
+/** This function returns a fingerprint of the node's public key.
+ *  It should be treated as an opaque blob.
+ *
+ *  @param mesh         A handle which represents an instance of MeshLink.
+ *  @param node         A pointer to a meshlink_node_t describing the node.
+ *
+ *  @return            A nul-terminated C string containing the fingerprint of the node's public key in a printable ASCII format.
+ *                      The application should call free() after it is done using this string.
+ */
+extern char *meshlink_get_fingerprint(meshlink_handle_t *mesh, meshlink_node_t *node);
+
 /// Get a list of all nodes.
 /** This function returns a list with handles for all known nodes.
  *