sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
snmp.h
Go to the documentation of this file.
1
5
6/*
7 * Copyright (c) 2001, 2002 Leon Woestenberg <leon.woestenberg@axon.tv>
8 * Copyright (c) 2001, 2002 Axon Digital Design B.V., The Netherlands.
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: Leon Woestenberg <leon.woestenberg@axon.tv>
36 * Martin Hentschel <info@cl-soft.de>
37 *
38 */
39#ifndef LWIP_HDR_APPS_SNMP_H
40#define LWIP_HDR_APPS_SNMP_H
41
42#include "lwip/apps/snmp_opts.h"
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */
49
50#include "lwip/err.h"
51#include "lwip/apps/snmp_core.h"
52
54struct snmp_varbind
55{
57 struct snmp_varbind *next;
58
60 struct snmp_obj_id oid;
61
63 u8_t type;
65 u16_t value_len;
67 void *value;
68};
69
74void snmp_init(void);
75void snmp_set_mibs(const struct snmp_mib **mibs, u8_t num_mibs);
76
77void snmp_set_device_enterprise_oid(const struct snmp_obj_id* device_enterprise_oid);
78const struct snmp_obj_id* snmp_get_device_enterprise_oid(void);
79
80void snmp_trap_dst_enable(u8_t dst_idx, u8_t enable);
81void snmp_trap_dst_ip_set(u8_t dst_idx, const ip_addr_t *dst);
82
84#define SNMP_GENTRAP_COLDSTART 0
86#define SNMP_GENTRAP_WARMSTART 1
88#define SNMP_GENTRAP_LINKDOWN 2
90#define SNMP_GENTRAP_LINKUP 3
92#define SNMP_GENTRAP_AUTH_FAILURE 4
94#define SNMP_GENTRAP_EGP_NEIGHBOR_LOSS 5
96#define SNMP_GENTRAP_ENTERPRISE_SPECIFIC 6
97
98err_t snmp_send_trap_generic(s32_t generic_trap);
99err_t snmp_send_trap_specific(s32_t specific_trap, struct snmp_varbind *varbinds);
100err_t snmp_send_trap(const struct snmp_obj_id* oid, s32_t generic_trap, s32_t specific_trap, struct snmp_varbind *varbinds);
101
102err_t snmp_send_inform_generic(s32_t generic_trap, struct snmp_varbind *varbinds, s32_t *ptr_request_id);
103err_t snmp_send_inform_specific(s32_t specific_trap, struct snmp_varbind *varbinds, s32_t *ptr_request_id);
104err_t snmp_send_inform(const struct snmp_obj_id* oid, s32_t generic_trap, s32_t specific_trap, struct snmp_varbind *varbinds, s32_t *ptr_request_id);
105struct snmp_request;
106typedef void (*snmp_inform_callback_fct)(struct snmp_request *request, void* callback_arg);
107void snmp_set_inform_callback(snmp_inform_callback_fct inform_callback, void* callback_arg);
108
109void snmp_set_default_trap_version(u8_t snmp_version);
110u8_t snmp_get_default_trap_version(void);
111
112#define SNMP_AUTH_TRAPS_DISABLED 0
113#define SNMP_AUTH_TRAPS_ENABLED 1
114void snmp_set_auth_traps_enabled(u8_t enable);
115u8_t snmp_get_auth_traps_enabled(void);
116
117u8_t snmp_v1_enabled(void);
118u8_t snmp_v2c_enabled(void);
119u8_t snmp_v3_enabled(void);
120void snmp_v1_enable(u8_t enable);
121void snmp_v2c_enable(u8_t enable);
122void snmp_v3_enable(u8_t enable);
123
124const char * snmp_get_community(void);
125const char * snmp_get_community_write(void);
126const char * snmp_get_community_trap(void);
127void snmp_set_community(const char * const community);
128void snmp_set_community_write(const char * const community);
129void snmp_set_community_trap(const char * const community);
130
131void snmp_coldstart_trap(void);
132void snmp_authfail_trap(void);
133
134typedef void (*snmp_write_callback_fct)(const u32_t* oid, u8_t oid_len, void* callback_arg);
135void snmp_set_write_callback(snmp_write_callback_fct write_callback, void* callback_arg);
136
137#endif /* LWIP_SNMP */
138
139#ifdef __cplusplus
140}
141#endif
142
143#endif /* LWIP_HDR_APPS_SNMP_H */