- /// Initialize MeshLink's configuration directory.
- /** This function causes MeshLink to initialize its configuration directory,
- * if it hasn't already been initialized.
- * It only has to be run the first time the application starts,
- * but it is not a problem if it is run more than once, as long as
- * the arguments given are the same.
- *
- * This function does not start any network I/O yet. The application should
- * first set callbacks, and then call meshlink_start().
- *
- * @param confbase The directory in which MeshLink will store its configuration files.
- * @param name The name which this instance of the application will use in the mesh.
- *
- * @return This function will return a pointer to a meshlink::mesh if MeshLink has succesfully set up its configuration files, NULL otherwise.
- */
- template<class MESH>
- static MESH* open(const char *confbase, const char *name) {
- void* mp = (void *)meshlink_open_with_size(confbase, name, sizeof(MESH));
- return new (mp) MESH;
- }
-
- /// Close the MeshLink handle.
- /** This function calls meshlink_stop() if necessary,
- * and frees all memory allocated by MeshLink.
- * Afterwards, the handle and any pointers to a struct meshlink_node are invalid.
- */
- static void close(mesh *mesh) {
- meshlink_close(mesh);
- }
-