12 meshlink_set_log_cb(NULL, MESHLINK_DEBUG, log_cb);
14 // Open a new meshlink instance.
16 assert(meshlink_destroy("basic_conf"));
17 meshlink_handle_t *mesh = meshlink_open("basic_conf", "foo", "basic", DEV_CLASS_BACKBONE);
20 meshlink_set_log_cb(mesh, MESHLINK_DEBUG, log_cb);
22 // Check that our own node exists.
24 meshlink_node_t *self = meshlink_get_self(mesh);
26 assert(!strcmp(self->name, "foo"));
28 // Start and stop the mesh.
30 assert(meshlink_start(mesh));
33 // Make sure we can start and stop the mesh again.
35 assert(meshlink_start(mesh));
38 // Close the mesh and open it again, now with a different name parameter.
41 mesh = meshlink_open("basic_conf", "bar", "basic", DEV_CLASS_BACKBONE);
44 // Check that the name is ignored now, and that we still are "foo".
46 assert(!meshlink_get_node(mesh, "bar"));
47 self = meshlink_get_self(mesh);
49 assert(!strcmp(self->name, "foo"));
51 // Start and stop the mesh.
53 assert(meshlink_start(mesh));
62 assert(meshlink_destroy("basic_conf"));
63 assert(access("basic_conf", F_OK) == -1 && errno == ENOENT);