summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2019-05-29 12:06:49 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2019-05-29 12:45:28 +0200
commit40023ff0b61074cb65ff364945f5dc62e55b3ccd (patch)
tree8f447dd577db6461415adcb0809f4ba256614561
parent8abc82f64787b9316a49a561e4e97a4c2bdf019b (diff)
#915 add og_cmd_legacy_send()
Add function to send legacy command to clients.
-rw-r--r--sources/ogAdmServer.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/sources/ogAdmServer.cpp b/sources/ogAdmServer.cpp
index 204b5b3..970cf2b 100644
--- a/sources/ogAdmServer.cpp
+++ b/sources/ogAdmServer.cpp
@@ -3458,20 +3458,21 @@ static int og_json_parse_clients(json_t *element, struct og_msg_params *params)
return 0;
}
-static int og_cmd_legacy_sondeo(struct og_msg_params *params)
+static int og_cmd_legacy_send(struct og_msg_params *params, const char *cmd,
+ const char *state)
{
char buf[4096] = {};
int len, err = 0;
TRAMA *msg;
- len = snprintf(buf, sizeof(buf), "nfn=Sondeo\r");
+ len = snprintf(buf, sizeof(buf), "nfn=%s\r", cmd);
msg = og_msg_alloc(buf, len);
if (!msg)
return -1;
if (!og_send_cmd((char **)params->ips_array, params->ips_array_len,
- CLIENTE_APAGADO, msg))
+ state, msg))
err = -1;
og_msg_free(msg);
@@ -3496,7 +3497,7 @@ static int og_cmd_post_clients(json_t *element, struct og_msg_params *params)
break;
}
- return og_cmd_legacy_sondeo(params);
+ return og_cmd_legacy_send(params, "Sondeo", CLIENTE_APAGADO);
}
struct og_buffer {