---
pmc_common.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/pmc_common.c b/pmc_common.c
index c5cd992..c7d8bed 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -57,6 +57,7 @@
static void do_get_action(struct pmc *pmc, int action, int index, char *str);
static void do_set_action(struct pmc *pmc, int action, int index, char *str);
+static void do_cmd_action(struct pmc *pmc, int action, int index, char *str);
static void not_supported(struct pmc *pmc, int action, int index, char *str);
static void null_management(struct pmc *pmc, int action, int index, char *str);
@@ -280,6 +281,31 @@ static void do_set_action(struct pmc *pmc, int action, int
index, char *str)
}
}
+static void do_cmd_action(struct pmc *pmc, int action, int index, char *str)
+{
+ int code = idtab[index].code;
+
+ switch (action) {
+ case COMMAND:
+ break;
+ case GET:
+ case SET:
+ case RESPONSE:
+ case ACKNOWLEDGE:
+ default:
+ fprintf(stderr, "%s only allows COMMAND\n",
+ idtab[index].name);
+ return;
+ }
+/*
+ switch (code) {
+ case TLV_XXXX:
+ pmc_send_cmd_action(pmc, code);
+ break;
+ }
+*/
+}
+
static void not_supported(struct pmc *pmc, int action, int index, char *str)
{
fprintf(stdout, "sorry, %s not supported yet\n", idtab[index].name);
@@ -622,6 +648,31 @@ int pmc_send_set_action(struct pmc *pmc, int id, void
*data, int datasize)
return 0;
}
+int pmc_send_cmd_action(struct pmc *pmc, int id)
+{
+ struct management_tlv *mgt;
+ struct ptp_message *msg;
+ struct tlv_extra *extra;
+
+ msg = pmc_message(pmc, COMMAND);
+ if (!msg) {
+ return -1;
+ }
+ extra = msg_tlv_append(msg, sizeof(*mgt));
+ if (!extra) {
+ msg_put(msg);
+ return -ENOMEM;
+ }
+ mgt = (struct management_tlv *) extra->tlv;
+ mgt->type = TLV_MANAGEMENT;
+ mgt->length = 2;
+ mgt->id = id;
+ pmc_send(pmc, msg);
+ msg_put(msg);
+
+ return 0;
+}
+
struct ptp_message *pmc_recv(struct pmc *pmc)
{
struct ptp_message *msg;
--
2.31.1
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel