From: Vincent Cheng <[email protected]>
Signed-off-by: Vincent Cheng <[email protected]>
v1->v2: new
v2->v3: unicast_client_unicast_master_table_received() to
unicast_client_msg_is_from_master_table_entry()
Code clarity - add separate variable set to 1 instead of depending on
STAILQ behavior.
---
unicast_client.c | 18 ++++++++++++++++++
unicast_client.h | 11 +++++++++++
2 files changed, 29 insertions(+)
diff --git a/unicast_client.c b/unicast_client.c
index 87d8471..61a4b94 100644
--- a/unicast_client.c
+++ b/unicast_client.c
@@ -547,3 +547,21 @@ int unicast_client_timer(struct port *p)
unicast_client_set_tmo(p);
return err;
}
+
+int unicast_client_msg_is_from_master_table_entry(struct port *p, struct
ptp_message *m)
+{
+ struct unicast_master_address *ucma;
+ int found = 0;
+
+ if (!unicast_client_enabled(p)) {
+ return found;
+ }
+ STAILQ_FOREACH(ucma, &p->unicast_master_table->addrs, list) {
+ if (addreq(transport_type(p->trp), &ucma->address,
&m->address)) {
+ found = 1;
+ break;
+ }
+ }
+ return found;
+}
+
diff --git a/unicast_client.h b/unicast_client.h
index 16e291f..9c1aad1 100644
--- a/unicast_client.h
+++ b/unicast_client.h
@@ -82,4 +82,15 @@ void unicast_client_state_changed(struct port *p);
*/
int unicast_client_timer(struct port *p);
+/**
+ * Check whether a message was received from an entry in the unicast
+ * master table.
+ * @param p The port in question.
+ * @param m The message in question.
+ * @return One (1) if the message is from an entry in the unicast
+ * master table, or zero otherwise.
+ */
+int unicast_client_msg_is_from_master_table_entry(struct port *p,
+ struct ptp_message *m);
+
#endif
--
2.34.1
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel