diff --git a/clock.c b/clock.c index 8154087..d8a2616 100644 --- a/clock.c +++ b/clock.c @@ -1628,9 +1628,12 @@ struct clock_description *clock_description(struct clock *c) return &c->desc; } -int clock_num_ports(struct clock *c) +enum clock_type clock_type(struct clock *c) { - return c->nports; + if (c->nports > 1) { + return CLOCK_TYPE_BOUNDARY; + } + return CLOCK_TYPE_ORDINARY; } void clock_check_ts(struct clock *c, struct timespec ts) diff --git a/clock.h b/clock.h index d866762..47863dc 100644 --- a/clock.h +++ b/clock.h @@ -267,11 +267,11 @@ void clock_update_time_properties(struct clock *c, struct timePropertiesDS tds); struct clock_description *clock_description(struct clock *c); /** - * Obtain the number of ports a clock has, excluding the UDS port. + * Obtain the type of a clock. * @param c The clock instance. - * @return The number of ports. + * @return One of the @ref clock_type enumeration values. */ -int clock_num_ports(struct clock *c); +enum clock_type clock_type(struct clock *c); /** * Perform a sanity check on a time stamp made by a clock. diff --git a/port.c b/port.c index 93a79b1..161157c 100644 --- a/port.c +++ b/port.c @@ -706,12 +706,7 @@ static int port_management_fill_response(struct port *target, buf = tlv->data; cd->clockType = (UInteger16 *) buf; buf += sizeof(*cd->clockType); - if (clock_num_ports(target->clock) > 1) { - *cd->clockType = CLOCK_TYPE_BOUNDARY; - } else { - *cd->clockType = CLOCK_TYPE_ORDINARY; - } - + *cd->clockType = clock_type(target->clock); cd->physicalLayerProtocol = (struct PTPText *) buf; switch(transport_type(target->trp)) { case TRANS_UDP_IPV4: