-char *meshlink_invite(meshlink_handle_t *mesh, const char *name) {
- // Check validity of the new node's name
- if(!check_id(name)) {
- fprintf(stderr, "Invalid name for node.\n");
- return NULL;
- }
-
- // Ensure no host configuration file with that name exists
- char filename [PATH_MAX];
- snprintf(filename,PATH_MAX, "%s" SLASH "hosts" SLASH "%s", mesh->confbase, name);
- if(!access(filename, F_OK)) {
- fprintf(stderr, "A host config file for %s already exists!\n", name);
- return NULL;
- }
-
- // If a daemon is running, ensure no other nodes know about this name
-
- //TODO: original tinc code connects to tincd cli and makes this check. How we want to implement this here ?
- //bool found = false;
- //if(connect_tincd(false)) {
- // sendline(fd, "%d %d", CONTROL, REQ_DUMP_NODES);
-
- // while(recvline(fd, line, sizeof line)) {
- // char node[4096];
- // int code, req;
- // if(sscanf(line, "%d %d %s", &code, &req, node) != 3)
- // break;
- // if(!strcmp(node, name))
- // found = true;
- // }
-
- // if(found) {
- // fprintf(stderr, "A node with name %s is already known!\n", name);
- // return 1;
- // }
- //}
-
- char hash[64];