LCOV - code coverage report
Current view: top level - zephyr/net - socket_net_mgmt.h Coverage Total Hit
Test: new.info Lines: 100.0 % 13 13
Test Date: 2025-09-05 22:20:39

            Line data    Source code
       1            1 : /** @file
       2              :  * @brief NET_MGMT socket definitions.
       3              :  *
       4              :  * Definitions for NET_MGMT socket support.
       5              :  */
       6              : 
       7              : /*
       8              :  * Copyright (c) 2019 Intel Corporation
       9              :  *
      10              :  * SPDX-License-Identifier: Apache-2.0
      11              :  */
      12              : 
      13              : #ifndef ZEPHYR_INCLUDE_NET_SOCKET_NET_MGMT_H_
      14              : #define ZEPHYR_INCLUDE_NET_SOCKET_NET_MGMT_H_
      15              : 
      16              : #include <zephyr/types.h>
      17              : #include <zephyr/net/net_ip.h>
      18              : #include <zephyr/net/net_if.h>
      19              : #include <zephyr/net/net_mgmt.h>
      20              : 
      21              : #ifdef __cplusplus
      22              : extern "C" {
      23              : #endif
      24              : 
      25              : /**
      26              :  * @brief Socket NET_MGMT library
      27              :  * @defgroup socket_net_mgmt Socket NET_MGMT library
      28              :  * @since 2.0
      29              :  * @version 0.1.0
      30              :  * @ingroup networking
      31              :  * @{
      32              :  */
      33              : 
      34              : /** @cond INTERNAL_HIDDEN */
      35              : 
      36              : /* Protocols of the protocol family PF_NET_MGMT */
      37              : #define NET_MGMT_EVENT_PROTO 0x01
      38              : 
      39              : /* Socket NET_MGMT options */
      40              : #define SOL_NET_MGMT_BASE 100
      41              : #define SOL_NET_MGMT_RAW (SOL_NET_MGMT_BASE + 1)
      42              : 
      43              : /** @endcond */
      44              : 
      45              : /**
      46              :  * @name Socket options for NET_MGMT sockets
      47              :  * @{
      48              :  */
      49              : 
      50              : /** Set Ethernet Qav parameters */
      51            1 : #define SO_NET_MGMT_ETHERNET_SET_QAV_PARAM 1
      52              : 
      53              : /** Get Ethernet Qav parameters */
      54            1 : #define SO_NET_MGMT_ETHERNET_GET_QAV_PARAM 2
      55              : 
      56              : /** @} */ /* for @name */
      57              : 
      58              : /**
      59              :  * struct sockaddr_nm - The sockaddr structure for NET_MGMT sockets
      60              :  *
      61              :  * Similar concepts are used as in Linux AF_NETLINK. The NETLINK name is not
      62              :  * used in order to avoid confusion between Zephyr and Linux as the
      63              :  * implementations are different.
      64              :  *
      65              :  * The socket domain (address family) is AF_NET_MGMT, and the type of socket
      66              :  * is either SOCK_RAW or SOCK_DGRAM, because this is a datagram-oriented
      67              :  * service.
      68              :  *
      69              :  * The protocol (protocol type) selects for which feature the socket is used.
      70              :  *
      71              :  * When used with bind(), the nm_pid field of the sockaddr_nm can be
      72              :  * filled with the calling thread' own id. The nm_pid serves here as the local
      73              :  * address of this net_mgmt socket. The application is responsible for picking
      74              :  * a unique integer value to fill in nm_pid.
      75              :  */
      76            1 : struct sockaddr_nm {
      77              :         /** AF_NET_MGMT address family. */
      78            1 :         sa_family_t nm_family;
      79              : 
      80              :         /** Network interface related to this address */
      81            1 :         int nm_ifindex;
      82              : 
      83              :         /** Thread id or similar that is used to separate the different
      84              :          * sockets. Application can decide how the pid is constructed.
      85              :          */
      86            1 :         uintptr_t nm_pid;
      87              : 
      88              :         /** net_mgmt mask */
      89            1 :         uint64_t nm_mask;
      90              : };
      91              : 
      92              : 
      93              : /**
      94              :  * Each network management message is prefixed with this header.
      95              :  */
      96            1 : struct net_mgmt_msghdr {
      97              :         /** Network management version */
      98            1 :         uint32_t nm_msg_version;
      99              : 
     100              :         /** Length of the data */
     101            1 :         uint32_t nm_msg_len;
     102              : 
     103              :         /** The actual message data follows */
     104            1 :         uint8_t nm_msg[];
     105              : };
     106              : 
     107              : /**
     108              :  * Version of the message is placed to the header. Currently we have
     109              :  * following versions.
     110              :  *
     111              :  * Network management message versions:
     112              :  *
     113              :  *  0x0001 : The net_mgmt event info message follows directly
     114              :  *           after the header.
     115              :  */
     116            1 : #define NET_MGMT_SOCKET_VERSION_1 0x0001
     117              : 
     118              : /**
     119              :  * @}
     120              :  */
     121              : 
     122              : #ifdef __cplusplus
     123              : }
     124              : #endif
     125              : 
     126              : #endif /* ZEPHYR_INCLUDE_NET_SOCKET_NET_MGMT_H_ */
        

Generated by: LCOV version 2.0-1