From: Vincent Cheng <vsch...@gmail.com>

Signed-off-by: Vincent Cheng <vsch...@gmail.com>
---
 unicast_client.c | 20 ++++++++++++++++++++
 unicast_client.h |  8 ++++++++
 2 files changed, 28 insertions(+)

diff --git a/unicast_client.c b/unicast_client.c
index 0843554..ef7fc5c 100644
--- a/unicast_client.c
+++ b/unicast_client.c
@@ -649,3 +649,23 @@ out:
        msg_put(msg);
        return err;
 }
+
+int unicast_client_delay_response_granted(struct port *p)
+{
+       struct unicast_master_address *ucma;
+
+       if (!unicast_client_enabled(p)) {
+               return 1;
+       }
+
+       if (p->best == NULL) {
+               return 0;
+       }
+
+       STAILQ_FOREACH(ucma, &p->unicast_master_table->addrs, list) {
+               if (cid_eq(&ucma->portIdentity.clockIdentity, 
&p->best->dataset.identity)) {
+                       return ucma->granted & (1 << DELAY_RESP) ? 1 : 0;
+               }
+       }
+       return 0;
+}
diff --git a/unicast_client.h b/unicast_client.h
index 4a4d345..4a2a0eb 100644
--- a/unicast_client.h
+++ b/unicast_client.h
@@ -107,4 +107,12 @@ int unicast_client_msg_is_from_master_table_entry(struct 
port *p,
 int unicast_client_tx_cancel(struct port *p,
                             struct unicast_master_address *dst,
                             unsigned int bitmask);
+
+/**
+ * Tests whether a unicast delay response request was granted for a given port 
best master.
+ * @param p      The port in question.
+ * @return       One (1) if a unicast client and deslay response was granted 
for p->best
+ *               or zero otherwise.
+ */
+int unicast_client_delay_response_granted(struct port *p);
 #endif
-- 
2.34.1



_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to