Contiki-NG
snmp-mib.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019-2020 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  * SNMP Implementation of the MIB
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 /**
49  * \addtogroup SNMPInternal SNMP Internal API
50  * @{
51  *
52  * This group contains all the functions that can be used inside the OS level.
53  */
54 
55 #include "snmp.h"
56 
57 /**
58  * \addtogroup SNMPMIB SNMP MIB
59  * @{
60  *
61  * This group contains the MIB implementation
62  */
63 
64 /**
65  * @brief The MIB resource handler typedef
66  *
67  * @param varbind The varbind that is being changed
68  * @param oid The oid from the resource
69  */
71 
72 /**
73  * @brief The MIB Resource struct
74  */
75 typedef struct snmp_mib_resource_s {
76  /**
77  * @brief A pointer to the next element in the linked list
78  *
79  * @remarks This MUST be the first element in the struct
80  */
82  /**
83  * @brief A OID struct
84  */
86  /**
87  * @brief The function handler that is called for this resource
88  */
91 
92 /**
93  * @brief Finds the MIB Resource for this OID
94  *
95  * @param oid The OID
96  *
97  * @return In case of success a pointer to the resouce or NULL in case of fail
98  */
101 
102 /**
103  * @brief Finds the next MIB Resource after this OID
104  *
105  * @param oid The OID
106  *
107  * @return In case of success a pointer to the resouce or NULL in case of fail
108  */
111 
112 /**
113  * @brief Adds a resource into the linked list
114  *
115  * @param resource The resource
116  */
117 void
119 
120 /**
121  * @brief Initialize the MIB resources list
122  */
123 void
124 snmp_mib_init(void);
125 
126 /** @} */
127 
128 /** @} */
129 
130 #endif /* SNMP_MIB_H_ */
131 
132 /** @} */
SNMP Implementation of the process
void snmp_mib_add(snmp_mib_resource_t *resource)
Adds a resource into the linked list.
Definition: snmp-mib.c:123
snmp_mib_resource_handler_t handler
The function handler that is called for this resource.
Definition: snmp-mib.h:89
The varbind struct.
Definition: snmp.h:159
The MIB Resource struct.
Definition: snmp-mib.h:75
void(* snmp_mib_resource_handler_t)(snmp_varbind_t *varbind, snmp_oid_t *oid)
The MIB resource handler typedef.
Definition: snmp-mib.h:70
struct snmp_mib_resource_s * next
A pointer to the next element in the linked list.
Definition: snmp-mib.h:81
The OID struct.
Definition: snmp.h:144
struct snmp_mib_resource_s snmp_mib_resource_t
The MIB Resource struct.
snmp_mib_resource_t * snmp_mib_find(snmp_oid_t *oid)
Finds the MIB Resource for this OID.
Definition: snmp-mib.c:89
void snmp_mib_init(void)
Initialize the MIB resources list.
Definition: snmp-mib.c:164
snmp_oid_t oid
A OID struct.
Definition: snmp-mib.h:85
snmp_mib_resource_t * snmp_mib_find_next(snmp_oid_t *oid)
Finds the next MIB Resource after this OID.
Definition: snmp-mib.c:106