15 #include "rofl/common/cmemory.h"
16 #include "rofl/common/croflexception.h"
17 #include "rofl/common/logging.h"
38 } __attribute__((packed));
43 uint8_t eth_dst[ETH_ALEN];
44 uint8_t eth_src[ETH_ALEN];
47 } __attribute__((packed));
54 } __attribute__((packed));
61 uint16_t available_caps;
62 uint16_t enabled_caps;
63 } __attribute__((packed));
70 } __attribute__((packed));
76 LLDPTT_CHASSIS_ID = 1,
80 LLDPTT_SYSTEM_NAME = 5,
81 LLDPTT_SYSTEM_DESC = 6,
82 LLDPTT_SYSTEM_CAPS = 7,
87 enum lldp_tlv_chassis_id_subtype {
88 LLDPCHIDST_RESERVED = 0,
89 LLDPCHIDST_CHASSIS = 1,
90 LLDPCHIDST_IFALIAS = 2,
92 LLDPCHIDST_MAC_ADDR = 4,
93 LLDPCHIDST_NET_ADDR = 5,
94 LLDPCHIDST_IFNAME = 6,
99 enum lldp_tlv_port_id_subtype {
100 LLDPPRTIDST_RESERVED = 0,
101 LLDPPRTIDST_IFALIAS = 1,
102 LLDPPRTIDST_PORT = 2,
103 LLDPPRTIDST_MAC_ADDR = 3,
104 LLDPPRTIDST_NET_ADDR = 4,
105 LLDPPRTIDST_IFNAME = 5,
106 LLDPPRTIDST_AGENT_CIRCUIT_ID = 6,
107 LLDPPRTIDST_LOCAL = 7,
112 LLDP_SYSCAPS_OTHER = 0,
113 LLDP_SYSCAPS_REPEATER = 1,
114 LLDP_SYSCAPS_BRIDGE = 2,
115 LLDP_SYSCAPS_WLANAP = 3,
116 LLDP_SYSCAPS_ROUTER = 4,
117 LLDP_SYSCAPS_PHONE = 5,
118 LLDP_SYSCAPS_DOCSIS = 6,
119 LLDP_SYSCAPS_STA_ONLY = 7,
179 pack(uint8_t *buf = NULL,
size_t buflen = 0);
185 unpack(uint8_t *buf,
size_t buflen);
199 set_type(uint8_t type);
211 set_length(uint16_t len);
217 get_body()
const {
return body; };
223 set_body() {
return body; };
231 operator<< (std::ostream& os,
clldpattr const& attr) {
232 os <<
rofl::indent(0) <<
"<clldpattr type:" << (int)attr.get_type()
233 <<
" len:" << (int)attr.get_length()
234 <<
" mem-len:" << (int)attr.length()
235 <<
" >" << std::endl;
287 os << dynamic_cast<clldpattr const&>( attr );
288 os <<
rofl::indent(2) <<
"<clldpattr_end >" << std::endl;
311 uint8_t sub_type = 0,
350 pack(uint8_t *buf = NULL,
size_t buflen = 0);
356 unpack(uint8_t *buf,
size_t buflen);
363 virtual uint8_t
const&
364 get_sub_type()
const {
return sub_type; };
370 set_sub_type() {
return sub_type; };
382 set_string(std::string
const str);
391 operator<< (std::ostream& os,
clldpattr_id const& attr) {
392 os << dynamic_cast<clldpattr const&>( attr );
393 switch (attr.get_type()) {
394 case LLDPTT_CHASSIS_ID: {
395 os <<
rofl::indent(2) <<
"<clldpattr_chassis_id sub-type:" << (int)attr.get_sub_type() <<
" >" << std::endl;
397 case LLDPTT_PORT_ID: {
398 os <<
rofl::indent(2) <<
"<clldpattr_port_id sub-type:" << (int)attr.get_sub_type() <<
" >" << std::endl;
401 os <<
rofl::indent(2) <<
"<clldpattr_id type:" << (int)attr.get_type() <<
" sub-type:" << (int)attr.get_sub_type() <<
" >" << std::endl;
405 os << attr.get_body();
465 pack(uint8_t *buf = NULL,
size_t buflen = 0);
471 unpack(uint8_t *buf,
size_t buflen);
478 virtual uint16_t
const&
479 get_ttl()
const {
return ttl; };
485 set_ttl() {
return ttl; };
494 os << dynamic_cast<clldpattr const&>( attr );
495 os <<
rofl::indent(2) <<
"<clldpattr_ttl ttl:0x" << std::hex << (int)attr.get_ttl() << std::dec <<
" >" << std::endl;
555 set_desc(std::string
const& desc);
564 os << dynamic_cast<clldpattr const&>( attr );
565 switch (attr.get_type()) {
566 case rofl::protocol::lldp::LLDPTT_PORT_DESC: {
567 os <<
rofl::indent(2) <<
"<clldpattr_port_desc desc:" << attr.get_desc() <<
" >";
569 case rofl::protocol::lldp::LLDPTT_SYSTEM_NAME: {
570 os <<
rofl::indent(2) <<
"<clldpattr_system_name desc:" << attr.get_desc() <<
" >";
572 case rofl::protocol::lldp::LLDPTT_SYSTEM_DESC: {
573 os <<
rofl::indent(2) <<
"<clldpattr_system_desc desc:" << attr.get_desc() <<
" >";
576 os <<
rofl::indent(2) <<
"<clldpattr_desc type:" << (int)attr.get_type() <<
" desc:" << attr.get_desc() <<
" >";
580 os << attr.get_body();
602 uint16_t available_caps;
603 uint16_t enabled_caps;
617 clldpattr const& attr) :
clldpattr(attr), chassis_id(0), available_caps(0), enabled_caps(0) {};
649 pack(uint8_t *buf = NULL,
size_t buflen = 0);
655 unpack(uint8_t *buf,
size_t buflen);
662 virtual uint8_t
const&
663 get_chassis_id()
const {
return chassis_id; };
669 set_chassis_id() {
return chassis_id; };
674 virtual uint16_t
const&
675 get_available_caps()
const {
return available_caps; };
681 set_available_caps() {
return available_caps; };
686 virtual uint16_t
const&
687 get_enabled_caps()
const {
return enabled_caps; };
693 set_enabled_caps() {
return enabled_caps; };
703 os << dynamic_cast<clldpattr const&>( attr );
704 os <<
rofl::indent(2) <<
"<clldpattr_sys_caps >" << std::endl;
705 os <<
rofl::indent(4) <<
"<chassis-id: " << (int)attr.get_chassis_id() <<
" >" << std::endl;
706 os <<
rofl::indent(4) <<
"<available-caps: 0x" << std::hex << (int)attr.get_available_caps() << std::dec <<
" >" << std::endl;
707 os <<
rofl::indent(4) <<
"<enabled-caps: 0x" << std::hex << (int)attr.get_enabled_caps() << std::dec <<
" >" << std::endl;
Definition: clldpattr.h:24
Definition: clldpattr.h:128
Definition: clldpattr.h:25
Definition: clldpattr.h:42
Definition: clldpattr.h:35
Definition: clldpattr.h:504
Definition: clldpattr.h:598
Definition: clldpattr.h:416
Definition: clldpattr.h:245
Definition: clldpattr.h:299
Definition: clldpattr.h:67
C++ abstraction for malloc'ed memory areas.
Definition: cmemory.h:44
Definition: clldpattr.h:50
Definition: clldpattr.h:58
Definition: clldpattr.h:23
Definition: croflexception.h:27