Also, document transport_send, transport_peer and transport_sendto usage.
Signed-off-by: Jiri Benc <[email protected]>
---
transport.c | 8 ++++++++
transport.h | 33 +++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/transport.c b/transport.c
index 25d569607f71..ad41f678bb19 100644
--- a/transport.c
+++ b/transport.c
@@ -60,6 +60,14 @@ int transport_peer(struct transport *t, struct fdarray *fda,
int event,
return t->send(t, fda, event, msg, len, addr, &msg->hwts);
}
+int transport_sendto(struct transport *t, struct fdarray *fda, int event,
+ struct ptp_message *msg)
+{
+ int len = ntohs(msg->header.messageLength);
+
+ return t->send(t, fda, event, msg, len, &msg->address, &msg->hwts);
+}
+
int transport_physical_addr(struct transport *t, uint8_t *addr)
{
if (t->physical_addr) {
diff --git a/transport.h b/transport.h
index 5153c46d7887..8e0d4214af5a 100644
--- a/transport.h
+++ b/transport.h
@@ -57,13 +57,46 @@ int transport_open(struct transport *t, const char *name,
int transport_recv(struct transport *t, int fd, struct ptp_message *msg);
+/**
+ * Sends the PTP message using the given transport. The message is sent to
+ * the default (usually multicast) address, any address field in the
+ * ptp_message itself is ignored.
+ * @param t The transport.
+ * @param fda The array of descriptors filled in by transport_open.
+ * @param event 1 for event message, 0 for general message.
+ * @param msg The message to send.
+ * @return Number of bytes send, or negative value in case of an error.
+ */
int transport_send(struct transport *t, struct fdarray *fda, int event,
struct ptp_message *msg);
+/**
+ * Sends the PTP message using the given transport. The message is sent to
+ * the address used for p2p delay measurements (usually a multicast
+ * address), any address field in the ptp_message itself is ignored.
+ * @param t The transport.
+ * @param fda The array of descriptors filled in by transport_open.
+ * @param event 1 for event message, 0 for general message.
+ * @param msg The message to send.
+ * @return Number of bytes send, or negative value in case of an error.
+ */
int transport_peer(struct transport *t, struct fdarray *fda, int event,
struct ptp_message *msg);
/**
+ * Sends the PTP message using the given transport. The address has to be
+ * provided in the address field of the message.
+ * @param t The transport.
+ * @param fda The array of descriptors filled in by transport_open.
+ * @param event 1 for event message, 0 for general message.
+ * @param msg The message to send. The address of the destination has to
+ * be set in the address field.
+ * @return Number of bytes send, or negative value in case of an error.
+ */
+int transport_sendto(struct transport *t, struct fdarray *fda, int event,
+ struct ptp_message *msg);
+
+/**
* Returns the transport's type.
*/
enum transport_type transport_type(struct transport *t);
--
1.7.6.5
------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel