17 meshlink_set_log_cb(NULL, MESHLINK_DEBUG, log_cb);
19 // Open a new meshlink instance.
21 assert(meshlink_destroy("basic_conf"));
22 meshlink_handle_t *mesh = meshlink_open("basic_conf", "foo", "basic", DEV_CLASS_BACKBONE);
25 // Check that we can't open a second instance of the same node.
27 meshlink_handle_t *mesh2 = meshlink_open("basic_conf", "foo", "basic", DEV_CLASS_BACKBONE);
30 // Check that we cannot destroy an instance that is in use.
32 assert(!meshlink_destroy("basic_conf"));
34 // Check that our own node exists.
36 meshlink_node_t *self = meshlink_get_self(mesh);
38 assert(!strcmp(self->name, "foo"));
40 // Start and stop the mesh.
42 assert(meshlink_start(mesh));
45 // Make sure we can start and stop the mesh again.
47 assert(meshlink_start(mesh));
50 // Close the mesh and open it again, now with a different name parameter.
53 mesh = meshlink_open("basic_conf", "bar", "basic", DEV_CLASS_BACKBONE);
56 // Check that the name is ignored now, and that we still are "foo".
58 assert(!meshlink_get_node(mesh, "bar"));
59 self = meshlink_get_self(mesh);
61 assert(!strcmp(self->name, "foo"));
63 // Start and stop the mesh.
65 assert(meshlink_start(mesh));
71 assert(meshlink_destroy("basic_conf"));
73 // Check that the configuration directory is completely empty.
75 DIR *dir = opendir("basic_conf");
79 while((ent = readdir(dir))) {
80 assert(!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, ".."));