summaryrefslogtreecommitdiff
path: root/src/muniacli.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2020-06-06 18:32:11 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2020-06-06 18:32:11 +0200
commitfa5985ed620c3cd4c7b9712b6b80a2e2c1a8ba31 (patch)
tree39e1eff8ce28467536505d2ca58282492be5b1b5 /src/muniacli.cc
parent9e81fcd4bdb089b8f8a05c6fbb586ec2a2a14924 (diff)
Rename task to node everywhere.
Diffstat (limited to 'src/muniacli.cc')
-rw-r--r--src/muniacli.cc90
1 files changed, 45 insertions, 45 deletions
diff --git a/src/muniacli.cc b/src/muniacli.cc
index 843c028..d6dcc9d 100644
--- a/src/muniacli.cc
+++ b/src/muniacli.cc
@@ -42,12 +42,12 @@
static bool run;
static std::string msgs;
-struct per_session_data__lws_task
+struct per_session_data__lws_node
{
struct lws *wsi;
};
-static int callback_lws_task(struct lws *wsi,
+static int callback_lws_node(struct lws *wsi,
enum lws_callback_reasons reason,
void *user, void *in, size_t len)
{
@@ -98,8 +98,8 @@ static int callback_lws_task(struct lws *wsi,
static struct lws_protocols protocols[] =
{
- { "lws-task-protocol", callback_lws_task,
- sizeof(struct per_session_data__lws_task)
+ { "lws-node-protocol", callback_lws_node,
+ sizeof(struct per_session_data__lws_node)
},
{ nullptr, nullptr, 0 } // End of list
};
@@ -108,7 +108,7 @@ int client(const char *address, int port)
{
// printf("Connection to %s on port %d\n", address, port);
struct lws_context *context;
- struct lws *wsi_task = nullptr;
+ struct lws *wsi_node = nullptr;
int ietf_version = -1; // latest
lws_set_log_level(0, nullptr);
@@ -133,16 +133,16 @@ int client(const char *address, int port)
{
n = lws_service(context, 10);
- if(wsi_task == nullptr)
+ if(wsi_node == nullptr)
{
- wsi_task = lws_client_connect(context, address, port,
+ wsi_node = lws_client_connect(context, address, port,
0, "/", address, address,
- "lws-task-protocol",
+ "lws-node-protocol",
ietf_version);
- if(wsi_task == nullptr)
+ if(wsi_node == nullptr)
{
- fprintf(stderr, "lws task connect failed\n");
+ fprintf(stderr, "lws node connect failed\n");
return -1;
}
else
@@ -179,7 +179,7 @@ static struct option options[] = {
};
static const char* USAGE =
- "Usage: muniacli [OPTION]... TASK COMMAND\n"
+ "Usage: muniacli [OPTION]... NODE COMMAND\n"
"Commandline client to munia."
"Options:\n"
" -p, --port Port on host\n"
@@ -232,7 +232,7 @@ int main(int argc, char** argv)
#if 0
enum demo_protocols {
- PROTOCOL_TASK
+ PROTOCOL_NODE
};
enum cmd_t
@@ -247,7 +247,7 @@ enum cmd_t
static bool run;
static bool interactive;
static std::string msgs;
-static int taskid;
+static int nodeid;
static std::map<int, std::list<int> > structuremap;
static std::map<int, std::string> titlemap;
@@ -316,10 +316,10 @@ static void pretty_print(std::string msgs)
}
}
- rec_pretty_print(taskid);
+ rec_pretty_print(nodeid);
}
-static int callback_task(struct lws_context *me,
+static int callback_node(struct lws_context *me,
struct lws *wsi,
enum lws_callback_reasons reason,
void *user, void *in, size_t len)
@@ -382,14 +382,14 @@ static int callback_task(struct lws_context *me,
static struct lws_protocols protocols[] =
{
- { "lws-task-protocol", callback_task, 0, },
+ { "lws-node-protocol", callback_node, 0, },
{ nullptr, nullptr, 0 }
};
int client(const char *address, int port)
{
struct lws_context *context;
- struct lws *wsi_task = nullptr;
+ struct lws *wsi_node = nullptr;
int ietf_version = -1; // latest
context = lws_create_context(CONTEXT_PORT_NO_LISTEN, nullptr,
@@ -409,16 +409,16 @@ int client(const char *address, int port)
{
n = lws_service(context, 10);
- if (wsi_task == nullptr)
+ if (wsi_node == nullptr)
{
- wsi_task = lws_client_connect(context, address, port,
+ wsi_node = lws_client_connect(context, address, port,
0, "/", address, address,
- protocols[lws-task-protocol].name,
+ protocols[lws-node-protocol].name,
ietf_version);
- if(wsi_task == nullptr)
+ if(wsi_node == nullptr)
{
- fprintf(stderr, "lws task connect failed\n");
+ fprintf(stderr, "lws node connect failed\n");
return -1;
}
@@ -459,28 +459,28 @@ static struct option options[] =
};
static const char* USAGE =
- "Usage: muniacli [OPTION]... TASK COMMAND\n"
+ "Usage: muniacli [OPTION]... NODE COMMAND\n"
"Commandline client to munia."
"Options:\n"
" -p, --port Port on host\n"
" -H, --host Host\n"
" -i, --interactive Run in interactive/shell mode\n"
- "Task:\n"
- " -N, --name Select task by name\n"
- " -I, --id Select task by id\n"
+ "Node:\n"
+ " -N, --name Select node by name\n"
+ " -I, --id Select node by id\n"
"Commands:\n"
- " -C, --create Create new subtask in TASK\n"
- " -L, --list List subtasks in TASK\n"
- " -R, --remove Remove subtask from TASK\n"
- " -U, --update Update data in TASK";
+ " -C, --create Create new subnode in NODE\n"
+ " -L, --list List subnodes in NODE\n"
+ " -R, --remove Remove subnode from NODE\n"
+ " -U, --update Update data in NODE";
int main(int argc, char** argv)
{
int port = 7681;
std::string host = "localhost";
- std::string taskbyid;
- std::string taskbyname;
+ std::string nodebyid;
+ std::string nodebyname;
cmd_t cmd = DEFAULT;
std::string cmd_opts;
@@ -510,10 +510,10 @@ int main(int argc, char** argv)
fprintf(stderr, "%s\n", USAGE);
exit(1);
case 'N':
- taskbyname = optarg;
+ nodebyname = optarg;
break;
case 'I':
- taskbyid = optarg;
+ nodebyid = optarg;
break;
case 'C':
cmd = CREATE;
@@ -537,38 +537,38 @@ int main(int argc, char** argv)
exit(1);
}
- if(!interactive && !taskbyname.empty())
+ if(!interactive && !nodebyname.empty())
{
- taskbyid = -1;
+ nodebyid = -1;
fprintf(stderr, "Option '-N, --name' is not yet supported\n");
fprintf(stderr, "%s\n", USAGE);
exit(1);
}
- if(!interactive && taskbyid.empty())
+ if(!interactive && nodebyid.empty())
{
fprintf(stderr, "%s\n", USAGE);
exit(1);
}
- taskid = atoi(taskbyid.c_str());
+ nodeid = atoi(nodebyid.c_str());
switch(cmd)
{
case CREATE:
- msgs = "subscribe " + taskbyid + ";";
- msgs += "create " + taskbyid + ";";
+ msgs = "subscribe " + nodebyid + ";";
+ msgs += "create " + nodebyid + ";";
break;
case LIST:
- msgs = "subscribe " + taskbyid + ";"; //+
- // "; unsubscribe " + task + ";";
+ msgs = "subscribe " + nodebyid + ";"; //+
+ // "; unsubscribe " + node + ";";
break;
case REMOVE:
- msgs = "remove " + taskbyid + ";";
+ msgs = "remove " + nodebyid + ";";
break;
case UPDATE:
- msgs = "subscribe " + taskbyid + ";";
- msgs += "update " + taskbyid + " \"" + cmd_opts + "\"; ";
+ msgs = "subscribe " + nodebyid + ";";
+ msgs += "update " + nodebyid + " \"" + cmd_opts + "\"; ";
break;
case DEFAULT:
break;