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