mib2_impl_icmp.c
Go to the documentation of this file.
1 /**
2  * @file mib2_impl_icmp.c
3  * @brief MIB-II module implementation (ICMP group)
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2026 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.6.0
29  **/
30 
31 //Switch to the appropriate trace level
32 #define TRACE_LEVEL SNMP_TRACE_LEVEL
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "ipv4/icmp.h"
37 #include "mibs/mib_common.h"
38 #include "mibs/mib2_module.h"
39 #include "mibs/mib2_impl.h"
40 #include "mibs/mib2_impl_icmp.h"
41 #include "core/crypto.h"
42 #include "encoding/asn1.h"
43 #include "encoding/oid.h"
44 #include "debug.h"
45 
46 //Check TCP/IP stack configuration
47 #if (MIB2_SUPPORT == ENABLED && MIB2_ICMP_GROUP_SUPPORT == ENABLED)
48 
49 
50 /**
51  * @brief Get icmpInMsgs object value
52  * @param[in] object Pointer to the MIB object descriptor
53  * @param[in] oid Object identifier (object name and instance identifier)
54  * @param[in] oidLen Length of the OID, in bytes
55  * @param[out] value Object value
56  * @param[in,out] valueLen Length of the object value, in bytes
57  * @return Error code
58  **/
59 
60 error_t mib2GetIcmpInMsgs(const MibObject *object, const uint8_t *oid,
61  size_t oidLen, MibVariant *value, size_t *valueLen)
62 {
63  NetContext *context;
64 
65  //Point to the TCP/IP stack context
66  context = netGetDefaultContext();
67 
68  //Total number of ICMP messages which the entity received
69  value->counter32 = context->icmpStats.inMsgs;
70 
71  //Return status code
72  return NO_ERROR;
73 }
74 
75 
76 /**
77  * @brief Get icmpInErrors object value
78  * @param[in] object Pointer to the MIB object descriptor
79  * @param[in] oid Object identifier (object name and instance identifier)
80  * @param[in] oidLen Length of the OID, in bytes
81  * @param[out] value Object value
82  * @param[in,out] valueLen Length of the object value, in bytes
83  * @return Error code
84  **/
85 
86 error_t mib2GetIcmpInErrors(const MibObject *object, const uint8_t *oid,
87  size_t oidLen, MibVariant *value, size_t *valueLen)
88 {
89  NetContext *context;
90 
91  //Point to the TCP/IP stack context
92  context = netGetDefaultContext();
93 
94  //Number of ICMP messages which the entity received but determined as having
95  //ICMP-specific errors
96  value->counter32 = context->icmpStats.inErrors;
97 
98  //Return status code
99  return NO_ERROR;
100 }
101 
102 
103 /**
104  * @brief Get icmpInDestUnreachs object value
105  * @param[in] object Pointer to the MIB object descriptor
106  * @param[in] oid Object identifier (object name and instance identifier)
107  * @param[in] oidLen Length of the OID, in bytes
108  * @param[out] value Object value
109  * @param[in,out] valueLen Length of the object value, in bytes
110  * @return Error code
111  **/
112 
113 error_t mib2GetIcmpInDestUnreachs(const MibObject *object, const uint8_t *oid,
114  size_t oidLen, MibVariant *value, size_t *valueLen)
115 {
116  NetContext *context;
117 
118  //Point to the TCP/IP stack context
119  context = netGetDefaultContext();
120 
121  //Number of ICMP Destination Unreachable messages received
122  value->counter32 = context->icmpStats.inPkts[ICMP_TYPE_DEST_UNREACHABLE];
123 
124  //Return status code
125  return NO_ERROR;
126 }
127 
128 
129 /**
130  * @brief Get icmpInTimeExcds object value
131  * @param[in] object Pointer to the MIB object descriptor
132  * @param[in] oid Object identifier (object name and instance identifier)
133  * @param[in] oidLen Length of the OID, in bytes
134  * @param[out] value Object value
135  * @param[in,out] valueLen Length of the object value, in bytes
136  * @return Error code
137  **/
138 
139 error_t mib2GetIcmpInTimeExcds(const MibObject *object, const uint8_t *oid,
140  size_t oidLen, MibVariant *value, size_t *valueLen)
141 {
142  NetContext *context;
143 
144  //Point to the TCP/IP stack context
145  context = netGetDefaultContext();
146 
147  //Number of ICMP Time Exceeded messages received
148  value->counter32 = context->icmpStats.inPkts[ICMP_TYPE_TIME_EXCEEDED];
149 
150  //Return status code
151  return NO_ERROR;
152 }
153 
154 
155 /**
156  * @brief Get icmpInParmProbs object value
157  * @param[in] object Pointer to the MIB object descriptor
158  * @param[in] oid Object identifier (object name and instance identifier)
159  * @param[in] oidLen Length of the OID, in bytes
160  * @param[out] value Object value
161  * @param[in,out] valueLen Length of the object value, in bytes
162  * @return Error code
163  **/
164 
165 error_t mib2GetIcmpInParmProbs(const MibObject *object, const uint8_t *oid,
166  size_t oidLen, MibVariant *value, size_t *valueLen)
167 {
168  NetContext *context;
169 
170  //Point to the TCP/IP stack context
171  context = netGetDefaultContext();
172 
173  //Number of ICMP Parameter Problem messages received
174  value->counter32 = context->icmpStats.inPkts[ICMP_TYPE_PARAM_PROBLEM];
175 
176  //Return status code
177  return NO_ERROR;
178 }
179 
180 
181 /**
182  * @brief Get icmpInSrcQuenchs object value
183  * @param[in] object Pointer to the MIB object descriptor
184  * @param[in] oid Object identifier (object name and instance identifier)
185  * @param[in] oidLen Length of the OID, in bytes
186  * @param[out] value Object value
187  * @param[in,out] valueLen Length of the object value, in bytes
188  * @return Error code
189  **/
190 
191 error_t mib2GetIcmpInSrcQuenchs(const MibObject *object, const uint8_t *oid,
192  size_t oidLen, MibVariant *value, size_t *valueLen)
193 {
194  NetContext *context;
195 
196  //Point to the TCP/IP stack context
197  context = netGetDefaultContext();
198 
199  //Number of ICMP Source Quench messages received
200  value->counter32 = context->icmpStats.inPkts[ICMP_TYPE_SOURCE_QUENCH];
201 
202  //Return status code
203  return NO_ERROR;
204 }
205 
206 
207 /**
208  * @brief Get icmpInRedirects object value
209  * @param[in] object Pointer to the MIB object descriptor
210  * @param[in] oid Object identifier (object name and instance identifier)
211  * @param[in] oidLen Length of the OID, in bytes
212  * @param[out] value Object value
213  * @param[in,out] valueLen Length of the object value, in bytes
214  * @return Error code
215  **/
216 
217 error_t mib2GetIcmpInRedirects(const MibObject *object, const uint8_t *oid,
218  size_t oidLen, MibVariant *value, size_t *valueLen)
219 {
220  NetContext *context;
221 
222  //Point to the TCP/IP stack context
223  context = netGetDefaultContext();
224 
225  //Number of ICMP Redirect messages received
226  value->counter32 = context->icmpStats.inPkts[ICMP_TYPE_REDIRECT];
227 
228  //Return status code
229  return NO_ERROR;
230 }
231 
232 
233 /**
234  * @brief Get icmpInEchos object value
235  * @param[in] object Pointer to the MIB object descriptor
236  * @param[in] oid Object identifier (object name and instance identifier)
237  * @param[in] oidLen Length of the OID, in bytes
238  * @param[out] value Object value
239  * @param[in,out] valueLen Length of the object value, in bytes
240  * @return Error code
241  **/
242 
243 error_t mib2GetIcmpInEchos(const MibObject *object, const uint8_t *oid,
244  size_t oidLen, MibVariant *value, size_t *valueLen)
245 {
246  NetContext *context;
247 
248  //Point to the TCP/IP stack context
249  context = netGetDefaultContext();
250 
251  //Number of ICMP Echo Request messages received
252  value->counter32 = context->icmpStats.inPkts[ICMP_TYPE_ECHO_REQUEST];
253 
254  //Return status code
255  return NO_ERROR;
256 }
257 
258 
259 /**
260  * @brief Get icmpInEchoReps object value
261  * @param[in] object Pointer to the MIB object descriptor
262  * @param[in] oid Object identifier (object name and instance identifier)
263  * @param[in] oidLen Length of the OID, in bytes
264  * @param[out] value Object value
265  * @param[in,out] valueLen Length of the object value, in bytes
266  * @return Error code
267  **/
268 
269 error_t mib2GetIcmpInEchoReps(const MibObject *object, const uint8_t *oid,
270  size_t oidLen, MibVariant *value, size_t *valueLen)
271 {
272  NetContext *context;
273 
274  //Point to the TCP/IP stack context
275  context = netGetDefaultContext();
276 
277  //Number of ICMP Echo Reply messages received
278  value->counter32 = context->icmpStats.inPkts[ICMP_TYPE_ECHO_REPLY];
279 
280  //Return status code
281  return NO_ERROR;
282 }
283 
284 
285 /**
286  * @brief Get icmpInTimestamps object value
287  * @param[in] object Pointer to the MIB object descriptor
288  * @param[in] oid Object identifier (object name and instance identifier)
289  * @param[in] oidLen Length of the OID, in bytes
290  * @param[out] value Object value
291  * @param[in,out] valueLen Length of the object value, in bytes
292  * @return Error code
293  **/
294 
295 error_t mib2GetIcmpInTimestamps(const MibObject *object, const uint8_t *oid,
296  size_t oidLen, MibVariant *value, size_t *valueLen)
297 {
298  NetContext *context;
299 
300  //Point to the TCP/IP stack context
301  context = netGetDefaultContext();
302 
303  //Number of ICMP Timestamp Request messages received
304  value->counter32 = context->icmpStats.inPkts[ICMP_TYPE_TIMESTAMP_REQUEST];
305 
306  //Return status code
307  return NO_ERROR;
308 }
309 
310 
311 /**
312  * @brief Get icmpInTimestampReps object value
313  * @param[in] object Pointer to the MIB object descriptor
314  * @param[in] oid Object identifier (object name and instance identifier)
315  * @param[in] oidLen Length of the OID, in bytes
316  * @param[out] value Object value
317  * @param[in,out] valueLen Length of the object value, in bytes
318  * @return Error code
319  **/
320 
321 error_t mib2GetIcmpInTimestampReps(const MibObject *object, const uint8_t *oid,
322  size_t oidLen, MibVariant *value, size_t *valueLen)
323 {
324  NetContext *context;
325 
326  //Point to the TCP/IP stack context
327  context = netGetDefaultContext();
328 
329  //Number of ICMP Timestamp Reply messages received
330  value->counter32 = context->icmpStats.inPkts[ICMP_TYPE_TIMESTAMP_REPLY];
331 
332  //Return status code
333  return NO_ERROR;
334 }
335 
336 
337 /**
338  * @brief Get icmpInAddrMasks object value
339  * @param[in] object Pointer to the MIB object descriptor
340  * @param[in] oid Object identifier (object name and instance identifier)
341  * @param[in] oidLen Length of the OID, in bytes
342  * @param[out] value Object value
343  * @param[in,out] valueLen Length of the object value, in bytes
344  * @return Error code
345  **/
346 
347 error_t mib2GetIcmpInAddrMasks(const MibObject *object, const uint8_t *oid,
348  size_t oidLen, MibVariant *value, size_t *valueLen)
349 {
350  NetContext *context;
351 
352  //Point to the TCP/IP stack context
353  context = netGetDefaultContext();
354 
355  //Number of ICMP Address Mask Request messages received
356  value->counter32 = context->icmpStats.inPkts[ICMP_TYPE_ADDR_MASK_REQUEST];
357 
358  //Return status code
359  return NO_ERROR;
360 }
361 
362 
363 /**
364  * @brief Get icmpInAddrMaskReps object value
365  * @param[in] object Pointer to the MIB object descriptor
366  * @param[in] oid Object identifier (object name and instance identifier)
367  * @param[in] oidLen Length of the OID, in bytes
368  * @param[out] value Object value
369  * @param[in,out] valueLen Length of the object value, in bytes
370  * @return Error code
371  **/
372 
373 error_t mib2GetIcmpInAddrMaskReps(const MibObject *object, const uint8_t *oid,
374  size_t oidLen, MibVariant *value, size_t *valueLen)
375 {
376  NetContext *context;
377 
378  //Point to the TCP/IP stack context
379  context = netGetDefaultContext();
380 
381  //Number of ICMP Address Mask Reply messages received
382  value->counter32 = context->icmpStats.inPkts[ICMP_TYPE_ADDR_MASK_REPLY];
383 
384  //Return status code
385  return NO_ERROR;
386 }
387 
388 
389 /**
390  * @brief Get icmpOutMsgs object value
391  * @param[in] object Pointer to the MIB object descriptor
392  * @param[in] oid Object identifier (object name and instance identifier)
393  * @param[in] oidLen Length of the OID, in bytes
394  * @param[out] value Object value
395  * @param[in,out] valueLen Length of the object value, in bytes
396  * @return Error code
397  **/
398 
399 error_t mib2GetIcmpOutMsgs(const MibObject *object, const uint8_t *oid,
400  size_t oidLen, MibVariant *value, size_t *valueLen)
401 {
402  NetContext *context;
403 
404  //Point to the TCP/IP stack context
405  context = netGetDefaultContext();
406 
407  //Total number of ICMP messages which this entity attempted to send
408  value->counter32 = context->icmpStats.outMsgs;
409 
410  //Return status code
411  return NO_ERROR;
412 }
413 
414 
415 /**
416  * @brief Get icmpOutErrors object value
417  * @param[in] object Pointer to the MIB object descriptor
418  * @param[in] oid Object identifier (object name and instance identifier)
419  * @param[in] oidLen Length of the OID, in bytes
420  * @param[out] value Object value
421  * @param[in,out] valueLen Length of the object value, in bytes
422  * @return Error code
423  **/
424 
425 error_t mib2GetIcmpOutErrors(const MibObject *object, const uint8_t *oid,
426  size_t oidLen, MibVariant *value, size_t *valueLen)
427 {
428  NetContext *context;
429 
430  //Point to the TCP/IP stack context
431  context = netGetDefaultContext();
432 
433  //Number of ICMP messages which this entity did not send due to problems
434  //discovered within ICMP such as a lack of buffers
435  value->counter32 = context->icmpStats.outErrors;
436 
437  //Return status code
438  return NO_ERROR;
439 }
440 
441 
442 /**
443  * @brief Get icmpOutDestUnreachs object value
444  * @param[in] object Pointer to the MIB object descriptor
445  * @param[in] oid Object identifier (object name and instance identifier)
446  * @param[in] oidLen Length of the OID, in bytes
447  * @param[out] value Object value
448  * @param[in,out] valueLen Length of the object value, in bytes
449  * @return Error code
450  **/
451 
452 error_t mib2GetIcmpOutDestUnreachs(const MibObject *object, const uint8_t *oid,
453  size_t oidLen, MibVariant *value, size_t *valueLen)
454 {
455  NetContext *context;
456 
457  //Point to the TCP/IP stack context
458  context = netGetDefaultContext();
459 
460  //Number of ICMP Destination Unreachable messages sent
461  value->counter32 = context->icmpStats.outPkts[ICMP_TYPE_DEST_UNREACHABLE];
462 
463  //Return status code
464  return NO_ERROR;
465 }
466 
467 
468 /**
469  * @brief Get icmpOutTimeExcds object value
470  * @param[in] object Pointer to the MIB object descriptor
471  * @param[in] oid Object identifier (object name and instance identifier)
472  * @param[in] oidLen Length of the OID, in bytes
473  * @param[out] value Object value
474  * @param[in,out] valueLen Length of the object value, in bytes
475  * @return Error code
476  **/
477 
478 error_t mib2GetIcmpOutTimeExcds(const MibObject *object, const uint8_t *oid,
479  size_t oidLen, MibVariant *value, size_t *valueLen)
480 {
481  NetContext *context;
482 
483  //Point to the TCP/IP stack context
484  context = netGetDefaultContext();
485 
486  //Number of ICMP Time Exceeded messages sent
487  value->counter32 = context->icmpStats.outPkts[ICMP_TYPE_TIME_EXCEEDED];
488 
489  //Return status code
490  return NO_ERROR;
491 }
492 
493 
494 /**
495  * @brief Get icmpOutParmProbs object value
496  * @param[in] object Pointer to the MIB object descriptor
497  * @param[in] oid Object identifier (object name and instance identifier)
498  * @param[in] oidLen Length of the OID, in bytes
499  * @param[out] value Object value
500  * @param[in,out] valueLen Length of the object value, in bytes
501  * @return Error code
502  **/
503 
504 error_t mib2GetIcmpOutParmProbs(const MibObject *object, const uint8_t *oid,
505  size_t oidLen, MibVariant *value, size_t *valueLen)
506 {
507  NetContext *context;
508 
509  //Point to the TCP/IP stack context
510  context = netGetDefaultContext();
511 
512  //Number of ICMP Parameter Problem messages sent
513  value->counter32 = context->icmpStats.outPkts[ICMP_TYPE_PARAM_PROBLEM];
514 
515  //Return status code
516  return NO_ERROR;
517 }
518 
519 
520 /**
521  * @brief Get icmpOutSrcQuenchs object value
522  * @param[in] object Pointer to the MIB object descriptor
523  * @param[in] oid Object identifier (object name and instance identifier)
524  * @param[in] oidLen Length of the OID, in bytes
525  * @param[out] value Object value
526  * @param[in,out] valueLen Length of the object value, in bytes
527  * @return Error code
528  **/
529 
530 error_t mib2GetIcmpOutSrcQuenchs(const MibObject *object, const uint8_t *oid,
531  size_t oidLen, MibVariant *value, size_t *valueLen)
532 {
533  NetContext *context;
534 
535  //Point to the TCP/IP stack context
536  context = netGetDefaultContext();
537 
538  //Number of ICMP Source Quench messages sent
539  value->counter32 = context->icmpStats.outPkts[ICMP_TYPE_SOURCE_QUENCH];
540 
541  //Return status code
542  return NO_ERROR;
543 }
544 
545 
546 /**
547  * @brief Get icmpOutRedirects object value
548  * @param[in] object Pointer to the MIB object descriptor
549  * @param[in] oid Object identifier (object name and instance identifier)
550  * @param[in] oidLen Length of the OID, in bytes
551  * @param[out] value Object value
552  * @param[in,out] valueLen Length of the object value, in bytes
553  * @return Error code
554  **/
555 
556 error_t mib2GetIcmpOutRedirects(const MibObject *object, const uint8_t *oid,
557  size_t oidLen, MibVariant *value, size_t *valueLen)
558 {
559  NetContext *context;
560 
561  //Point to the TCP/IP stack context
562  context = netGetDefaultContext();
563 
564  //Number of ICMP Redirect messages sent
565  value->counter32 = context->icmpStats.outPkts[ICMP_TYPE_REDIRECT];
566 
567  //Return status code
568  return NO_ERROR;
569 }
570 
571 
572 /**
573  * @brief Get icmpOutEchos object value
574  * @param[in] object Pointer to the MIB object descriptor
575  * @param[in] oid Object identifier (object name and instance identifier)
576  * @param[in] oidLen Length of the OID, in bytes
577  * @param[out] value Object value
578  * @param[in,out] valueLen Length of the object value, in bytes
579  * @return Error code
580  **/
581 
582 error_t mib2GetIcmpOutEchos(const MibObject *object, const uint8_t *oid,
583  size_t oidLen, MibVariant *value, size_t *valueLen)
584 {
585  NetContext *context;
586 
587  //Point to the TCP/IP stack context
588  context = netGetDefaultContext();
589 
590  //Number of ICMP Echo Request messages sent
591  value->counter32 = context->icmpStats.outPkts[ICMP_TYPE_ECHO_REQUEST];
592 
593  //Return status code
594  return NO_ERROR;
595 }
596 
597 
598 /**
599  * @brief Get icmpOutEchoReps object value
600  * @param[in] object Pointer to the MIB object descriptor
601  * @param[in] oid Object identifier (object name and instance identifier)
602  * @param[in] oidLen Length of the OID, in bytes
603  * @param[out] value Object value
604  * @param[in,out] valueLen Length of the object value, in bytes
605  * @return Error code
606  **/
607 
608 error_t mib2GetIcmpOutEchoReps(const MibObject *object, const uint8_t *oid,
609  size_t oidLen, MibVariant *value, size_t *valueLen)
610 {
611  NetContext *context;
612 
613  //Point to the TCP/IP stack context
614  context = netGetDefaultContext();
615 
616  //Number of ICMP Echo Reply messages sent
617  value->counter32 = context->icmpStats.outPkts[ICMP_TYPE_ECHO_REPLY];
618 
619  //Return status code
620  return NO_ERROR;
621 }
622 
623 
624 /**
625  * @brief Get icmpOutTimestamps object value
626  * @param[in] object Pointer to the MIB object descriptor
627  * @param[in] oid Object identifier (object name and instance identifier)
628  * @param[in] oidLen Length of the OID, in bytes
629  * @param[out] value Object value
630  * @param[in,out] valueLen Length of the object value, in bytes
631  * @return Error code
632  **/
633 
634 error_t mib2GetIcmpOutTimestamps(const MibObject *object, const uint8_t *oid,
635  size_t oidLen, MibVariant *value, size_t *valueLen)
636 {
637  NetContext *context;
638 
639  //Point to the TCP/IP stack context
640  context = netGetDefaultContext();
641 
642  //Number of ICMP Timestamp Request messages sent
643  value->counter32 = context->icmpStats.outPkts[ICMP_TYPE_TIMESTAMP_REQUEST];
644 
645  //Return status code
646  return NO_ERROR;
647 }
648 
649 
650 /**
651  * @brief Get icmpOutTimestampReps object value
652  * @param[in] object Pointer to the MIB object descriptor
653  * @param[in] oid Object identifier (object name and instance identifier)
654  * @param[in] oidLen Length of the OID, in bytes
655  * @param[out] value Object value
656  * @param[in,out] valueLen Length of the object value, in bytes
657  * @return Error code
658  **/
659 
660 error_t mib2GetIcmpOutTimestampReps(const MibObject *object, const uint8_t *oid,
661  size_t oidLen, MibVariant *value, size_t *valueLen)
662 {
663  NetContext *context;
664 
665  //Point to the TCP/IP stack context
666  context = netGetDefaultContext();
667 
668  //Number of ICMP Timestamp Reply messages sent
669  value->counter32 = context->icmpStats.outPkts[ICMP_TYPE_TIMESTAMP_REPLY];
670 
671  //Return status code
672  return NO_ERROR;
673 }
674 
675 
676 /**
677  * @brief Get icmpOutAddrMasks object value
678  * @param[in] object Pointer to the MIB object descriptor
679  * @param[in] oid Object identifier (object name and instance identifier)
680  * @param[in] oidLen Length of the OID, in bytes
681  * @param[out] value Object value
682  * @param[in,out] valueLen Length of the object value, in bytes
683  * @return Error code
684  **/
685 
686 error_t mib2GetIcmpOutAddrMasks(const MibObject *object, const uint8_t *oid,
687  size_t oidLen, MibVariant *value, size_t *valueLen)
688 {
689  NetContext *context;
690 
691  //Point to the TCP/IP stack context
692  context = netGetDefaultContext();
693 
694  //Number of ICMP Address Mask Request messages sent
695  value->counter32 = context->icmpStats.outPkts[ICMP_TYPE_ADDR_MASK_REQUEST];
696 
697  //Return status code
698  return NO_ERROR;
699 }
700 
701 
702 /**
703  * @brief Get icmpOutAddrMaskReps object value
704  * @param[in] object Pointer to the MIB object descriptor
705  * @param[in] oid Object identifier (object name and instance identifier)
706  * @param[in] oidLen Length of the OID, in bytes
707  * @param[out] value Object value
708  * @param[in,out] valueLen Length of the object value, in bytes
709  * @return Error code
710  **/
711 
712 error_t mib2GetIcmpOutAddrMaskReps(const MibObject *object, const uint8_t *oid,
713  size_t oidLen, MibVariant *value, size_t *valueLen)
714 {
715  NetContext *context;
716 
717  //Point to the TCP/IP stack context
718  context = netGetDefaultContext();
719 
720  //Number of ICMP Address Mask Reply messages sent
721  value->counter32 = context->icmpStats.outPkts[ICMP_TYPE_ADDR_MASK_REPLY];
722 
723  //Return status code
724  return NO_ERROR;
725 }
726 
727 #endif
error_t mib2GetIcmpOutEchoReps(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpOutEchoReps object value.
MIB-II module.
#define NetContext
Definition: net.h:36
error_t mib2GetIcmpOutAddrMasks(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpOutAddrMasks object value.
@ ICMP_TYPE_ADDR_MASK_REQUEST
Definition: icmp.h:99
error_t mib2GetIcmpInMsgs(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpInMsgs object value.
error_t mib2GetIcmpOutRedirects(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpOutRedirects object value.
error_t mib2GetIcmpOutDestUnreachs(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpOutDestUnreachs object value.
error_t mib2GetIcmpInAddrMaskReps(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpInAddrMaskReps object value.
OID (Object Identifier)
MIB-II module implementation (ICMP group)
error_t mib2GetIcmpInAddrMasks(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpInAddrMasks object value.
error_t mib2GetIcmpOutTimestamps(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpOutTimestamps object value.
error_t mib2GetIcmpInDestUnreachs(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpInDestUnreachs object value.
error_t mib2GetIcmpInEchos(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpInEchos object value.
@ ICMP_TYPE_TIME_EXCEEDED
Definition: icmp.h:93
error_t mib2GetIcmpOutAddrMaskReps(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpOutAddrMaskReps object value.
@ ICMP_TYPE_PARAM_PROBLEM
Definition: icmp.h:94
error_t mib2GetIcmpOutParmProbs(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpOutParmProbs object value.
uint8_t oid[]
Definition: lldp_tlv.h:300
error_t mib2GetIcmpOutTimeExcds(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpOutTimeExcds object value.
ICMP (Internet Control Message Protocol)
error_t
Error codes.
Definition: error.h:43
@ ICMP_TYPE_REDIRECT
Definition: icmp.h:88
error_t mib2GetIcmpInTimestampReps(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpInTimestampReps object value.
error_t mib2GetIcmpInTimeExcds(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpInTimeExcds object value.
@ ICMP_TYPE_TIMESTAMP_REPLY
Definition: icmp.h:96
@ ICMP_TYPE_SOURCE_QUENCH
Definition: icmp.h:87
General definitions for cryptographic algorithms.
NetContext * netGetDefaultContext(void)
Get default TCP/IP stack context.
Definition: net.c:527
error_t mib2GetIcmpInRedirects(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpInRedirects object value.
error_t mib2GetIcmpInSrcQuenchs(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpInSrcQuenchs object value.
error_t mib2GetIcmpOutSrcQuenchs(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpOutSrcQuenchs object value.
@ ICMP_TYPE_ECHO_REQUEST
Definition: icmp.h:90
error_t mib2GetIcmpInEchoReps(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpInEchoReps object value.
error_t mib2GetIcmpInTimestamps(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpInTimestamps object value.
error_t mib2GetIcmpInParmProbs(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpInParmProbs object value.
error_t mib2GetIcmpInErrors(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpInErrors object value.
error_t mib2GetIcmpOutTimestampReps(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpOutTimestampReps object value.
MIB-II module implementation.
@ ICMP_TYPE_DEST_UNREACHABLE
Definition: icmp.h:86
@ ICMP_TYPE_ECHO_REPLY
Definition: icmp.h:85
Common definitions for MIB modules.
error_t mib2GetIcmpOutEchos(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpOutEchos object value.
@ ICMP_TYPE_ADDR_MASK_REPLY
Definition: icmp.h:100
#define MibObject
Definition: mib_common.h:46
uint8_t value[]
Definition: tcp.h:376
uint8_t oidLen
Definition: lldp_tlv.h:299
error_t mib2GetIcmpOutErrors(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpOutErrors object value.
MibVariant
Definition: mib_common.h:196
TCP/IP stack core.
error_t mib2GetIcmpOutMsgs(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get icmpOutMsgs object value.
@ NO_ERROR
Success.
Definition: error.h:44
Debugging facilities.
ASN.1 (Abstract Syntax Notation One)
@ ICMP_TYPE_TIMESTAMP_REQUEST
Definition: icmp.h:95