interface: Introduce an access method for the name field.

Many of the users only require a read only reference to the interface name.
This patch adds an appropriate method.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2020-02-09 07:22:52 -08:00
parent c5b9ab990a
commit 380ee349f6
3 changed files with 23 additions and 4 deletions

12
interface.c 100644
View File

@ -0,0 +1,12 @@
/**
* @file interface.c
* @brief Implements network interface data structures.
* @note Copyright (C) 2020 Richard Cochran <richardcochran@gmail.com>
* @note SPDX-License-Identifier: GPL-2.0+
*/
#include "interface.h"
const char *interface_name(struct interface *iface)
{
return iface->name;
}

View File

@ -24,5 +24,12 @@ struct interface {
struct sk_ts_info ts_info;
};
/**
* Obtains the name of a network interface.
* @param iface The interface of interest.
* @return The device name of the network interface.
*/
const char *interface_name(struct interface *iface);
#endif

View File

@ -27,10 +27,10 @@ FILTERS = filter.o mave.o mmedian.o
SERVOS = linreg.o ntpshm.o nullf.o pi.o servo.o
TRANSP = raw.o transport.o udp.o udp6.o uds.o
OBJ = bmc.o clock.o clockadj.o clockcheck.o config.o designated_fsm.o \
e2e_tc.o fault.o $(FILTERS) fsm.o hash.o msg.o phc.o port.o port_signaling.o \
pqueue.o print.o ptp4l.o p2p_tc.o rtnl.o $(SERVOS) sk.o stats.o tc.o \
$(TRANSP) telecom.o tlv.o tsproc.o unicast_client.o unicast_fsm.o \
unicast_service.o util.o version.o
e2e_tc.o fault.o $(FILTERS) fsm.o hash.o interface.o msg.o phc.o port.o \
port_signaling.o pqueue.o print.o ptp4l.o p2p_tc.o rtnl.o $(SERVOS) sk.o \
stats.o tc.o $(TRANSP) telecom.o tlv.o tsproc.o unicast_client.o \
unicast_fsm.o unicast_service.o util.o version.o
OBJECTS = $(OBJ) hwstamp_ctl.o nsm.o phc2sys.o phc_ctl.o pmc.o pmc_common.o \
sysoff.o timemaster.o