From 9da511d6f6b2936a18323c4477bd7729a1afcfde Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sat, 25 Aug 2012 16:15:34 +0200 Subject: [PATCH] Provide a method to obtain a port's identity. Signed-off-by: Richard Cochran --- port.c | 5 +++++ port.h | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/port.c b/port.c index fe44c7a..2e00ffb 100644 --- a/port.c +++ b/port.c @@ -1445,6 +1445,11 @@ int port_forward(struct port *p, struct ptp_message *msg, int msglen) return cnt <= 0 ? -1 : 0; } +struct PortIdentity port_identity(struct port *p) +{ + return p->portIdentity; +} + int port_manage(struct port *p, struct port *ingress, struct ptp_message *msg) { struct management_tlv *mgt; diff --git a/port.h b/port.h index 852bf8b..2fc71e4 100644 --- a/port.h +++ b/port.h @@ -90,6 +90,13 @@ enum fsm_event port_event(struct port *port, int fd_index); */ int port_forward(struct port *p, struct ptp_message *msg, int msglen); +/** + * Obtain a port's identity. + * @param p A pointer previously obtained via port_open(). + * @return The port identity of 'p'. + */ +struct PortIdentity port_identity(struct port *p); + /** * Manage a port according to a given message. * @param p A pointer previously obtained via port_open().