summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/lldp-tlv.h
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2015-06-21 20:27:04 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2015-10-02 17:11:40 +0200
commit2212d76d08f3bc34c683aed1a6736325b841625c (patch)
tree15d61c2c8ad6f0eb807df35c7ee182dd859ee575 /src/libsystemd-network/lldp-tlv.h
parent3c2f5a543de9cc3d958920b3bd18dc8657dc201f (diff)
lldp: add reference counter to struct tlv_packet
Add a reference counter to the tlv_packet structure so that it can be shared between multiple users and properly free'd when no longer in use.
Diffstat (limited to 'src/libsystemd-network/lldp-tlv.h')
-rw-r--r--src/libsystemd-network/lldp-tlv.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libsystemd-network/lldp-tlv.h b/src/libsystemd-network/lldp-tlv.h
index ce3334e115..f682997031 100644
--- a/src/libsystemd-network/lldp-tlv.h
+++ b/src/libsystemd-network/lldp-tlv.h
@@ -45,6 +45,8 @@ int tlv_section_new(tlv_section **ret);
void tlv_section_free(tlv_section *ret);
struct tlv_packet {
+ unsigned n_ref;
+
uint16_t type;
uint16_t length;
usec_t ts;
@@ -61,10 +63,11 @@ struct tlv_packet {
};
int tlv_packet_new(tlv_packet **ret);
-void tlv_packet_free(tlv_packet *m);
+tlv_packet *tlv_packet_ref(tlv_packet *m);
+tlv_packet *tlv_packet_unref(tlv_packet *m);
-DEFINE_TRIVIAL_CLEANUP_FUNC(tlv_packet*, tlv_packet_free);
-#define _cleanup_tlv_packet_free_ _cleanup_(tlv_packet_freep)
+DEFINE_TRIVIAL_CLEANUP_FUNC(tlv_packet*, tlv_packet_unref);
+#define _cleanup_tlv_packet_free_ _cleanup_(tlv_packet_unrefp)
int lldp_tlv_packet_open_container(tlv_packet *m, uint16_t type);
int lldp_tlv_packet_close_container(tlv_packet *m);