if_mib_module.h
Go to the documentation of this file.
1 /**
2  * @file if_mib_module.h
3  * @brief Interfaces Group 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 _IF_MIB_MODULE_H
32 #define _IF_MIB_MODULE_H
33 
34 //Dependencies
35 #include "mibs/mib_common.h"
36 
37 //Interfaces Group MIB module support
38 #ifndef IF_MIB_SUPPORT
39  #define IF_MIB_SUPPORT DISABLED
40 #elif (IF_MIB_SUPPORT != ENABLED && IF_MIB_SUPPORT != DISABLED)
41  #error IF_MIB_SUPPORT parameter is not valid
42 #endif
43 
44 //Macro definitions
45 #if (IF_MIB_SUPPORT == ENABLED)
46  #define IF_MIB_SET_TIME_TICKS(name, value) ifMibBase.name = value
47  #define IF_MIB_INC_COUNTER32(name, value) ifMibBase.name += value
48  #define IF_MIB_INC_COUNTER64(name, value) ifMibBase.name += value
49 #else
50  #define IF_MIB_SET_TIME_TICKS(name, value)
51  #define IF_MIB_INC_COUNTER32(name, value)
52  #define IF_MIB_INC_COUNTER64(name, value)
53 #endif
54 
55 //C++ guard
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 
60 
61 /**
62  * @brief Interface types
63  **/
64 
65 typedef enum
66 {
84 
85 
86 /**
87  * @brief The desired state of the interface
88  **/
89 
90 typedef enum
91 {
96 
97 
98 /**
99  * @brief The operational state of the interface
100  **/
101 
102 typedef enum
103 {
108 
109 
110 /**
111  * @brief Enable linkUp/linkDown traps
112  **/
113 
114 typedef enum
115 {
119 
120 
121 /**
122  * @brief Address type
123  **/
124 
125 typedef enum
126 {
131 
132 
133 /**
134  * @brief Interfaces table entry
135  **/
136 
137 typedef struct
138 {
139  uint32_t ifLastChange;
140  uint32_t ifInOctets;
141  uint32_t ifInUcastPkts;
142  uint32_t ifInDiscards;
143  uint32_t ifInErrors;
145  uint32_t ifOutOctets;
146  uint32_t ifOutUcastPkts;
147  uint32_t ifOutDiscards;
148  uint32_t ifOutErrors;
149 } IfMibIfEntry;
150 
151 
152 /**
153  * @brief Extension to the interface table
154  **/
155 
156 typedef struct
157 {
162  uint64_t ifHCInOctets;
163  uint64_t ifHCInUcastPkts;
166  uint64_t ifHCOutOctets;
173 } IfMibIfXEntry;
174 
175 
176 /**
177  * @brief Interfaces Group MIB base
178  **/
179 
180 typedef struct
181 {
182  int32_t ifNumber;
187 } IfMibBase;
188 
189 
190 //Interfaces Group MIB related constants
191 extern IfMibBase ifMibBase;
192 extern const MibObject ifMibObjects[];
193 extern const MibModule ifMibModule;
194 
195 //C++ guard
196 #ifdef __cplusplus
197 }
198 #endif
199 
200 #endif
uint64_t ifHCInUcastPkts
uint32_t ifLastChange
uint64_t ifHCInMulticastPkts
@ IF_MIB_IF_TYPE_L2_VLAN
Definition: if_mib_module.h:78
uint64_t ifHCInOctets
@ IF_MIB_IF_TYPE_PARA
Definition: if_mib_module.h:74
@ IF_MIB_IF_ADMIN_STATUS_DOWN
Definition: if_mib_module.h:93
IfMibIfAdminStatus
The desired state of the interface.
Definition: if_mib_module.h:91
IfMibIfType
Interface types.
Definition: if_mib_module.h:66
int32_t ifNumber
const MibModule ifMibModule
Interfaces Group MIB module.
int32_t ifLinkUpDownTrapEnable
@ IF_MIB_IF_LINK_UP_DOWN_TRAP_ENABLED
uint32_t ifOutErrors
@ IF_MIB_RCV_ADDRESS_TYPE_VOLATILE
#define NET_INTERFACE_COUNT
Definition: net.h:114
@ IF_MIB_IF_LINK_UP_DOWN_TRAP_DISABLED
uint32_t ifInErrors
int32_t ifPromiscuousMode
IfMibRcvAddressType
Address type.
uint32_t ifInUnknownProtos
Extension to the interface table.
@ IF_MIB_IF_TYPE_ETHERNET_CSMACD
Definition: if_mib_module.h:68
uint32_t ifInMulticastPkts
uint64_t ifHCInBroadcastPkts
@ IF_MIB_IF_TYPE_RS232
Definition: if_mib_module.h:73
uint64_t ifHCOutMulticastPkts
uint32_t ifTableLastChange
uint32_t ifOutUcastPkts
@ IF_MIB_IF_TYPE_IEEE_802_11
Definition: if_mib_module.h:75
@ IF_MIB_IF_TYPE_PPP
Definition: if_mib_module.h:70
@ IF_MIB_IF_TYPE_TUNNEL
Definition: if_mib_module.h:77
uint64_t ifHCOutUcastPkts
@ IF_MIB_IF_TYPE_OTHER
Definition: if_mib_module.h:67
@ IF_MIB_IF_TYPE_USB
Definition: if_mib_module.h:79
@ IF_MIB_IF_ADMIN_STATUS_TESTING
Definition: if_mib_module.h:94
@ IF_MIB_IF_TYPE_PLC
Definition: if_mib_module.h:80
@ IF_MIB_RCV_ADDRESS_TYPE_NON_VOLATILE
@ IF_MIB_IF_OPER_STATUS_UP
MIB module.
Definition: mib_common.h:292
int32_t ifConnectorPresent
@ IF_MIB_IF_TYPE_HDLC
Definition: if_mib_module.h:76
uint32_t ifOutMulticastPkts
@ IF_MIB_IF_TYPE_SLIP
Definition: if_mib_module.h:72
uint32_t ifStackLastChange
uint64_t ifHCOutBroadcastPkts
@ IF_MIB_IF_OPER_STATUS_DOWN
uint32_t ifInDiscards
@ IF_MIB_IF_TYPE_BRIDGE
Definition: if_mib_module.h:81
Common definitions for MIB modules.
uint32_t ifInOctets
@ IF_MIB_RCV_ADDRESS_TYPE_OTHER
IfMibIfLinkUpDownEnable
Enable linkUp/linkDown traps.
const MibObject ifMibObjects[]
Interfaces Group MIB objects.
Definition: if_mib_module.c:66
#define MibObject
Definition: mib_common.h:46
@ IF_MIB_IF_TYPE_PROP_PTP_SERIAL
Definition: if_mib_module.h:69
@ IF_MIB_IF_ADMIN_STATUS_UP
Definition: if_mib_module.h:92
@ IF_MIB_IF_OPER_STATUS_TESTING
Interfaces table entry.
uint32_t ifInBroadcastPkts
uint32_t ifOutDiscards
@ IF_MIB_IF_TYPE_IEEE_802_15_4
Definition: if_mib_module.h:82
uint32_t ifOutBroadcastPkts
uint32_t ifInUcastPkts
uint32_t ifOutOctets
Interfaces Group MIB base.
@ IF_MIB_IF_TYPE_SOFT_LOOPBACK
Definition: if_mib_module.h:71
IfMibIfOperStatus
The operational state of the interface.
IfMibBase ifMibBase
Interfaces Group MIB base.
Definition: if_mib_module.c:59
uint64_t ifHCOutOctets