16 meshlink_set_log_cb(NULL, MESHLINK_DEBUG, log_cb);
18 // Open a new meshlink instance.
20 assert(meshlink_destroy("basic_conf"));
21 meshlink_handle_t *mesh = meshlink_open("basic_conf", "foo", "basic", DEV_CLASS_BACKBONE);
24 meshlink_set_log_cb(mesh, MESHLINK_DEBUG, log_cb);
26 // Check that our own node exists.
28 meshlink_node_t *self = meshlink_get_self(mesh);
30 assert(!strcmp(self->name, "foo"));
32 // Start and stop the mesh.
34 assert(meshlink_start(mesh));
37 // Make sure we can start and stop the mesh again.
39 assert(meshlink_start(mesh));
42 // Close the mesh and open it again, now with a different name parameter.
45 mesh = meshlink_open("basic_conf", "bar", "basic", DEV_CLASS_BACKBONE);
48 // Check that the name is ignored now, and that we still are "foo".
50 assert(!meshlink_get_node(mesh, "bar"));
51 self = meshlink_get_self(mesh);
53 assert(!strcmp(self->name, "foo"));
55 // Start and stop the mesh.
57 assert(meshlink_start(mesh));
66 assert(meshlink_destroy("basic_conf"));
67 assert(access("basic_conf", F_OK) == -1 && errno == ENOENT);