Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-os by
snmp_scalar.h
00001 /** 00002 * @file 00003 * SNMP server MIB API to implement scalar nodes 00004 */ 00005 00006 /* 00007 * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 00008 * All rights reserved. 00009 * 00010 * Redistribution and use in source and binary forms, with or without modification, 00011 * are permitted provided that the following conditions are met: 00012 * 00013 * 1. Redistributions of source code must retain the above copyright notice, 00014 * this list of conditions and the following disclaimer. 00015 * 2. Redistributions in binary form must reproduce the above copyright notice, 00016 * this list of conditions and the following disclaimer in the documentation 00017 * and/or other materials provided with the distribution. 00018 * 3. The name of the author may not be used to endorse or promote products 00019 * derived from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 00022 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00023 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 00024 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00025 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00026 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00027 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00028 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00029 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 00030 * OF SUCH DAMAGE. 00031 * 00032 * This file is part of the lwIP TCP/IP stack. 00033 * 00034 * Author: Martin Hentschel <info@cl-soft.de> 00035 * 00036 */ 00037 00038 #ifndef LWIP_HDR_APPS_SNMP_SCALAR_H 00039 #define LWIP_HDR_APPS_SNMP_SCALAR_H 00040 00041 #include "lwip/apps/snmp_opts.h" 00042 #include "lwip/apps/snmp_core.h" 00043 00044 #ifdef __cplusplus 00045 extern "C" { 00046 #endif 00047 00048 #if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */ 00049 00050 /** basic scalar node */ 00051 struct snmp_scalar_node 00052 { 00053 /** inherited "base class" members */ 00054 struct snmp_leaf_node node; 00055 u8_t asn1_type; 00056 snmp_access_t access; 00057 node_instance_get_value_method get_value; 00058 node_instance_set_test_method set_test; 00059 node_instance_set_value_method set_value; 00060 }; 00061 00062 00063 snmp_err_t snmp_scalar_get_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance); 00064 snmp_err_t snmp_scalar_get_next_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance); 00065 00066 #define SNMP_SCALAR_CREATE_NODE(oid, access, asn1_type, get_value_method, set_test_method, set_value_method) \ 00067 {{{ SNMP_NODE_SCALAR, (oid) }, \ 00068 snmp_scalar_get_instance, \ 00069 snmp_scalar_get_next_instance }, \ 00070 (asn1_type), (access), (get_value_method), (set_test_method), (set_value_method) } 00071 00072 #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) 00073 00074 /** scalar array node - a tree node which contains scalars only as children */ 00075 struct snmp_scalar_array_node_def 00076 { 00077 u32_t oid; 00078 u8_t asn1_type; 00079 snmp_access_t access; 00080 }; 00081 00082 typedef s16_t (*snmp_scalar_array_get_value_method)(const struct snmp_scalar_array_node_def*, void*); 00083 typedef snmp_err_t (*snmp_scalar_array_set_test_method)(const struct snmp_scalar_array_node_def*, u16_t, void*); 00084 typedef snmp_err_t (*snmp_scalar_array_set_value_method)(const struct snmp_scalar_array_node_def*, u16_t, void*); 00085 00086 /** basic scalar array node */ 00087 struct snmp_scalar_array_node 00088 { 00089 /** inherited "base class" members */ 00090 struct snmp_leaf_node node; 00091 u16_t array_node_count; 00092 const struct snmp_scalar_array_node_def* array_nodes; 00093 snmp_scalar_array_get_value_method get_value; 00094 snmp_scalar_array_set_test_method set_test; 00095 snmp_scalar_array_set_value_method set_value; 00096 }; 00097 00098 snmp_err_t snmp_scalar_array_get_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance); 00099 snmp_err_t snmp_scalar_array_get_next_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance); 00100 00101 #define SNMP_SCALAR_CREATE_ARRAY_NODE(oid, array_nodes, get_value_method, set_test_method, set_value_method) \ 00102 {{{ SNMP_NODE_SCALAR_ARRAY, (oid) }, \ 00103 snmp_scalar_array_get_instance, \ 00104 snmp_scalar_array_get_next_instance }, \ 00105 (u16_t)LWIP_ARRAYSIZE(array_nodes), (array_nodes), (get_value_method), (set_test_method), (set_value_method) } 00106 00107 #endif /* LWIP_SNMP */ 00108 00109 #ifdef __cplusplus 00110 } 00111 #endif 00112 00113 #endif /* LWIP_HDR_APPS_SNMP_SCALAR_H */
Generated on Tue Jul 12 2022 13:16:06 by
