instr_api_common.h
Go to the documentation of this file.
1 #ifndef INSTR_API_COMMON_H
2 #define INSTR_API_COMMON_H
3 
4 /** ***************************************************************************
5  * @if INCLUDE_HEADER
6  * @copyright
7  * (C) Copyright SYSGO AG.
8  * Klein-Winternheim, Germany
9  * All rights reserved.
10  * @endif
11  *
12  * @file
13  *
14  * @purpose
15  * anisInstr: ANIS instrumentation interface of the PikeOS and POSIX API.
16  *
17  * @if INCLUDE_HEADER
18  * @cfg_management
19  * $Id: include/instr_api_common.h 2019-07-11 13:36:07 +0200 2e5c3399a1cfd500e80c6c937ec893a1722d7b33 $
20  * $HeadURL$
21  * $Author$
22  * $Date$
23  * $Revision$
24  * @endif
25  *****************************************************************************/
26 
27 /* ------------------------- FILE INCLUSION -------------------------------- */
28 
29 #if !defined(_UINT8_T_DECLARED) || !defined(_UINT32_T_DECLARED)
30 /* instr_api_common.h is included only from anisFP.h
31  * and instr.h from PikeOS or POSIX ANIS API.
32  */
33 #error "uint8_t or uint32_t not declared!"
34 #endif
35 
36 /**
37  * @addtogroup anisInstr
38  * @{
39  */
40 
41 /* ------------------------ TYPE DECLARATIONS ------------------------------ */
42 
43 /**
44  * @brief
45  * Maximum number of Ethernet interfaces including localhost loopback
46  */
47 /* @SYSGO_RQ IF_ANIS-3133 */
48 #define ANIS_ALL_INTF (7+1)
49 
50 /* @SYSGO_RQ IF_ANIS-1438 */
51 
52 /**
53  * @brief
54  * ANIS interface specific instrumentation API structure.
55  *
56  * @detailed
57  * This data structure is used to communicate network interface statistics
58  * to an application.
59  */
60 /* @SYSGO_RQ IF_ANIS-1438 */
61 typedef struct anis_instr_intf_stat_s {
62  /** Status of the interface configuration
63  *
64  * @detailed
65  * Indication of the interface configuration status. If the interface is
66  * configured then 1 is stored in the variable. Otherwise 0.
67  */
69 
70  /** The configured IP address of the interface.
71  *
72  * @detailed
73  * The IP address is stored in the network byte order.
74  */
76 
77  /** The configured network mask of the interface.
78  *
79  * @detailed
80  * The IP address is stored in the network byte order.
81  */
83 
84  /** The MAC address of the interface.
85  *
86  * @detailed
87  * The field is set to zero for local loopback interface.
88  */
89  uint8_t intf_mac_address[6];
90 
91  /** @cond __PRIVATE */
92  /** Explicit structure padding. */
93  uint8_t pad[2];
94  /** @endcond */
95 
96  /** Current interface link status.
97  *
98  * @detailed
99  * Indication of the interface link status from the underlying ethernet
100  * driver. The value 0 indicates link down, the value 1 link up.
101  * This member is set to 0 for the localhost loopback interface.
102  */
104 
105  /** Current interface link speed.
106  *
107  * @detailed
108  * Indication of the interface link speed from the underlying ethernet
109  * driver in megabits per second.
110  * This member is set to 0 for the localhost loopback interface.
111  */
113 
114  /** The number of FRAG_TIMEOUT class errors.
115  *
116  * @detailed
117  * It is incremented if the fragmentation timeout between reception of
118  * two consecutive fragments belonging to the same IP datagram is
119  * exceeded.
120  */
122 
123  /** The number of FRAG_SPACE class errors.
124  *
125  * @detailed
126  * It is incremented if the maximum number of concurrent fragmented IP
127  * datagrams supported is exceeded.
128  */
130 
131  /** The number of FRAG_ERROR class errors.
132  *
133  * @detailed
134  * It is incremented if fragments are received out of order and either no
135  * previous fragment of the datagram was received or the previous
136  * received fragments were dropped due to other constraints
137  * (e.g. time out).
138  */
140 
141  /** The number of FRAG_OFFSET class errors.
142  *
143  * @detailed
144  * It is incremented if fragments are received out of order and at least
145  * one previous fragment was received.
146  */
148 
149  /** The number of SOCK_RECVBUF class errors.
150  *
151  * @detailed
152  * It is incremented if a IP datagram is received which would cause the
153  * destination socket to exceed its receive buffer size limit.
154  */
156 
157  /** The number of ICMP_TYPE class errors.
158  *
159  * @detailed
160  * It is incremented if an ICMP datagram is received with invalid or
161  * unsupported values in the ICMP "Type" or "Code" header fields.
162  */
164 
165  /** The number of ICMP_FRAG class errors.
166  *
167  * @detailed
168  * It is incremented if an ICMP datagram is received with
169  * the fragmentation bit set in the IP header.
170  */
172 
173  /** The number of ICMP_CHKSUM class errors.
174  *
175  * @detailed
176  * It is incremented if an ICMP datagram with invalid checksum is
177  * received.
178  */
180 
181  /** The number of IGMP_TYPE class errors.
182  *
183  * @detailed
184  * It is incremented if an IGMP datagram is received with invalid or
185  * unsupported values in the IGMP "Type" header field.
186  */
188 
189  /** The number of IGMP_FRAG class errors.
190  *
191  * @detailed
192  * It is incremented if an IGMP datagram is received with
193  * the fragmentation bit set in the IP header.
194  */
196 
197  /** The number of IGMP_CHKSUM class errors.
198  *
199  * @detailed
200  * It is incremented if an IGMP datagram with invalid checksum is
201  * received.
202  */
204 
205  /** The number of IP_CHKSUM class errors.
206  *
207  * @detailed
208  * It is incremented if an IP datagram with invalid checksum is
209  * received.
210  */
212 
213  /** The number of IP_HDR class errors.
214  *
215  * @detailed
216  * It is incremented if an IP datagram with invalid or unsupported values
217  * in the header (except those covered by IP_SIZE and IP_PROTO) is
218  * received.
219  */
221 
222  /** The number of IP_SIZE class errors.
223  *
224  * @detailed
225  * It is incremented if an IP datagram with an invalid value in the
226  * "Total Length" header field is received.
227  */
229 
230  /** The number of IP_PROTO class errors.
231  *
232  * @detailed
233  * It is incremented if an IP datagram with invalid or unsupported value
234  * in the IP header "Protocol" field is received.
235  */
237 
238  /** The number of NO_SOCK class errors.
239  *
240  * @detailed
241  * It is incremented if a UDP datagram is received, but no socket is
242  * bound to the destination address.
243  */
245 
246  /** The number of BAD_IP class errors.
247  *
248  * @detailed
249  * It is incremented if an IP datagram is received, but the destination
250  * address does match neither the configured address nor the broadcast
251  * address. It is also incremented if the source address is a broadcast
252  * address, multicast address or a local loopback address.
253  */
255 
256  /** The number of HOST_UNREACHABLE class errors
257  *
258  * @detailed
259  * It is incremented if the application tried to send data
260  * to a host, which is not reachable.
261  */
263 
264  /** The number of ARP_PROTO class errors
265  *
266  * @detailed
267 
268  * It is incremented if the ANISFP stack receives ARP packet with
269  * unexpected content in the ARP header.
270  *
271  */
273 
274  /** The number of TX_DROP class errors
275  *
276  * @detailed
277  * It is incremented if the ethernet driver reports an error in
278  * transmit (vm_write()) operation. This counter is
279  * not used if the txErrorFatal configuration property is true.
280  *
281  */
283 
285 
286 /**
287  * @brief
288  * ANIS instrumentation API data structure.
289  *
290  * @detailed
291  * This data structure is used to communicate network interface statistics
292  * to an application.
293  */
294 /* @SYSGO_RQ IF_ANIS-3132 */
295 typedef struct anis_instr_stat_s {
296  /** The number of SEND_NOSRC class errors.
297  *
298  * @detailed
299  * It is incremented if the application tried to send on an unbound
300  * socket.
301  */
303 
304  /** The number of UDP_LENGTH class errors
305  *
306  * @detailed
307  * It is incremented if a UDP datagram is reassembled
308  * and some data left in the buffer for reassembly.
309  */
311 
312 
313  /** The number of UDP_CHKSUM class errors
314  *
315  * @detailed
316  * It is incremented if a UDP datagram with invalid checksum is
317  * received. In the certified ANIS variant this is only checked for UDP
318  * datagrams that are fragmented at the IP level.
319  */
321 
322  /** The number of SOCKET_LIST class errors.
323  *
324  * @detailed
325  * ANIS reserves internal memory to store association between multicast
326  * packets and receiving sockets. If a packet is not delivered to a socket
327  * because ANIS ran out of memory, this counter is incremented.
328  *
329  */
331 
332  /** Interface specific counters
333  *
334  * @detailed
335  * Field of \a anis_instr_intf_stat_t structures to access interface
336  * specific counters.
337  */
339 
341 
342 /** @} */
343 
344 #endif /* INSTR_API_COMMON_H */
345 
ANIS instrumentation API data structure.
Definition: instr_api_common.h:295
uint32_t instr_ipSize
Definition: instr_api_common.h:228
uint32_t instr_ipHeaderConstant
Definition: instr_api_common.h:220
uint32_t instr_socketList
Definition: instr_api_common.h:330
uint32_t intf_enabled
Definition: instr_api_common.h:68
uint32_t instr_hostUnreach
Definition: instr_api_common.h:262
uint32_t instr_noSocket
Definition: instr_api_common.h:244
uint32_t intf_link_status
Definition: instr_api_common.h:103
uint32_t instr_icmpFrag
Definition: instr_api_common.h:171
P4_uint32_t uint32_t
Definition: socket.h:46
uint32_t instr_udpLength
Definition: instr_api_common.h:310
struct anis_instr_intf_stat_s anis_instr_intf_stat_t
ANIS interface specific instrumentation API structure.
uint32_t instr_arpProtocol
Definition: instr_api_common.h:272
uint8_t intf_mac_address[6]
Definition: instr_api_common.h:89
uint32_t instr_fragOffset
Definition: instr_api_common.h:147
uint32_t instr_sendNoSrc
Definition: instr_api_common.h:302
uint32_t intf_ip_address
Definition: instr_api_common.h:75
#define ANIS_ALL_INTF
Maximum number of Ethernet interfaces including localhost loopback.
Definition: instr_api_common.h:48
uint32_t instr_fragError
Definition: instr_api_common.h:139
uint32_t instr_ipSum
Definition: instr_api_common.h:211
uint32_t instr_igmpFrag
Definition: instr_api_common.h:195
uint32_t instr_sockRecvBuf
Definition: instr_api_common.h:155
uint32_t instr_icmpType
Definition: instr_api_common.h:163
struct anis_instr_stat_s anis_instr_stat_t
ANIS instrumentation API data structure.
uint32_t instr_fragTimeout
Definition: instr_api_common.h:121
uint32_t instr_udpSum
Definition: instr_api_common.h:320
uint32_t intf_link_speed
Definition: instr_api_common.h:112
uint32_t instr_badIP
Definition: instr_api_common.h:254
uint32_t instr_txDrop
Definition: instr_api_common.h:282
ANIS interface specific instrumentation API structure.
Definition: instr_api_common.h:61
uint32_t instr_igmpType
Definition: instr_api_common.h:187
uint32_t instr_icmpSum
Definition: instr_api_common.h:179
uint32_t instr_igmpSum
Definition: instr_api_common.h:203
uint32_t instr_ipProtocol
Definition: instr_api_common.h:236
uint32_t intf_netmask
Definition: instr_api_common.h:82
uint32_t instr_fragSpace
Definition: instr_api_common.h:129