Zephyr Project
3.0.99

Contents

  • Introduction
  • Getting Started Guide
  • Contribution Guidelines
  • Development and Contribution Process
  • Build and Configuration Systems
  • Application Development
  • API Reference
    • API Status and Guidelines
    • Audio
    • Asynchronous Notifications
    • Bluetooth
    • Controller Area Network (CAN)
    • Crypto
    • Devicetree
    • Device Driver Model
    • Display Interface
    • Error Detection And Correction (EDAC)
    • File Systems
    • Iterable Sections
    • Formatted Output
    • Kernel Services
    • C standard library
    • Logging
    • Memory Management
    • Miscellaneous
    • Data Structures
    • Modbus
    • Networking
      • Network APIs
      • Network Buffer Management
      • Networking Technologies
        • Ethernet
        • IEEE 802.15.4
        • Thread protocol
        • Point-to-Point Protocol (PPP) Support
      • Protocols
      • Network System Management
      • Time Sensitive Networking
      • Generic GSM Modem
    • Peripherals
    • Pin Control
    • Power Management
    • Random Number Generation
    • Resource Management
    • Shell
    • Storage
    • Task Watchdog
    • Time Utilities
    • USB device support
    • User Mode
    • Utilities
    • Settings
    • Executing Time Functions
    • Virtualization
  • User and Developer Guides
  • Security
  • Samples and Demos
  • Supported Boards
  • Release Notes
Zephyr Project
  • »
  • API Reference »
  • Networking »
  • Networking Technologies »
  • Ethernet »
  • Link Layer Discovery Protocol
  • View page source

Link Layer Discovery Protocol¶

  • Overview

  • API Reference

Overview¶

The Link Layer Discovery Protocol (LLDP) is a vendor-neutral link layer protocol used by network devices for advertising their identity, capabilities, and neighbors on a wired Ethernet network.

For more information, see this LLDP Wikipedia article.

API Reference¶

group lldp

LLDP definitions and helpers.

Defines

net_lldp_set_lldpdu(iface)¶

Set LLDP protocol data unit (LLDPDU) for the network interface.

Return

<0 if error, index in lldp array if iface is found there

Parameters
  • iface: Network interface

net_lldp_unset_lldpdu(iface)¶

Unset LLDP protocol data unit (LLDPDU) for the network interface.

Parameters
  • iface: Network interface

Typedefs

typedef enum net_verdict (*net_lldp_recv_cb_t)(struct net_if *iface, struct net_pkt *pkt)¶

LLDP Receive packet callback.

Callback gets called upon receiving packet. It is responsible for freeing packet or indicating to the stack that it needs to free packet by returning correct net_verdict.

Returns:

  • NET_DROP, if packet was invalid, rejected or we want the stack to free it. In this case the core stack will free the packet.

  • NET_OK, if the packet was accepted, in this case the ownership of the net_pkt goes to callback and core network stack will forget it.

Enums

enum net_lldp_tlv_type¶

TLV Types. Please refer to table 8-1 from IEEE 802.1AB standard.

Values:

enumerator LLDP_TLV_END_LLDPDU = 0¶

End Of LLDPDU (optional)

enumerator LLDP_TLV_CHASSIS_ID = 1¶

Chassis ID (mandatory)

enumerator LLDP_TLV_PORT_ID = 2¶

Port ID (mandatory)

enumerator LLDP_TLV_TTL = 3¶

Time To Live (mandatory)

enumerator LLDP_TLV_PORT_DESC = 4¶

Port Description (optional)

enumerator LLDP_TLV_SYSTEM_NAME = 5¶

System Name (optional)

enumerator LLDP_TLV_SYSTEM_DESC = 6¶

System Description (optional)

enumerator LLDP_TLV_SYSTEM_CAPABILITIES = 7¶

System Capability (optional)

enumerator LLDP_TLV_MANAGEMENT_ADDR = 8¶

Management Address (optional)

enumerator LLDP_TLV_ORG_SPECIFIC = 127¶

Org specific TLVs (optional)

Functions

int net_lldp_config(struct net_if *iface, const struct net_lldpdu *lldpdu)¶

Set the LLDP data unit for a network interface.

Return

0 if ok, <0 if error

Parameters
  • iface: Network interface

  • lldpdu: LLDP data unit struct

int net_lldp_config_optional(struct net_if *iface, const uint8_t *tlv, size_t len)¶

Set the Optional LLDP TLVs for a network interface.

Return

0 if ok, <0 if error

Parameters
  • iface: Network interface

  • tlv: LLDP optional TLVs following mandatory part

  • len: Length of the optional TLVs

void net_lldp_init(void)¶

Initialize LLDP engine.

int net_lldp_register_callback(struct net_if *iface, net_lldp_recv_cb_t cb)¶

Register LLDP Rx callback function.

Return

0 if ok, < 0 if error

Parameters
  • iface: Network interface

  • cb: Callback function

enum net_verdict net_lldp_recv(struct net_if *iface, struct net_pkt *pkt)¶

Parse LLDP packet.

Return

Return the policy for network buffer

Parameters
  • iface: Network interface

  • pkt: Network packet

struct net_lldp_chassis_tlv¶
#include <lldp.h>

Chassis ID TLV, see chapter 8.5.2 in IEEE 802.1AB

Public Members

uint16_t type_length¶

7 bits for type, 9 bits for length

uint8_t subtype¶

ID subtype

uint8_t value[NET_LLDP_CHASSIS_ID_VALUE_LEN]¶

Chassis ID value

struct net_lldp_port_tlv¶
#include <lldp.h>

Port ID TLV, see chapter 8.5.3 in IEEE 802.1AB

Public Members

uint16_t type_length¶

7 bits for type, 9 bits for length

uint8_t subtype¶

ID subtype

uint8_t value[NET_LLDP_PORT_ID_VALUE_LEN]¶

Port ID value

struct net_lldp_time_to_live_tlv¶
#include <lldp.h>

Time To Live TLV, see chapter 8.5.4 in IEEE 802.1AB

Public Members

uint16_t type_length¶

7 bits for type, 9 bits for length

uint16_t ttl¶

Time To Live (TTL) value

struct net_lldpdu¶
#include <lldp.h>

LLDP Data Unit (LLDPDU) shall contain the following ordered TLVs as stated in “8.2 LLDPDU format” from the IEEE 802.1AB

Public Members

struct net_lldp_chassis_tlv chassis_id¶

Mandatory Chassis TLV

struct net_lldp_port_tlv port_id¶

Mandatory Port TLV

struct net_lldp_time_to_live_tlv ttl¶

Mandatory TTL TLV

Next Previous

© Copyright 2015-2022 Zephyr Project members and individual contributors. Last updated on May 10, 2022.

Zephyr Project
ZCAN IOT SDK
ZCAN Xlib
MCUboot
SOF
Kconfig Reference