diff --git a/port.c b/port.c index 164de9b..d5650ac 100644 --- a/port.c +++ b/port.c @@ -2170,6 +2170,13 @@ int port_forward(struct port *p, struct ptp_message *msg) return cnt <= 0 ? -1 : 0; } +int port_forward_to(struct port *p, struct ptp_message *msg) +{ + int cnt; + cnt = transport_sendto(p->trp, &p->fda, 0, msg); + return cnt <= 0 ? -1 : 0; +} + int port_prepare_and_send(struct port *p, struct ptp_message *msg, int event) { int cnt; diff --git a/port.h b/port.h index 86a6f17..34103a6 100644 --- a/port.h +++ b/port.h @@ -91,6 +91,14 @@ enum fsm_event port_event(struct port *port, int fd_index); */ int port_forward(struct port *p, struct ptp_message *msg); +/** + * Forward a message on a given port to the address stored in the message. + * @param port A pointer previously obtained via port_open(). + * @param msg The message to send. Must be in network byte order. + * @return Zero on success, non-zero otherwise. + */ +int port_forward_to(struct port *p, struct ptp_message *msg); + /** * Prepare message for transmission and send it to a given port. Note that * a single message cannot be sent several times using this function, that