NetBurner 3.5.0
PDF Version
 
lldp.h
1#ifndef _LLDP_H
2#define _LLDP_H 1
3
4#include <netinterface.h>
5#include <nettypes.h>
6#include <config_obj.h>
7
8#define TLV_CHASSIS_ID 1
9#define TLV_PORT_ID 2
10#define TLV_TTL 3
11#define TLV_PORT_DESC 4
12#define TLV_SYS_NAME 5
13#define TLV_SYS_DESC 6
14#define TLV_SYS_CAP 7
15#define TLV_MANAGMENT_ADDR 8
16#define TLV_CUSTOM 127
17
18class LLDPEntity : public TimeOutElement, public config_obj
19{
20 private:
21 int m_SetTxTime;
22 PoolPtr m_ActivePacket; // The packet being sent
23 PoolPtr m_NewPacket; // The packet being built
24 InterfaceBlock *m_pIfBlock; // Poitner to interface block
25 OS_CRIT m_Entity_Crit; // Critical section for swapping blocks.
26 bool m_bFastTx; // Indicates packet changed should send soon...
27
28 virtual void TimeElementEvent();
29 void RawAdd(uint8_t id, unsigned int len, uint8_t *pData);
30 void RawAddString(uint8_t id, const char *str);
31 void RawAddMac(uint8_t id, uint8_t sub_type, MACADR &ma);
32 void AddMandatoryHeader(); // TLV 1,2,3
33 protected:
34 void StartNewPacket();
35 void AddPortDescription(const char *Description) { RawAddString(TLV_PORT_DESC, Description); };
36 void AddHostName(const char *HostName) { RawAddString(TLV_SYS_NAME, HostName); };
37 void AddSysDescription(const char *Description) { RawAddString(TLV_SYS_DESC, Description); };
38 void AddSysCapabilities(uint16_t capablities, uint16_t enabled);
39 void AddManagmentAddr(IPADDR4 ipa);
40 void AddCustomRaw(uint32_t UUID, uint32_t org_sub, uint32_t datalen, puint8_t data);
41 void AddCustomInt(uint32_t UUID, uint32_t org_sub, int data, uint32_t intlen);
42 void AddCustomString(uint32_t UUID, uint32_t org_sub, const char *str);
43 void UseNewPacket(); // automatically adds End LLDPU TLV
44
45 public:
46 config_bool m_bEnable{TRUE, "Enable", "Enable/disable LLDP transmisions"};
47 config_int m_iTxTime{30, "TxTimer", "Transmission interval in seconds"};
48 config_int m_iHoldTime{120, "HoldTime", "LLD TTL"};
49 config_int m_iRetransmitTime{2, "RetransmitTime", "Seconds to wait on Startup"};
50 ConfigEndMarker; // No new data members below this line
51
52 LLDPEntity(InterfaceBlock &ib);
53 virtual void BuildPacket();
54 void RebuildPacket() { BuildPacket(); };
55};
56
57#endif
Used to store and manipulate IPv4 addresses in dual stack mode.
Definition nettypes.h:208
Network interface configuration block class for interface control and configuration.
Definition netinterface.h:245
Used to store and manipulate MAC addresses.
Definition nettypes.h:69
Boolean Configuration Variable.
Definition config_obj.h:932
Signed 32-bit Integer Configuration Variable.
Definition config_obj.h:649
Base class used to create configuration objects.
Definition config_obj.h:277
Configuration object header file.
NetBurner Network Interface Header File.
NetBurner IPADDR4 Class. See the IPADDR4 Class page for complete documentation.
An OS_CRIT object is used to establish critical sections of code that can only be run by one task at ...
Definition nbrtos.h:1084