Mistake on this page?
Report an issue in GitHub or email us
snmp_scalar.h
Go to the documentation of this file.
1 /**
2  * @file
3  * SNMP server MIB API to implement scalar nodes
4  */
5 
6 /*
7  * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without modification,
11  * are permitted provided that the following conditions are met:
12  *
13  * 1. Redistributions of source code must retain the above copyright notice,
14  * this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  * 3. The name of the author may not be used to endorse or promote products
19  * derived from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
22  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
24  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
26  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
30  * OF SUCH DAMAGE.
31  *
32  * This file is part of the lwIP TCP/IP stack.
33  *
34  * Author: Martin Hentschel <info@cl-soft.de>
35  *
36  */
37 
38 #ifndef LWIP_HDR_APPS_SNMP_SCALAR_H
39 #define LWIP_HDR_APPS_SNMP_SCALAR_H
40 
41 #include "lwip/apps/snmp_opts.h"
42 #include "lwip/apps/snmp_core.h"
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 #if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */
49 
50 /** basic scalar node */
51 struct snmp_scalar_node
52 {
53  /** inherited "base class" members */
54  struct snmp_leaf_node node;
55  u8_t asn1_type;
56  snmp_access_t access;
57  node_instance_get_value_method get_value;
58  node_instance_set_test_method set_test;
59  node_instance_set_value_method set_value;
60 };
61 
62 
63 snmp_err_t snmp_scalar_get_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance);
64 snmp_err_t snmp_scalar_get_next_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance);
65 
66 #define SNMP_SCALAR_CREATE_NODE(oid, access, asn1_type, get_value_method, set_test_method, set_value_method) \
67  {{{ SNMP_NODE_SCALAR, (oid) }, \
68  snmp_scalar_get_instance, \
69  snmp_scalar_get_next_instance }, \
70  (asn1_type), (access), (get_value_method), (set_test_method), (set_value_method) }
71 
72 #define SNMP_SCALAR_CREATE_NODE_READONLY(oid, asn1_type, get_value_method) SNMP_SCALAR_CREATE_NODE(oid, SNMP_NODE_INSTANCE_READ_ONLY, asn1_type, get_value_method, NULL, NULL)
73 
74 /** scalar array node - a tree node which contains scalars only as children */
75 struct snmp_scalar_array_node_def
76 {
77  u32_t oid;
78  u8_t asn1_type;
79  snmp_access_t access;
80 };
81 
82 typedef s16_t (*snmp_scalar_array_get_value_method)(const struct snmp_scalar_array_node_def*, void*);
83 typedef snmp_err_t (*snmp_scalar_array_set_test_method)(const struct snmp_scalar_array_node_def*, u16_t, void*);
84 typedef snmp_err_t (*snmp_scalar_array_set_value_method)(const struct snmp_scalar_array_node_def*, u16_t, void*);
85 
86 /** basic scalar array node */
87 struct snmp_scalar_array_node
88 {
89  /** inherited "base class" members */
90  struct snmp_leaf_node node;
91  u16_t array_node_count;
92  const struct snmp_scalar_array_node_def* array_nodes;
93  snmp_scalar_array_get_value_method get_value;
94  snmp_scalar_array_set_test_method set_test;
95  snmp_scalar_array_set_value_method set_value;
96 };
97 
98 snmp_err_t snmp_scalar_array_get_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance);
99 snmp_err_t snmp_scalar_array_get_next_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance);
100 
101 #define SNMP_SCALAR_CREATE_ARRAY_NODE(oid, array_nodes, get_value_method, set_test_method, set_value_method) \
102  {{{ SNMP_NODE_SCALAR_ARRAY, (oid) }, \
103  snmp_scalar_array_get_instance, \
104  snmp_scalar_array_get_next_instance }, \
105  (u16_t)LWIP_ARRAYSIZE(array_nodes), (array_nodes), (get_value_method), (set_test_method), (set_value_method) }
106 
107 #endif /* LWIP_SNMP */
108 
109 #ifdef __cplusplus
110 }
111 #endif
112 
113 #endif /* LWIP_HDR_APPS_SNMP_SCALAR_H */
Connected isochronous stream node.
Definition: lctr_int_cis.h:299
SNMP core API for implementing MIBs.
SNMP server options list.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.