|
The Assimilation Monitoring Project
|
Implements minimal client-oriented LLDP capabilities. More...

Go to the source code of this file.
Macros | |
| #define | DIMOF(a) (sizeof(a)/sizeof(a[0])) |
| #define | NETTLV_INITPKTOFFSET 14 |
| #define | NETTLV_HDRSZ 2 |
Functions | |
| guint8 | get_lldptlv_type (const void *tlv_vp, const void *pktend) |
| Return the 'Type' of the given LLDP TLV entry The Type is the high order 7 bits from the zeroth byte in the TLV entry. More... | |
| gsize | get_lldptlv_len (const void *tlv_vp, const void *pktend) |
| Return the 'Length' of the given LLDP TLV entry. More... | |
| const void * | get_lldptlv_body (const void *tlv_vp, const void *pktend) |
| Return the 'Value' of the given LLDP TLV entry. More... | |
| gboolean | is_valid_lldp_packet (const void *tlv_vp, const void *pktend) |
| const void * | get_lldptlv_first (const void *packet, const void *pktend) |
| const void * | get_lldptlv_next (const void *tlv_vp, const void *pktend) |
| Return pointer to the next LLDP TLV entry after the current location. More... | |
| const void * | find_next_lldptlv_type (const void *tlv_vp, unsigned tlvtype, const void *pktend) |
| Return pointer to the next LLDP entry of the given type at or after the current location. More... | |
| const void * | get_lldp_chassis_id (gconstpointer tlv_vp, gssize *idlength, gconstpointer pktend) |
| Return a pointer to the chassis id Value entry, and its length. More... | |
| const void * | get_lldp_port_id (gconstpointer tlv_vp, gssize *idlength, gconstpointer pktend) |
| Return a pointer to the port id Value entry, and its length. More... | |
Implements minimal client-oriented LLDP capabilities.
This file contains the minimal LLDP capability for a client - enough for it to be able to understand and validate a CDP packet's structure, return any particular TLV and specifically to be able to locate the chassis id and port id (which the client needs).
This file is part of the Assimilation Project.
The Assimilation software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with the Assimilation Project software. If not, see http://www.gnu.org/licenses/
Definition in file lldp_min.c.
| #define DIMOF | ( | a | ) | (sizeof(a)/sizeof(a[0])) |
Definition at line 30 of file lldp_min.c.
Referenced by _childprocess_childexit(), _childprocess_timeout(), _nano_send_rscexitstatus(), _netaddr_string_ipv4_new(), _netaddr_string_ipv6_new(), _resourcelsb_child_notify(), _resourceocf_outputs_string(), _switchdiscovery_cache_info(), daemonize_me(), fakecma_startup(), get_cdp_type_string(), is_valid_cdp_packet(), is_valid_generic_tlv_packet(), is_valid_lldp_packet(), main(), nano_packet_decoder(), packetdecoder_new(), resourcecmd_new(), test_invalid_queuecmd(), test_invalid_resourcecmd(), test_safe_ocfops(), test_safe_queue_lsbops(), and test_safe_queue_ocfops().
| const void* find_next_lldptlv_type | ( | const void * | tlv_vp, |
| unsigned | tlvtype, | ||
| const void * | pktend | ||
| ) |
Return pointer to the next LLDP entry of the given type at or after the current location.
| [in] | tlv_vp | Pointer to the current TLV |
| [in] | tlvtype | Type of TLV we're looking for |
| [in] | pktend | Pointer to first byte beyond the packet. |
Definition at line 208 of file lldp_min.c.
References get_lldptlv_next(), get_lldptlv_type(), and NETTLV_HDRSZ.
Referenced by get_lldp_chassis_id(), and get_lldp_port_id().


| const void* get_lldp_chassis_id | ( | gconstpointer | tlv_vp, |
| gssize * | idlength, | ||
| gconstpointer | pktend | ||
| ) |
Return a pointer to the chassis id Value entry, and its length.
| [in] | tlv_vp | Pointer to beginning of LLDP packet |
| [out] | idlength | Length of the chassis id |
| [in] | pktend | Pointer to first byte beyond packet. |
Definition at line 224 of file lldp_min.c.
References find_next_lldptlv_type(), get_lldptlv_body(), get_lldptlv_first(), get_lldptlv_len(), and LLDP_TLV_CHID.

| const void* get_lldp_port_id | ( | gconstpointer | tlv_vp, |
| gssize * | idlength, | ||
| gconstpointer | pktend | ||
| ) |
Return a pointer to the port id Value entry, and its length.
| [in] | tlv_vp | Pointer to beginning of LLDP packet |
| [out] | idlength | Length of the port id value |
| [in] | pktend | Pointer to first byte beyond packet. |
Definition at line 241 of file lldp_min.c.
References find_next_lldptlv_type(), get_lldptlv_body(), get_lldptlv_first(), get_lldptlv_len(), and LLDP_TLV_PID.

| const void* get_lldptlv_body | ( | const void * | tlv_vp, |
| const void * | pktend | ||
| ) |
Return the 'Value' of the given LLDP TLV entry.
| [in] | tlv_vp | Pointer to beginning of TLV entry, |
| [in] | pktend | Pointer to one byte past end of packet |
Definition at line 106 of file lldp_min.c.
References NETTLV_HDRSZ.
Referenced by cma.AssimCclasses.pySwitchDiscovery::decode_discovery(), dump_lldp_packet(), get_lldp_chassis_id(), get_lldp_port_id(), and is_valid_lldp_packet().

| const void* get_lldptlv_first | ( | const void * | packet, |
| const void * | pktend | ||
| ) |
| [in] | packet | Pointer to beginning of LLDP packet |
| [in] | pktend | Pointer to first byte after the end of the LLDP packet |
Definition at line 174 of file lldp_min.c.
References get_lldptlv_len(), NETTLV_HDRSZ, and NETTLV_INITPKTOFFSET.
Referenced by cma.AssimCclasses.pySwitchDiscovery::decode_discovery(), dump_lldp_packet(), get_lldp_chassis_id(), get_lldp_port_id(), and is_valid_lldp_packet().


| gsize get_lldptlv_len | ( | const void * | tlv_vp, |
| const void * | pktend | ||
| ) |
Return the 'Length' of the given LLDP TLV entry.
The length is the low order bit from the zeroth byte plus all 8 bits of the second byte
| [in] | tlv_vp | Pointer to beginning of TLV entry |
| [in] | pktend | Pointer to one byte past end of packet |
Definition at line 93 of file lldp_min.c.
References cma.tests.cma_test::byte1, and tlv_get_guint8().
Referenced by cma.AssimCclasses.pySwitchDiscovery::decode_discovery(), dump_lldp_packet(), get_lldp_chassis_id(), get_lldp_port_id(), get_lldptlv_first(), get_lldptlv_next(), and is_valid_lldp_packet().


| const void* get_lldptlv_next | ( | const void * | tlv_vp, |
| const void * | pktend | ||
| ) |
Return pointer to the next LLDP TLV entry after the current location.
| [in] | tlv_vp | Pointer to current LLDP TLV entry |
| [in] | pktend | Pointer to first byte after the end of the LLDP packet |
Definition at line 188 of file lldp_min.c.
References get_lldptlv_len(), get_lldptlv_type(), LLDP_TLV_END, and NETTLV_HDRSZ.
Referenced by cma.AssimCclasses.pySwitchDiscovery::decode_discovery(), dump_lldp_packet(), find_next_lldptlv_type(), and is_valid_lldp_packet().


| guint8 get_lldptlv_type | ( | const void * | tlv_vp, |
| const void * | pktend | ||
| ) |
Return the 'Type' of the given LLDP TLV entry The Type is the high order 7 bits from the zeroth byte in the TLV entry.
| [in] | tlv_vp | Pointer to beginning of TLV entry |
| [in] | pktend | Pointer to one byte past end of packet |
Definition at line 83 of file lldp_min.c.
References tlv_get_guint8().
Referenced by cma.AssimCclasses.pySwitchDiscovery::decode_discovery(), dump_lldp_packet(), find_next_lldptlv_type(), get_lldptlv_next(), and is_valid_lldp_packet().


| gboolean is_valid_lldp_packet | ( | const void * | tlv_vp, |
| const void * | pktend | ||
| ) |
Definition at line 116 of file lldp_min.c.
References DIMOF, get_lldptlv_body(), get_lldptlv_first(), get_lldptlv_len(), get_lldptlv_next(), get_lldptlv_type(), LLDP_TLV_CHID, LLDP_TLV_END, LLDP_TLV_PID, LLDP_TLV_TTL, and NETTLV_HDRSZ.
Referenced by cma.AssimCclasses.pySwitchDiscovery::decode_discovery(), and dump_lldp_packet().

