In certain scenarios it is useful to know whether a remote port is
synchronized, for example when the local system is the PTP master and we
are trying to send time-synchronized data to a slave.

Allow the PTP management client agent to take the transport as argument,
and modify the existing callers of init_pmc_node() to specify UDS.

Signed-off-by: Vladimir Oltean <olte...@gmail.com>
---
 phc2sys.c   | 4 ++--
 pmc_agent.c | 6 ++++--
 pmc_agent.h | 4 +++-
 ts2phc.c    | 2 +-
 4 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/phc2sys.c b/phc2sys.c
index 1c02e2b605b0..c706a72f144a 100644
--- a/phc2sys.c
+++ b/phc2sys.c
@@ -1309,7 +1309,7 @@ int main(int argc, char *argv[])
                 getpid());
 
        if (autocfg) {
-               if (init_pmc_node(cfg, priv.agent, uds_local,
+               if (init_pmc_node(cfg, priv.agent, TRANS_UDS, uds_local, 0,
                                  phc2sys_recv_subscribed, &priv))
                        goto end;
                if (auto_init_ports(&priv, rt) < 0)
@@ -1326,7 +1326,7 @@ int main(int argc, char *argv[])
        r = -1;
 
        if (wait_sync) {
-               if (init_pmc_node(cfg, priv.agent, uds_local,
+               if (init_pmc_node(cfg, priv.agent, TRANS_UDS, uds_local, 0,
                                  phc2sys_recv_subscribed, &priv))
                        goto end;
 
diff --git a/pmc_agent.c b/pmc_agent.c
index 77334e381b6e..b617d12f5287 100644
--- a/pmc_agent.c
+++ b/pmc_agent.c
@@ -235,10 +235,12 @@ int run_pmc_wait_sync(struct pmc_agent *node, int timeout)
        }
 }
 
-int init_pmc_node(struct config *cfg, struct pmc_agent *node, const char *uds,
+int init_pmc_node(struct config *cfg, struct pmc_agent *node,
+                 enum transport_type transport_type, const char *iface_name,
+                 UInteger8 boundary_hops,
                  pmc_node_recv_subscribed_t *recv_subscribed, void *context)
 {
-       node->pmc = pmc_create(cfg, TRANS_UDS, uds, 0,
+       node->pmc = pmc_create(cfg, transport_type, iface_name, boundary_hops,
                               config_get_int(cfg, NULL, "domainNumber"),
                               config_get_int(cfg, NULL, "transportSpecific") 
<< 4, 1);
        if (!node->pmc) {
diff --git a/pmc_agent.h b/pmc_agent.h
index ea5788d79606..feffac6f1b64 100644
--- a/pmc_agent.h
+++ b/pmc_agent.h
@@ -31,7 +31,9 @@ struct pmc_agent;
 typedef int pmc_node_recv_subscribed_t(void *context, struct ptp_message *msg,
                                       int excluded);
 
-int init_pmc_node(struct config *cfg, struct pmc_agent *agent, const char *uds,
+int init_pmc_node(struct config *cfg, struct pmc_agent *node,
+                 enum transport_type transport_type, const char *iface_name,
+                 UInteger8 boundary_hops,
                  pmc_node_recv_subscribed_t *recv_subscribed, void *context);
 int run_pmc_wait_sync(struct pmc_agent *agent, int timeout);
 
diff --git a/ts2phc.c b/ts2phc.c
index dd6b7ec1b7c9..0d2ed4280eee 100644
--- a/ts2phc.c
+++ b/ts2phc.c
@@ -667,7 +667,7 @@ int main(int argc, char *argv[])
                 getpid());
 
        if (autocfg) {
-               err = init_pmc_node(cfg, priv.agent, uds_local,
+               err = init_pmc_node(cfg, priv.agent, TRANS_UDS, uds_local, 0,
                                    ts2phc_recv_subscribed, &priv);
                if (err) {
                        ts2phc_cleanup(&priv);
-- 
2.25.1



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

Reply via email to