diff --git a/clock.c b/clock.c index 8e7af0d..57683b9 100644 --- a/clock.c +++ b/clock.c @@ -470,7 +470,7 @@ static int clock_management_get_response(struct clock *c, struct port *p, } respond = clock_management_fill_response(c, p, req, rsp, id); if (respond) - port_prepare_and_send(p, rsp, 0); + port_prepare_and_send(p, rsp, TRANS_GENERAL); msg_put(rsp); return respond; } diff --git a/nsm.c b/nsm.c index fb87b3a..0fb73fb 100644 --- a/nsm.c +++ b/nsm.c @@ -436,7 +436,7 @@ static int nsm_request(struct nsm *nsm, char *target) pr_err("msg_pre_send failed"); goto out; } - cnt = transport_sendto(nsm->trp, &nsm->fda, 1, msg); + cnt = transport_sendto(nsm->trp, &nsm->fda, TRANS_EVENT, msg); if (cnt <= 0) { pr_err("transport_sendto failed"); err = -1; diff --git a/pmc_common.c b/pmc_common.c index 9d21210..d1eafe7 100644 --- a/pmc_common.c +++ b/pmc_common.c @@ -160,7 +160,8 @@ static int pmc_send(struct pmc *pmc, struct ptp_message *msg) pr_err("msg_pre_send failed"); return -1; } - return transport_send(pmc->transport, &pmc->fdarray, 0, msg); + return transport_send(pmc->transport, &pmc->fdarray, + TRANS_GENERAL, msg); } static int pmc_tlv_datalen(struct pmc *pmc, int id) diff --git a/port.c b/port.c index 1ff2e11..1757dfe 100644 --- a/port.c +++ b/port.c @@ -940,7 +940,7 @@ static int port_management_get_response(struct port *target, } respond = port_management_fill_response(target, rsp, id); if (respond) - port_prepare_and_send(ingress, rsp, 0); + port_prepare_and_send(ingress, rsp, TRANS_GENERAL); msg_put(rsp); return respond; } @@ -1297,7 +1297,7 @@ int port_delay_request(struct port *p) msg->header.flagField[0] |= UNICAST; } - if (port_prepare_and_send(p, msg, 1)) { + if (port_prepare_and_send(p, msg, TRANS_EVENT)) { pr_err("port %hu: send delay request failed", portnum(p)); goto out; } @@ -1354,7 +1354,7 @@ static int port_tx_announce(struct port *p) pr_err("port %hu: append path trace failed", portnum(p)); } - err = port_prepare_and_send(p, msg, 0); + err = port_prepare_and_send(p, msg, TRANS_GENERAL); if (err) { pr_err("port %hu: send announce failed", portnum(p)); } @@ -1457,7 +1457,7 @@ static int port_tx_sync(struct port *p, struct address *dst) goto out; } - err = port_prepare_and_send(p, fup, 0); + err = port_prepare_and_send(p, fup, TRANS_GENERAL); if (err) { pr_err("port %hu: send follow up failed", portnum(p)); } @@ -1758,7 +1758,7 @@ static int process_delay_req(struct port *p, struct ptp_message *m) err = -1; goto out; } - err = port_prepare_and_send(p, msg, 0); + err = port_prepare_and_send(p, msg, TRANS_GENERAL); if (err) { pr_err("port %hu: send delay response failed", portnum(p)); goto out; @@ -2533,18 +2533,19 @@ static enum fsm_event bc_event(struct port *p, int fd_index) int port_forward(struct port *p, struct ptp_message *msg) { int cnt; - cnt = transport_send(p->trp, &p->fda, 0, msg); + cnt = transport_send(p->trp, &p->fda, TRANS_GENERAL, 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); + cnt = transport_sendto(p->trp, &p->fda, TRANS_GENERAL, msg); return cnt <= 0 ? -1 : 0; } -int port_prepare_and_send(struct port *p, struct ptp_message *msg, int event) +int port_prepare_and_send(struct port *p, struct ptp_message *msg, + enum transport_event event) { int cnt; @@ -2658,7 +2659,7 @@ int port_management_error(struct PortIdentity pid, struct port *ingress, mes->error = error_id; mes->id = mgt->id; - err = port_prepare_and_send(ingress, msg, 0); + err = port_prepare_and_send(ingress, msg, TRANS_GENERAL); msg_put(msg); return err; } diff --git a/port.h b/port.h index a76b2bd..d828875 100644 --- a/port.h +++ b/port.h @@ -105,10 +105,10 @@ int port_forward_to(struct port *p, struct ptp_message *msg); * port_forward if you need to send single message to several ports. * @param p A pointer previously obtained via port_open(). * @param msg The message to send. - * @param event 0 if the message is a general message, 1 if it is an - * event message. + * @param event One of the @ref transport_event enumeration values. */ -int port_prepare_and_send(struct port *p, struct ptp_message *msg, int event); +int port_prepare_and_send(struct port *p, struct ptp_message *msg, + enum transport_event event); /** * Obtain a port's identity.