From a7b6987a00bfb1255f6221e203be1a79cf33beac Mon Sep 17 00:00:00 2001 From: Anjan Chanda <anjan.chanda@iopsys.eu> Date: Tue, 6 Apr 2021 10:21:44 +0200 Subject: [PATCH] subsume lldp_tlvs.h into 1905_tlvs.h --- src/1905_tlvs.h | 52 ++++++++++++++++++++++++++++++++++++++++ src/cmdu_input.c | 2 -- src/cmdu_output.c | 2 -- src/i1905.c | 2 -- src/i1905_al.c | 1 - src/i1905_dm.c | 1 - src/lldp_tlvs.h | 61 ----------------------------------------------- 7 files changed, 52 insertions(+), 69 deletions(-) delete mode 100644 src/lldp_tlvs.h diff --git a/src/1905_tlvs.h b/src/1905_tlvs.h index 605e0817..5d652a30 100644 --- a/src/1905_tlvs.h +++ b/src/1905_tlvs.h @@ -503,4 +503,56 @@ struct tlv_l2_neighbor { } __attribute__((packed)); +/* LLDP tlvs definition */ +/* Tlv types */ +#define LLDP_TLV_EOL 0 +#define LLDP_TLV_CHASSIS_ID 1 +#define LLDP_TLV_PORT_ID 2 +#define LLDP_TLV_TTL 3 + + +/* TLV: end of LLDPPDU */ +struct tlv_eol { +} __attribute__((packed)); + + +#define LLDP_CHASSIS_ID_SUBTYPE_CHASSIS_COMPONENT 1 +#define LLDP_CHASSIS_ID_SUBTYPE_INTERFACE_ALIAS 2 +#define LLDP_CHASSIS_ID_SUBTYPE_PORT_COMPONENT 3 +#define LLDP_CHASSIS_ID_SUBTYPE_MAC_ADDRESS 4 +#define LLDP_CHASSIS_ID_SUBTYPE_NETWORK_ADDRESS 5 +#define LLDP_CHASSIS_ID_SUBTYPE_INTERFACE_NAME 6 +#define LLDP_CHASSIS_ID_SUBTYPE_LOGICALLY_ASSIGNED 7 + +/* TLV: chassis-id */ +struct tlv_chassis_id { + uint8_t subtype; + uint8_t id[256]; +} __attribute__((packed)); + + + +#define LLDP_PORT_ID_SUBTYPE_INTERFACE_ALIAS 1 +#define LLDP_PORT_ID_SUBTYPE_PORT_COMPONENT 2 +#define LLDP_PORT_ID_SUBTYPE_MAC_ADDRESS 3 +#define LLDP_PORT_ID_SUBTYPE_NETWORK_ADDRESS 4 +#define LLDP_PORT_ID_SUBTYPE_INTERFACE_NAME 5 +#define LLDP_PORT_ID_SUBTYPE_AGENT_CIRCUIT_ID 6 +#define LLDP_PORT_ID_SUBTYPE_LOGICALLY_ASSIGNED 7 + +/* TLV: port-id */ +struct tlv_port_id { + uint8_t subtype; + uint8_t id[256]; +} __attribute__((packed)); + + + +#define LLDP_TTL_1905_DEFAULT_VALUE 180 /* in secs */ + +/* TLV: ttl */ +struct tlv_ttl { + uint16_t ttl; /* in secs */ +} __attribute__((packed)); + #endif /* _1905_TLVS_H_ */ diff --git a/src/cmdu_input.c b/src/cmdu_input.c index 561e6d07..88d7743e 100644 --- a/src/cmdu_input.c +++ b/src/cmdu_input.c @@ -49,9 +49,7 @@ #include "i1905.h" -// TODO: combine following headers into one #include "1905_tlvs.h" -#include "lldp_tlvs.h" #include "i1905_extension.h" diff --git a/src/cmdu_output.c b/src/cmdu_output.c index 429d7d21..56c4c662 100644 --- a/src/cmdu_output.c +++ b/src/cmdu_output.c @@ -50,9 +50,7 @@ #include "i1905.h" -// TODO: combine following headers into one #include "1905_tlvs.h" -#include "lldp_tlvs.h" #include "i1905_extension.h" diff --git a/src/i1905.c b/src/i1905.c index 6f226ac4..511a29d7 100644 --- a/src/i1905.c +++ b/src/i1905.c @@ -48,9 +48,7 @@ #include "i1905_extension.h" -// TODO: combine following headers into one #include "1905_tlvs.h" -#include "lldp_tlvs.h" diff --git a/src/i1905_al.c b/src/i1905_al.c index 04d82026..41b55fb8 100644 --- a/src/i1905_al.c +++ b/src/i1905_al.c @@ -48,7 +48,6 @@ #include "1905_tlvs.h" -#include "lldp_tlvs.h" #if 0 static struct i1905_ipv4 *alloc_ipv4(void) diff --git a/src/i1905_dm.c b/src/i1905_dm.c index d969fc90..bdd0de9e 100644 --- a/src/i1905_dm.c +++ b/src/i1905_dm.c @@ -44,7 +44,6 @@ #include "i1905_dm.h" #include "1905_tlvs.h" -#include "lldp_tlvs.h" static void i1905_dm_neighbor_agetimer_cb(atimer_t *t) diff --git a/src/lldp_tlvs.h b/src/lldp_tlvs.h deleted file mode 100644 index d5f048a0..00000000 --- a/src/lldp_tlvs.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * lldp_tlvs.h: LLDP tlvs definition - */ - -#ifndef LLDP_TLVS_H -#define LLDP_TLVS_H - - -/* Tlv types */ -#define LLDP_TLV_EOL 0 -#define LLDP_TLV_CHASSIS_ID 1 -#define LLDP_TLV_PORT_ID 2 -#define LLDP_TLV_TTL 3 - - -/* TLV: end of LLDPPDU */ -struct tlv_eol { -} __attribute__((packed)); - - -#define LLDP_CHASSIS_ID_SUBTYPE_CHASSIS_COMPONENT 1 -#define LLDP_CHASSIS_ID_SUBTYPE_INTERFACE_ALIAS 2 -#define LLDP_CHASSIS_ID_SUBTYPE_PORT_COMPONENT 3 -#define LLDP_CHASSIS_ID_SUBTYPE_MAC_ADDRESS 4 -#define LLDP_CHASSIS_ID_SUBTYPE_NETWORK_ADDRESS 5 -#define LLDP_CHASSIS_ID_SUBTYPE_INTERFACE_NAME 6 -#define LLDP_CHASSIS_ID_SUBTYPE_LOGICALLY_ASSIGNED 7 - -/* TLV: chassis-id */ -struct tlv_chassis_id { - uint8_t subtype; - uint8_t id[256]; -} __attribute__((packed)); - - - -#define LLDP_PORT_ID_SUBTYPE_INTERFACE_ALIAS 1 -#define LLDP_PORT_ID_SUBTYPE_PORT_COMPONENT 2 -#define LLDP_PORT_ID_SUBTYPE_MAC_ADDRESS 3 -#define LLDP_PORT_ID_SUBTYPE_NETWORK_ADDRESS 4 -#define LLDP_PORT_ID_SUBTYPE_INTERFACE_NAME 5 -#define LLDP_PORT_ID_SUBTYPE_AGENT_CIRCUIT_ID 6 -#define LLDP_PORT_ID_SUBTYPE_LOGICALLY_ASSIGNED 7 - -/* TLV: port-id */ -struct tlv_port_id { - uint8_t subtype; - uint8_t id[256]; -} __attribute__((packed)); - - - -#define LLDP_TTL_1905_DEFAULT_VALUE 180 /* in secs */ - -/* TLV: ttl */ -struct tlv_ttl { - uint16_t ttl; /* in secs */ -} __attribute__((packed)); - - -#endif /* LLDP_TLVS_H */ -- GitLab