Contiki-NG
snmp-mib.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Yago Fontoura do Rosario <yago.rosario@hotmail.com.br>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  *
14  * 3. Neither the name of the copyright holder nor the names of its
15  * contributors may be used to endorse or promote products derived
16  * from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29  * OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 /*---------------------------------------------------------------------------*/
32 
33 /**
34  * \file
35  * An implementation of the Simple Network Management Protocol (RFC 3411-3418)
36  * \author
37  * Yago Fontoura do Rosario <yago.rosario@hotmail.com.br
38  */
39 
40 /**
41  * \addtogroup snmp
42  * @{
43  */
44 
45 #ifndef SNMP_MIB_H_
46 #define SNMP_MIB_H_
47 
48 #include "snmp.h"
49 
50 /**
51  * @brief The MIB resource handler typedef
52  *
53  * @param varbind The varbind that is being changed
54  * @param oid The oid from the resource
55  */
56 typedef void (*snmp_mib_resource_handler_t)(snmp_varbind_t *varbind, uint32_t *oid);
57 
58 /**
59  * @brief The MIB Resource struct
60  */
61 typedef struct snmp_mib_resource_s {
62  /**
63  * @brief A pointer to the next element in the linked list
64  *
65  * @remarks This MUST be the first element in the struct
66  */
68  /**
69  * @brief A array that represents the OID
70  *
71  * @remarks This array is "null" terminated. In this case the -1 is used.
72  */
73  uint32_t *oid;
74  /**
75  * @brief The function handler that is called for this resource
76  */
79 
80 /**
81  * @brief Finds the MIB Resource for this OID
82  *
83  * @param oid The OID
84  *
85  * @return In case of success a pointer to the resouce or NULL in case of fail
86  */
88 snmp_mib_find(uint32_t *oid);
89 
90 /**
91  * @brief Finds the next MIB Resource after this OID
92  *
93  * @param oid The OID
94  *
95  * @return In case of success a pointer to the resouce or NULL in case of fail
96  */
98 snmp_mib_find_next(uint32_t *oid);
99 
100 /**
101  * @brief Adds a resource into the linked list
102  *
103  * @param resource The resource
104  */
105 void
107 
108 /**
109  * @brief Initialize the MIB resources list
110  */
111 void
112 snmp_mib_init(void);
113 
114 #endif /* SNMP_MIB_H_ */
115 /** @} */
An implementation of the Simple Network Management Protocol (RFC 3411-3418)
snmp_mib_resource_handler_t handler
The function handler that is called for this resource.
Definition: snmp-mib.h:77
The varbind struct.
Definition: snmp.h:157
snmp_mib_resource_t * snmp_mib_find_next(uint32_t *oid)
Finds the next MIB Resource after this OID.
Definition: snmp-mib.c:68
The MIB Resource struct.
Definition: snmp-mib.h:61
struct snmp_mib_resource_s * next
A pointer to the next element in the linked list.
Definition: snmp-mib.h:67
void(* snmp_mib_resource_handler_t)(snmp_varbind_t *varbind, uint32_t *oid)
The MIB resource handler typedef.
Definition: snmp-mib.h:56
void snmp_mib_init(void)
Initialize the MIB resources list.
Definition: snmp-mib.c:114
snmp_mib_resource_t * snmp_mib_find(uint32_t *oid)
Finds the MIB Resource for this OID.
Definition: snmp-mib.c:52
uint32_t * oid
A array that represents the OID.
Definition: snmp-mib.h:73
void snmp_mib_add(snmp_mib_resource_t *resource)
Adds a resource into the linked list.
Definition: snmp-mib.c:84
struct snmp_mib_resource_s snmp_mib_resource_t
The MIB Resource struct.