summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-lldp.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2015-09-22 15:19:42 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2015-09-22 15:19:42 +0200
commit9ef61f2e4802abdb4a2853a82126420b1e77b419 (patch)
treed4bb3f57e4b6828b9e8be1748a3dd2899481de63 /src/libsystemd-network/sd-lldp.c
parent8955cf0a4586010f913bb7e0f8d05f1fc116c246 (diff)
sd-lldp: hide internal details
Currently, sd-lldp.h exports "UPDATE_INFO".. and defines it to a magic constant '10'. This is completely bogus, so fix it to follow our coding standards: - Prefix exported symbols by SD_LLDP_* - Define a separate event-enum for event types - Translate internal state to external event-types
Diffstat (limited to 'src/libsystemd-network/sd-lldp.c')
-rw-r--r--src/libsystemd-network/sd-lldp.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/libsystemd-network/sd-lldp.c b/src/libsystemd-network/sd-lldp.c
index 574e04b541..17512884f5 100644
--- a/src/libsystemd-network/sd-lldp.c
+++ b/src/libsystemd-network/sd-lldp.c
@@ -366,10 +366,16 @@ static void lldp_set_state(sd_lldp *lldp, LLDPAgentRXState state) {
}
static void lldp_run_state_machine(sd_lldp *lldp) {
+ if (!lldp->cb)
+ return;
- if (lldp->rx_state == LLDP_AGENT_RX_UPDATE_INFO)
- if (lldp->cb)
- lldp->cb(lldp, LLDP_AGENT_RX_UPDATE_INFO, lldp->userdata);
+ switch (lldp->rx_state) {
+ case LLDP_AGENT_RX_UPDATE_INFO:
+ lldp->cb(lldp, SD_LLDP_EVENT_UPDATE_INFO, lldp->userdata);
+ break;
+ default:
+ break;
+ }
}
/* 10.5.5.2.1 mibDeleteObjects ()