Implement transport_sendto
Also, document transport_send, transport_peer and transport_sendto usage. Signed-off-by: Jiri Benc <jbenc@redhat.com>master
parent
e804e6f9a0
commit
4df924b253
|
@ -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);
|
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)
|
int transport_physical_addr(struct transport *t, uint8_t *addr)
|
||||||
{
|
{
|
||||||
if (t->physical_addr) {
|
if (t->physical_addr) {
|
||||||
|
|
33
transport.h
33
transport.h
|
@ -57,12 +57,45 @@ int transport_open(struct transport *t, const char *name,
|
||||||
|
|
||||||
int transport_recv(struct transport *t, int fd, struct ptp_message *msg);
|
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,
|
int transport_send(struct transport *t, struct fdarray *fda, int event,
|
||||||
struct ptp_message *msg);
|
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,
|
int transport_peer(struct transport *t, struct fdarray *fda, int event,
|
||||||
struct ptp_message *msg);
|
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.
|
* Returns the transport's type.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue