4 #include "meshlink++.h"
8 int main(int argc, char *argv[]) {
9 // Open a new meshlink instance.
12 mesh.open("basicpp_conf", "foo", "basicpp", DEV_CLASS_BACKBONE);
14 // Check that our own node exists.
16 meshlink::node *self = mesh.get_node("foo");
18 cerr << "Foo does not know about itself\n";
21 if(strcmp(self->name, "foo")) {
22 cerr << "Foo thinks its name is " << self->name << "\n";
26 // Start and stop the mesh.
29 cerr << "Foo could not start\n";
34 // Make sure we can start and stop the mesh again.
37 cerr << "Foo could not start twice\n";
42 // Close the mesh and open it again, now with a different name parameter.
46 // Check that the name is ignored now, and that we still are "foo".
48 mesh.open("basic_conf", "bar", "basicpp", DEV_CLASS_BACKBONE);
50 if(mesh.get_node("bar")) {
51 cerr << "Foo knows about bar, it shouldn't\n";
55 self = mesh.get_node("foo");
57 cerr << "Foo doesn't know about itself the second time\n";
60 if(strcmp(self->name, "foo")) {
61 cerr << "Foo thinks its name is " << self->name << " the second time\n";
65 // Start and stop the mesh.
68 cerr << "Foo could not start a third time\n";