diff options
Diffstat (limited to 'include/netlink/route/link.h')
-rw-r--r-- | include/netlink/route/link.h | 142 |
1 files changed, 76 insertions, 66 deletions
diff --git a/include/netlink/route/link.h b/include/netlink/route/link.h index 2e5274a..79c2d56 100644 --- a/include/netlink/route/link.h +++ b/include/netlink/route/link.h @@ -21,77 +21,86 @@ extern "C" { #endif +/** + * @struct rtnl_link link.h "netlink/route/link.h" + * @brief Link object + * @implements nl_object + * @ingroup link + * + * @copydoc private_struct + */ struct rtnl_link; -enum rtnl_link_st { - RTNL_LINK_RX_PACKETS, - RTNL_LINK_TX_PACKETS, - RTNL_LINK_RX_BYTES, - RTNL_LINK_TX_BYTES, - RTNL_LINK_RX_ERRORS, - RTNL_LINK_TX_ERRORS, - RTNL_LINK_RX_DROPPED, - RTNL_LINK_TX_DROPPED, - RTNL_LINK_RX_COMPRESSED, - RTNL_LINK_TX_COMPRESSED, - RTNL_LINK_RX_FIFO_ERR, - RTNL_LINK_TX_FIFO_ERR, - RTNL_LINK_RX_LEN_ERR, - RTNL_LINK_RX_OVER_ERR, - RTNL_LINK_RX_CRC_ERR, - RTNL_LINK_RX_FRAME_ERR, - RTNL_LINK_RX_MISSED_ERR, - RTNL_LINK_TX_ABORT_ERR, - RTNL_LINK_TX_CARRIER_ERR, - RTNL_LINK_TX_HBEAT_ERR, - RTNL_LINK_TX_WIN_ERR, - RTNL_LINK_COLLISIONS, - RTNL_LINK_MULTICAST, - RTNL_LINK_IP6_INPKTS, /* InReceives */ - RTNL_LINK_IP6_INHDRERRORS, /* InHdrErrors */ - RTNL_LINK_IP6_INTOOBIGERRORS, /* InTooBigErrors */ - RTNL_LINK_IP6_INNOROUTES, /* InNoRoutes */ - RTNL_LINK_IP6_INADDRERRORS, /* InAddrErrors */ - RTNL_LINK_IP6_INUNKNOWNPROTOS, /* InUnknownProtos */ - RTNL_LINK_IP6_INTRUNCATEDPKTS, /* InTruncatedPkts */ - RTNL_LINK_IP6_INDISCARDS, /* InDiscards */ - RTNL_LINK_IP6_INDELIVERS, /* InDelivers */ - RTNL_LINK_IP6_OUTFORWDATAGRAMS, /* OutForwDatagrams */ - RTNL_LINK_IP6_OUTPKTS, /* OutRequests */ - RTNL_LINK_IP6_OUTDISCARDS, /* OutDiscards */ - RTNL_LINK_IP6_OUTNOROUTES, /* OutNoRoutes */ - RTNL_LINK_IP6_REASMTIMEOUT, /* ReasmTimeout */ - RTNL_LINK_IP6_REASMREQDS, /* ReasmReqds */ - RTNL_LINK_IP6_REASMOKS, /* ReasmOKs */ - RTNL_LINK_IP6_REASMFAILS, /* ReasmFails */ - RTNL_LINK_IP6_FRAGOKS, /* FragOKs */ - RTNL_LINK_IP6_FRAGFAILS, /* FragFails */ - RTNL_LINK_IP6_FRAGCREATES, /* FragCreates */ - RTNL_LINK_IP6_INMCASTPKTS, /* InMcastPkts */ - RTNL_LINK_IP6_OUTMCASTPKTS, /* OutMcastPkts */ - RTNL_LINK_IP6_INBCASTPKTS, /* InBcastPkts */ - RTNL_LINK_IP6_OUTBCASTPKTS, /* OutBcastPkts */ - RTNL_LINK_IP6_INOCTETS, /* InOctets */ - RTNL_LINK_IP6_OUTOCTETS, /* OutOctets */ - RTNL_LINK_IP6_INMCASTOCTETS, /* InMcastOctets */ - RTNL_LINK_IP6_OUTMCASTOCTETS, /* OutMcastOctets */ - RTNL_LINK_IP6_INBCASTOCTETS, /* InBcastOctets */ - RTNL_LINK_IP6_OUTBCASTOCTETS, /* OutBcastOctets */ - RTNL_LINK_ICMP6_INMSGS, /* InMsgs */ - RTNL_LINK_ICMP6_INERRORS, /* InErrors */ - RTNL_LINK_ICMP6_OUTMSGS, /* OutMsgs */ - RTNL_LINK_ICMP6_OUTERRORS, /* OutErrors */ +/** + * @ingroup link + */ +typedef enum { + RTNL_LINK_RX_PACKETS, /*!< Packets received */ + RTNL_LINK_TX_PACKETS, /*!< Packets sent */ + RTNL_LINK_RX_BYTES, /*!< Bytes received */ + RTNL_LINK_TX_BYTES, /*!< Bytes sent */ + RTNL_LINK_RX_ERRORS, /*!< Receive errors */ + RTNL_LINK_TX_ERRORS, /*!< Send errors */ + RTNL_LINK_RX_DROPPED, /*!< Received packets dropped */ + RTNL_LINK_TX_DROPPED, /*!< Packets dropped during transmit */ + RTNL_LINK_RX_COMPRESSED, /*!< Compressed packets received */ + RTNL_LINK_TX_COMPRESSED, /*!< Compressed packets sent */ + RTNL_LINK_RX_FIFO_ERR, /*!< Receive FIFO errors */ + RTNL_LINK_TX_FIFO_ERR, /*!< Send FIFO errors */ + RTNL_LINK_RX_LEN_ERR, /*!< Length errors */ + RTNL_LINK_RX_OVER_ERR, /*!< Over errors */ + RTNL_LINK_RX_CRC_ERR, /*!< CRC errors */ + RTNL_LINK_RX_FRAME_ERR, /*!< Frame errors */ + RTNL_LINK_RX_MISSED_ERR, /*!< Missed errors */ + RTNL_LINK_TX_ABORT_ERR, /*!< Aborted errors */ + RTNL_LINK_TX_CARRIER_ERR, /*!< Carrier errors */ + RTNL_LINK_TX_HBEAT_ERR, /*!< Heartbeat errors */ + RTNL_LINK_TX_WIN_ERR, /*!< Window errors */ + RTNL_LINK_COLLISIONS, /*!< Send collisions */ + RTNL_LINK_MULTICAST, /*!< Multicast */ + RTNL_LINK_IP6_INPKTS, /*!< IPv6 SNMP InReceives */ + RTNL_LINK_IP6_INHDRERRORS, /*!< IPv6 SNMP InHdrErrors */ + RTNL_LINK_IP6_INTOOBIGERRORS, /*!< IPv6 SNMP InTooBigErrors */ + RTNL_LINK_IP6_INNOROUTES, /*!< IPv6 SNMP InNoRoutes */ + RTNL_LINK_IP6_INADDRERRORS, /*!< IPv6 SNMP InAddrErrors */ + RTNL_LINK_IP6_INUNKNOWNPROTOS, /*!< IPv6 SNMP InUnknownProtos */ + RTNL_LINK_IP6_INTRUNCATEDPKTS, /*!< IPv6 SNMP InTruncatedPkts */ + RTNL_LINK_IP6_INDISCARDS, /*!< IPv6 SNMP InDiscards */ + RTNL_LINK_IP6_INDELIVERS, /*!< IPv6 SNMP InDelivers */ + RTNL_LINK_IP6_OUTFORWDATAGRAMS, /*!< IPv6 SNMP OutForwDatagrams */ + RTNL_LINK_IP6_OUTPKTS, /*!< IPv6 SNMP OutRequests */ + RTNL_LINK_IP6_OUTDISCARDS, /*!< IPv6 SNMP OutDiscards */ + RTNL_LINK_IP6_OUTNOROUTES, /*!< IPv6 SNMP OutNoRoutes */ + RTNL_LINK_IP6_REASMTIMEOUT, /*!< IPv6 SNMP ReasmTimeout */ + RTNL_LINK_IP6_REASMREQDS, /*!< IPv6 SNMP ReasmReqds */ + RTNL_LINK_IP6_REASMOKS, /*!< IPv6 SNMP ReasmOKs */ + RTNL_LINK_IP6_REASMFAILS, /*!< IPv6 SNMP ReasmFails */ + RTNL_LINK_IP6_FRAGOKS, /*!< IPv6 SNMP FragOKs */ + RTNL_LINK_IP6_FRAGFAILS, /*!< IPv6 SNMP FragFails */ + RTNL_LINK_IP6_FRAGCREATES, /*!< IPv6 SNMP FragCreates */ + RTNL_LINK_IP6_INMCASTPKTS, /*!< IPv6 SNMP InMcastPkts */ + RTNL_LINK_IP6_OUTMCASTPKTS, /*!< IPv6 SNMP OutMcastPkts */ + RTNL_LINK_IP6_INBCASTPKTS, /*!< IPv6 SNMP InBcastPkts */ + RTNL_LINK_IP6_OUTBCASTPKTS, /*!< IPv6 SNMP OutBcastPkts */ + RTNL_LINK_IP6_INOCTETS, /*!< IPv6 SNMP InOctets */ + RTNL_LINK_IP6_OUTOCTETS, /*!< IPv6 SNMP OutOctets */ + RTNL_LINK_IP6_INMCASTOCTETS, /*!< IPv6 SNMP InMcastOctets */ + RTNL_LINK_IP6_OUTMCASTOCTETS, /*!< IPv6 SNMP OutMcastOctets */ + RTNL_LINK_IP6_INBCASTOCTETS, /*!< IPv6 SNMP InBcastOctets */ + RTNL_LINK_IP6_OUTBCASTOCTETS, /*!< IPv6 SNMP OutBcastOctets */ + RTNL_LINK_ICMP6_INMSGS, /*!< ICMPv6 SNMP InMsgs */ + RTNL_LINK_ICMP6_INERRORS, /*!< ICMPv6 SNMP InErrors */ + RTNL_LINK_ICMP6_OUTMSGS, /*!< ICMPv6 SNMP OutMsgs */ + RTNL_LINK_ICMP6_OUTERRORS, /*!< ICMPv6 SNMP OutErrors */ __RTNL_LINK_STATS_MAX, -}; +} rtnl_link_stat_id_t; #define RTNL_LINK_STATS_MAX (__RTNL_LINK_STATS_MAX - 1) -/* link object allocation/freeage */ extern struct rtnl_link *rtnl_link_alloc(void); extern void rtnl_link_put(struct rtnl_link *); extern void rtnl_link_free(struct rtnl_link *); -/* link cache management */ extern int rtnl_link_alloc_cache(struct nl_sock *, int, struct nl_cache **); extern struct rtnl_link *rtnl_link_get(struct nl_cache *, int); extern struct rtnl_link *rtnl_link_get_by_name(struct nl_cache *, const char *); @@ -149,9 +158,6 @@ extern unsigned int rtnl_link_get_mtu(struct rtnl_link *); extern void rtnl_link_set_txqlen(struct rtnl_link *, unsigned int); extern unsigned int rtnl_link_get_txqlen(struct rtnl_link *); -extern void rtnl_link_set_weight(struct rtnl_link *, unsigned int); -extern unsigned int rtnl_link_get_weight(struct rtnl_link *); - extern void rtnl_link_set_ifindex(struct rtnl_link *, int); extern int rtnl_link_get_ifindex(struct rtnl_link *); @@ -184,15 +190,19 @@ extern void rtnl_link_set_ifalias(struct rtnl_link *, const char *); extern int rtnl_link_get_num_vf(struct rtnl_link *, uint32_t *); -extern uint64_t rtnl_link_get_stat(struct rtnl_link *, int); -extern int rtnl_link_set_stat(struct rtnl_link *, const unsigned int, +extern uint64_t rtnl_link_get_stat(struct rtnl_link *, rtnl_link_stat_id_t); +extern int rtnl_link_set_stat(struct rtnl_link *, rtnl_link_stat_id_t, const uint64_t); extern int rtnl_link_set_type(struct rtnl_link *, const char *); extern char * rtnl_link_get_type(struct rtnl_link *); +/* deprecated */ extern int rtnl_link_set_info_type(struct rtnl_link *, const char *) __attribute__((deprecated)); extern char * rtnl_link_get_info_type(struct rtnl_link *) __attribute__((deprecated)); +extern void rtnl_link_set_weight(struct rtnl_link *, unsigned int) __attribute__((deprecated)); +extern unsigned int rtnl_link_get_weight(struct rtnl_link *) __attribute__((deprecated)); + #ifdef __cplusplus } |