summaryrefslogtreecommitdiff
path: root/src/systemd/sd-lldp.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-06-02 17:45:08 +0200
committerLennart Poettering <lennart@poettering.net>2016-06-06 19:59:07 +0200
commitfc6a313b5b836a8642a47348272d7883e1b9349d (patch)
tree45de1fba29d09750b420789735adcc8f97b8f188 /src/systemd/sd-lldp.h
parent5f94b4e62e9439b3580653e30082981e33128b8a (diff)
downloadsystemd-fc6a313b5b836a8642a47348272d7883e1b9349d.tar.gz
lldp: add proper ref counting to sd_lldp object and a separate call for setting the ifindex
Let's make sd-lldp a bit more like sd-ndisc ant the other APIs, and add proper ref counting and a separate call for setting the ifindex. This also adds a new lldp_reset() call we can use at various places to close all fds. This is also similar to how sd-ndisc already does it.
Diffstat (limited to 'src/systemd/sd-lldp.h')
-rw-r--r--src/systemd/sd-lldp.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/systemd/sd-lldp.h b/src/systemd/sd-lldp.h
index 617e0f1e17..8f096c1b99 100644
--- a/src/systemd/sd-lldp.h
+++ b/src/systemd/sd-lldp.h
@@ -30,9 +30,6 @@
_SD_BEGIN_DECLARATIONS;
-typedef struct sd_lldp sd_lldp;
-typedef struct sd_lldp_neighbor sd_lldp_neighbor;
-
/* IEEE 802.3AB Clause 9: TLV Types */
enum {
SD_LLDP_TYPE_END = 0,
@@ -111,6 +108,9 @@ enum {
SD_LLDP_OUI_802_1_SUBTYPE_LINK_AGGREGATION = 7,
};
+typedef struct sd_lldp sd_lldp;
+typedef struct sd_lldp_neighbor sd_lldp_neighbor;
+
typedef enum sd_lldp_event {
SD_LLDP_EVENT_ADDED = 'a',
SD_LLDP_EVENT_REMOVED = 'r',
@@ -120,7 +120,8 @@ typedef enum sd_lldp_event {
typedef void (*sd_lldp_callback_t)(sd_lldp *lldp, sd_lldp_event event, sd_lldp_neighbor *n, void *userdata);
-int sd_lldp_new(sd_lldp **ret, int ifindex);
+int sd_lldp_new(sd_lldp **ret);
+sd_lldp* sd_lldp_ref(sd_lldp *lldp);
sd_lldp* sd_lldp_unref(sd_lldp *lldp);
int sd_lldp_start(sd_lldp *lldp);
@@ -130,6 +131,7 @@ int sd_lldp_attach_event(sd_lldp *lldp, sd_event *event, int64_t priority);
int sd_lldp_detach_event(sd_lldp *lldp);
int sd_lldp_set_callback(sd_lldp *lldp, sd_lldp_callback_t cb, void *userdata);
+int sd_lldp_set_ifindex(sd_lldp *lldp, int ifindex);
/* Controls how much and what to store in the neighbors database */
int sd_lldp_set_neighbors_max(sd_lldp *lldp, uint64_t n);