Also, document transport_send, transport_peer and transport_sendto usage. Signed-off-by: Jiri Benc <jb...@redhat.com> --- transport.c | 8 ++++++++ transport.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/transport.c b/transport.c index b2d4dd14ee65..fc187406b5bd 100644 --- a/transport.c +++ b/transport.c @@ -58,6 +58,14 @@ int transport_peer(struct transport *t, struct fdarray *fda, int event, return t->send(t, fda, event, 1, msg, len, NULL, &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, 0, 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 ------------------------------------------------------------------------------ Start Your Social Network Today - Download eXo Platform Build your Enterprise Intranet with eXo Platform Software Java Based Open Source Intranet - Social, Extensible, Cloud Ready Get Started Now And Turn Your Intranet Into A Collaboration Platform http://p.sf.net/sfu/ExoPlatform _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel