X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=test%2Fblackbox%2Futil%2Fgen_invite.c;fp=test%2Fblackbox%2Futil%2Fgen_invite.c;h=beb7401f64af698b46fea14e7a7fc1ba4e2e3a73;hb=4108810af455f463dfbcdac0e2e0b2ba0312bf26;hp=1517be8a615a81c7fb362998195593e08492e6a4;hpb=026aa799bdccd860575e4ce228b750f47abd31e2;p=meshlink diff --git a/test/blackbox/util/gen_invite.c b/test/blackbox/util/gen_invite.c index 1517be8a..beb7401f 100644 --- a/test/blackbox/util/gen_invite.c +++ b/test/blackbox/util/gen_invite.c @@ -24,33 +24,23 @@ #define CMD_LINE_ARG_NODENAME 1 #define CMD_LINE_ARG_INVITEE 2 - -void logger_cb(meshlink_handle_t *mesh, meshlink_log_level_t level, - const char *text) { - (void)mesh; - (void)level; - - fprintf(stderr, "meshlink>> %s\n", text); -} +#define CMD_LINE_ARG_SUBMESH 3 int main(int argc, char *argv[]) { char *invite = NULL; + meshlink_submesh_t *s = NULL; /* Start mesh, generate an invite and print out the invite */ - /* Set up logging for Meshlink */ - meshlink_set_log_cb(NULL, MESHLINK_DEBUG, logger_cb); - - /* Create meshlink instance */ - meshlink_handle_t *mesh = meshlink_open("testconf", argv[1], "node_sim", DEV_CLASS_STATIONARY); - assert(mesh); - - /* Set up logging for Meshlink with the newly acquired Mesh Handle */ - meshlink_set_log_cb(mesh, MESHLINK_DEBUG, logger_cb); - meshlink_enable_discovery(mesh, false); - assert(meshlink_start(mesh)); - invite = meshlink_invite_ex(mesh, NULL, argv[2], MESHLINK_INVITE_LOCAL | MESHLINK_INVITE_NUMERIC); + meshlink_handle_t *mesh = execute_open(argv[CMD_LINE_ARG_NODENAME], "1"); + execute_start(); + + if(argc > CMD_LINE_ARG_SUBMESH) { + s = meshlink_submesh_open(mesh, argv[CMD_LINE_ARG_SUBMESH]); + } + + invite = execute_invite(argv[CMD_LINE_ARG_INVITEE], s); printf("%s\n", invite); - meshlink_close(mesh); + execute_close(); return EXIT_SUCCESS; }