X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fmeshlink.h;h=19fd43363ecc622d1201acd162eddde7a4a19a16;hb=1815910fc7409ffea2b386196c4d12af12578f42;hp=36548bf70608b8d6f2ce1ee57c8b3eba3271ccce;hpb=69d248741bba651688b1dd080e93f887b0746f41;p=meshlink diff --git a/src/meshlink.h b/src/meshlink.h index 36548bf7..19fd4336 100644 --- a/src/meshlink.h +++ b/src/meshlink.h @@ -23,6 +23,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + /// A handle for an instance of MeshLink. typedef struct meshlink_handle meshlink_handle_t; @@ -35,11 +39,16 @@ typedef enum { MESHLINK_ENOMEM, // Out of memory MESHLINK_ENOENT, // Node is not known } meshlink_errno_t; +typedef struct outpacketqueue { + meshlink_node_t *destination; + const void *data; + unsigned int len; +} outpacketqueue_t; #ifndef MESHLINK_INTERNAL_H struct meshlink_handle { - meshlink_errno_t errno; /// Code of the last encountered error. + meshlink_errno_t meshlink_errno; /// Code of the last encountered error. const char *errstr; /// Textual representation of most recent error encountered. }; @@ -235,6 +244,16 @@ extern char *meshlink_sign(meshlink_handle_t *mesh, const char *data, size_t len */ extern bool meshlink_verify(meshlink_handle_t *mesh, meshlink_node_t *source, const char *data, size_t len, const char *signature); +/// Add an Address for the local node. +/** This function adds an Address for the local node, which will be used for invitation URLs. + * + * @param mesh A handle which represents an instance of MeshLink. + * @param address A string containing the address, which can be either in numeric format or a hostname. + * + * @return This function returns true if the address was added, false otherwise. + */ +extern bool meshlink_add_address(meshlink_handle_t *mesh, const char *address); + /// Invite another node into the mesh. /** This function generates an invitation that can be used by another node to join the same mesh as the local node. * The generated invitation is a string containing a URL. @@ -294,4 +313,8 @@ extern bool meshlink_import(meshlink_handle_t *mesh, const char *data); */ extern void meshlink_blacklist(meshlink_handle_t *mesh, meshlink_node_t *node); +#ifdef __cplusplus +} +#endif + #endif // MESHLINK_H