}
+meshlink_connection_t* meshlink_open_rchannel(meshlink_handle_t *mesh, meshlink_node_t *destination, uint16_t dport) {
+
+//TODO: check in mesh->socketsbitmap for a free descriptor and allocate a source port for this connection
+
+//TODO: register a callback for the data that will be received from this connection
+
+//TODO: return a description value that the user will use to write on this channel
+
+}
+
static void __attribute__((constructor)) meshlink_init(void) {
crypto_init();
}
/// A handle for a MeshLink node.
typedef struct meshlink_node meshlink_node_t;
+typedef struct meshlink_connection meshlink_connection_t;
+
/// Code of most recent error encountered.
typedef enum {
MESHLINK_OK, ///< Everything is fine
void *priv; ///< Private pointer which the application can set at will.
};
+struct meshlink_connection {
+ uint16_t sd;
+};
+
#endif // MESHLINK_INTERNAL_H
/// Get the text for the given MeshLink error code.
*/
extern void meshlink_blacklist(meshlink_handle_t *mesh, meshlink_node_t *node);
+/// Open a channel to destination node for reliable data delivery
+extern meshlink_connection_t* meshlink_open_rchannel(meshlink_handle_t *mesh, meshlink_node_t *destination, uint16_t dport);
+
#ifdef __cplusplus
}
#endif
unsigned int len;
} outpacketqueue_t;
+struct meshlink_connection {
+ uint16_t sd;
+ outpacketqueue_t packetwindow;
+};
+
/// A handle for an instance of MeshLink.
struct meshlink_handle {
char *confbase;
struct list_t *outpacketqueue;
+ uint16_t socketsbitmap; //bitmap of 16 bits
+
int contradicting_add_edge;
int contradicting_del_edge;
int sleeptime;