ip_mib_module.h
Go to the documentation of this file.
1 /**
2  * @file ip_mib_module.h
3  * @brief IP MIB module
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.4
29  **/
30 
31 #ifndef _IP_MIB_MODULE_H
32 #define _IP_MIB_MODULE_H
33 
34 //Dependencies
35 #include "mibs/mib_common.h"
36 
37 //IP MIB module support
38 #ifndef IP_MIB_SUPPORT
39  #define IP_MIB_SUPPORT DISABLED
40 #elif (IP_MIB_SUPPORT != ENABLED && IP_MIB_SUPPORT != DISABLED)
41  #error IP_MIB_SUPPORT parameter is not valid
42 #endif
43 
44 //Macro definitions
45 #if (IP_MIB_SUPPORT == ENABLED)
46  #define IP_MIB_INC_COUNTER32(name, value) ipMibBase.name += value
47  #define IP_MIB_INC_COUNTER64(name, value) ipMibBase.name += value
48 #else
49  #define IP_MIB_INC_COUNTER32(name, value)
50  #define IP_MIB_INC_COUNTER64(name, value)
51 #endif
52 
53 //C++ guard
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
58 
59 /**
60  * @brief IP forwarding state
61  **/
62 
63 typedef enum
64 {
68 
69 
70 /**
71  * @brief IP status
72  **/
73 
74 typedef enum
75 {
79 
80 
81 /**
82  * @brief IP address type
83  **/
84 
85 typedef enum
86 {
91 
92 
93 /**
94  * @brief IP address origin
95  **/
96 
97 typedef enum
98 {
104 
105 /**
106  * @brief IP address status
107  **/
108 
109 typedef enum
110 {
120 
121 
122 /**
123  * @brief Prefix origin
124  **/
125 
126 typedef enum
127 {
133 
134 
135 /**
136  * @brief Type of mapping
137  **/
138 
139 typedef enum
140 {
147 
148 
149 /**
150  * @brief Entry state
151  **/
152 
153 typedef enum
154 {
163 
164 
165 /**
166  * @brief Router preferences
167  **/
168 
169 typedef enum
170 {
176 
177 
178 /**
179  * @brief System-wide IP statistics
180  **/
181 
182 typedef struct
183 {
230 
231 
232 /**
233  * @brief Per-interface IP statistics
234  **/
235 
236 typedef struct
237 {
283 
284 
285 /**
286  * @brief ICMP statistics
287  **/
288 
289 typedef struct
290 {
291  uint32_t icmpStatsInMsgs;
296 
297 
298 /**
299  * @brief Per-message ICMP statistics
300  **/
301 
302 typedef struct
303 {
304  uint32_t icmpMsgStatsInPkts[256];
305  uint32_t icmpMsgStatsOutPkts[256];
307 
308 
309 /**
310  * @brief IP MIB base
311  **/
312 
313 typedef struct
314 {
317 #if (IPV4_SUPPORT == ENABLED)
318  int32_t ipForwarding;
319  int32_t ipDefaultTTL;
320  int32_t ipReasmTimeout;
326 #endif
327 #if (IPV6_SUPPORT == ENABLED)
336 #endif
337 } IpMibBase;
338 
339 
340 //IP MIB related constants
341 extern IpMibBase ipMibBase;
342 extern const MibObject ipMibObjects[];
343 extern const MibModule ipMibModule;
344 
345 //C++ guard
346 #ifdef __cplusplus
347 }
348 #endif
349 
350 #endif
@ IP_MIB_ROUTER_PREFERENCE_MEDIUM
uint32_t ipIfStatsInDelivers
uint32_t ipIfStatsInOctets
@ IP_MIB_ROUTER_PREFERENCE_RESERVED
uint32_t ipSystemStatsOutMcastOctets
@ IP_MIB_PREFIX_ORIGIN_MANUAL
Per-message ICMP statistics.
uint64_t ipIfStatsHCInMcastPkts
IpMibAddrType
IP address type.
Definition: ip_mib_module.h:86
uint64_t ipIfStatsHCOutMcastPkts
uint32_t ipIfStatsOutOctets
@ IP_MIB_ADDR_STATUS_TENTATIVE
uint64_t ipIfStatsHCInBcastPkts
IpMibIcmpMsgStatsEntry icmpMsgStatsTable
uint32_t ipSystemStatsInUnknownProtos
@ IP_MIB_NET_TO_PHYS_TYPE_INVALID
uint32_t ipSystemStatsOutMcastPkts
int32_t ipv6RouterAdvertSpinLock
uint32_t ipSystemStatsOutTransmits
int32_t ipAddressSpinLock
uint32_t icmpStatsInMsgs
@ IP_MIB_ADDR_TYPE_UNICAST
Definition: ip_mib_module.h:87
uint32_t ipIfStatsReasmFails
uint32_t ipSystemStatsInForwDatagrams
uint64_t ipSystemStatsHCInMcastOctets
int32_t ipReasmTimeout
uint32_t ipIfStatsInNoRoutes
@ IP_MIB_ADDR_TYPE_BROADCAST
Definition: ip_mib_module.h:89
uint64_t ipIfStatsHCOutRequests
@ IP_MIB_NET_TO_PHYS_STATE_PROBE
uint32_t ipSystemStatsInDelivers
uint64_t ipSystemStatsHCInOctets
uint32_t ipSystemStatsOutFragCreates
uint64_t ipIfStatsHCInForwDatagrams
uint64_t ipSystemStatsHCOutRequests
uint32_t ipSystemStatsInReceives
@ IP_MIB_ADDR_ORIGIN_RANDOM
@ IP_MIB_NET_TO_PHYS_STATE_UNKNOWN
#define NET_INTERFACE_COUNT
Definition: net.h:114
uint32_t ipIfStatsOutBcastPkts
@ IP_MIB_NET_TO_PHYS_STATE_INVALID
uint32_t ipSystemStatsReasmFails
ICMP statistics.
uint64_t ipSystemStatsHCOutTransmits
uint32_t ipSystemStatsRefreshRate
IpMibPrefixOrigin
Prefix origin.
uint64_t ipIfStatsHCInReceives
uint32_t ipSystemStatsInMcastOctets
@ IP_MIB_IP_FORWARDING_ENABLED
Definition: ip_mib_module.h:65
uint32_t ipSystemStatsInTruncatedPkts
uint32_t ipSystemStatsOutNoRoutes
uint32_t icmpStatsOutMsgs
int32_t ipv6IpForwarding
uint32_t ipSystemStatsReasmReqds
uint64_t ipSystemStatsHCOutBcastPkts
int32_t ipv6IpDefaultHopLimit
uint32_t ipIfStatsInReceives
uint64_t ipSystemStatsHCOutOctets
uint32_t ipIfStatsOutForwDatagrams
uint32_t ipIfStatsReasmOKs
IpMibAddrOrigin
IP address origin.
Definition: ip_mib_module.h:98
IpMibRouterPreference
Router preferences.
uint32_t ipSystemStatsReasmOKs
uint32_t ipSystemStatsDiscontinuityTime
uint32_t ipSystemStatsOutFragReqds
uint64_t ipSystemStatsHCInForwDatagrams
uint64_t ipSystemStatsHCOutForwDatagrams
@ IP_MIB_PREFIX_ORIGIN_ROUTER_ADV
uint32_t ipv6InterfaceTableLastChange
uint32_t ipIfStatsOutFragReqds
uint64_t ipSystemStatsHCInMcastPkts
@ IP_MIB_ADDR_STATUS_PREFERRED
uint64_t ipSystemStatsHCOutMcastPkts
uint32_t ipSystemStatsOutBcastPkts
@ IP_MIB_ADDR_STATUS_INACCESSIBLE
uint32_t ipIfStatsRefreshRate
uint64_t ipIfStatsHCOutMcastOctets
uint32_t ipSystemStatsInHdrErrors
@ IP_MIB_ADDR_STATUS_OPTIMISTIC
IpMibIpStatus
IP status.
Definition: ip_mib_module.h:75
uint32_t ipIfStatsOutRequests
@ IP_MIB_NET_TO_PHYS_STATE_INCOMPLETE
uint32_t ipSystemStatsOutDiscards
@ IP_MIB_ADDR_ORIGIN_DHCP
@ IP_MIB_ADDR_ORIGIN_LINK_LAYER
uint32_t ipSystemStatsInBcastPkts
@ IP_MIB_NET_TO_PHYS_STATE_REACHABLE
@ IP_MIB_NET_TO_PHYS_TYPE_LOCAL
uint64_t ipIfStatsHCInDelivers
uint32_t ipSystemStatsInMcastPkts
uint32_t ipSystemStatsOutFragFails
@ IP_MIB_ADDR_STATUS_DUPLICATE
uint64_t ipSystemStatsHCInBcastPkts
uint32_t ipIfStatsDiscontinuityTime
IpMibBase ipMibBase
IP MIB base.
Definition: ip_mib_module.c:60
uint32_t icmpStatsInErrors
MIB module.
Definition: mib_common.h:292
uint64_t ipSystemStatsHCOutMcastOctets
uint32_t ipSystemStatsOutOctets
@ IP_MIB_NET_TO_PHYS_STATE_STALE
IpMibIpSystemStatsEntry ipv6SystemStats
uint32_t ipIfStatsTableLastChange
int32_t ipDefaultTTL
@ IP_MIB_ROUTER_PREFERENCE_LOW
uint32_t ipIfStatsInTruncatedPkts
IpMibNetToPhysState
Entry state.
IpMibNetToPhysType
Type of mapping.
uint32_t ipSystemStatsOutFragOKs
System-wide IP statistics.
@ IP_MIB_ROUTER_PREFERENCE_HIGH
uint32_t ipSystemStatsInOctets
uint64_t ipIfStatsHCInOctets
Common definitions for MIB modules.
uint64_t ipSystemStatsHCInReceives
IpMibAddrStatus
IP address status.
uint64_t ipIfStatsHCOutForwDatagrams
uint32_t ipSystemStatsOutForwDatagrams
IpMibIpForwarding
IP forwarding state.
Definition: ip_mib_module.h:64
uint32_t ipIfStatsOutFragOKs
uint64_t ipIfStatsHCOutBcastPkts
uint32_t ipSystemStatsInDiscards
IP MIB base.
const MibObject ipMibObjects[]
IP MIB objects.
Definition: ip_mib_module.c:67
uint64_t ipIfStatsHCOutOctets
@ IP_MIB_IP_STATUS_UP
Definition: ip_mib_module.h:76
int32_t ipForwarding
IpMibIcmpStatsEntry icmpStats
uint32_t ipIfStatsInUnknownProtos
#define MibObject
Definition: mib_common.h:46
IpMibIcmpMsgStatsEntry icmpv6MsgStatsTable
@ IP_MIB_IP_STATUS_DOWN
Definition: ip_mib_module.h:77
@ IP_MIB_NET_TO_PHYS_TYPE_STATIC
const MibModule ipMibModule
IP MIB module.
@ IP_MIB_ADDR_TYPE_ANYCAST
Definition: ip_mib_module.h:88
uint32_t ipIfStatsInAddrErrors
uint32_t ipIfStatsInForwDatagrams
Per-interface IP statistics.
@ IP_MIB_PREFIX_ORIGIN_DHCP
@ IP_MIB_IP_FORWARDING_DISABLED
Definition: ip_mib_module.h:66
uint64_t ipIfStatsHCOutTransmits
uint32_t ipIfStatsOutDiscards
uint32_t ipIfStatsOutMcastOctets
uint32_t ipv4InterfaceTableLastChange
uint32_t ipIfStatsOutFragFails
uint32_t ipIfStatsReasmReqds
uint32_t ipSystemStatsInNoRoutes
uint64_t ipSystemStatsHCInDelivers
@ IP_MIB_ADDR_ORIGIN_MANUAL
Definition: ip_mib_module.h:99
@ IP_MIB_NET_TO_PHYS_TYPE_OTHER
uint32_t ipIfStatsInDiscards
uint32_t ipIfStatsInMcastPkts
@ IP_MIB_NET_TO_PHYS_TYPE_DYNAMIC
@ IP_MIB_NET_TO_PHYS_STATE_DELAY
uint32_t ipIfStatsInMcastOctets
uint32_t ipSystemStatsInAddrErrors
@ IP_MIB_PREFIX_ORIGIN_WELL_KNOWN
@ IP_MIB_ADDR_STATUS_DEPRECATED
uint32_t ipSystemStatsOutRequests
@ IP_MIB_ADDR_STATUS_UNKNOWN
uint32_t ipIfStatsOutTransmits
uint32_t ipIfStatsInHdrErrors
uint32_t ipIfStatsInBcastPkts
uint32_t ipIfStatsOutMcastPkts
@ IP_MIB_ADDR_STATUS_INVALID
uint32_t icmpStatsOutErrors
uint32_t ipIfStatsOutFragCreates
uint64_t ipIfStatsHCInMcastOctets
IpMibIpSystemStatsEntry ipv4SystemStats
IpMibIcmpStatsEntry icmpv6Stats