UbixOS V2  2.0
snmp.h
Go to the documentation of this file.
1 
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
45 extern "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 
54 struct snmp_varbind
55 {
57  struct snmp_varbind *next;
59  struct snmp_varbind *prev;
60 
62  struct snmp_obj_id oid;
63 
65  u8_t type;
67  u16_t value_len;
69  void *value;
70 };
71 
76 void snmp_init(void);
77 void snmp_set_mibs(const struct snmp_mib **mibs, u8_t num_mibs);
78 
79 void snmp_set_device_enterprise_oid(const struct snmp_obj_id* device_enterprise_oid);
80 const struct snmp_obj_id* snmp_get_device_enterprise_oid(void);
81 
82 void snmp_trap_dst_enable(u8_t dst_idx, u8_t enable);
83 void snmp_trap_dst_ip_set(u8_t dst_idx, const ip_addr_t *dst);
84 
86 #define SNMP_GENTRAP_COLDSTART 0
87 
88 #define SNMP_GENTRAP_WARMSTART 1
89 
90 #define SNMP_GENTRAP_LINKDOWN 2
91 
92 #define SNMP_GENTRAP_LINKUP 3
93 
94 #define SNMP_GENTRAP_AUTH_FAILURE 4
95 
96 #define SNMP_GENTRAP_EGP_NEIGHBOR_LOSS 5
97 
98 #define SNMP_GENTRAP_ENTERPRISE_SPECIFIC 6
99 
100 err_t snmp_send_trap_generic(s32_t generic_trap);
101 err_t snmp_send_trap_specific(s32_t specific_trap, struct snmp_varbind *varbinds);
102 err_t snmp_send_trap(const struct snmp_obj_id* oid, s32_t generic_trap, s32_t specific_trap, struct snmp_varbind *varbinds);
103 
104 #define SNMP_AUTH_TRAPS_DISABLED 0
105 #define SNMP_AUTH_TRAPS_ENABLED 1
106 void snmp_set_auth_traps_enabled(u8_t enable);
107 u8_t snmp_get_auth_traps_enabled(void);
108 
109 const char * snmp_get_community(void);
110 const char * snmp_get_community_write(void);
111 const char * snmp_get_community_trap(void);
112 void snmp_set_community(const char * const community);
113 void snmp_set_community_write(const char * const community);
114 void snmp_set_community_trap(const char * const community);
115 
116 void snmp_coldstart_trap(void);
117 void snmp_authfail_trap(void);
118 
119 typedef void (*snmp_write_callback_fct)(const u32_t* oid, u8_t oid_len, void* callback_arg);
120 void snmp_set_write_callback(snmp_write_callback_fct write_callback, void* callback_arg);
121 
122 #endif /* LWIP_SNMP */
123 
124 #ifdef __cplusplus
125 }
126 #endif
127 
128 #endif /* LWIP_HDR_APPS_SNMP_H */
u16_t
uint16_t u16_t
Definition: arch.h:124
u32_t
uint32_t u32_t
Definition: arch.h:126
s32_t
int32_t s32_t
Definition: arch.h:127
u8_t
uint8_t u8_t
Definition: arch.h:122
ip_addr_t
ip6_addr_t ip_addr_t
Definition: ip_addr.h:290
err_t
s8_t err_t
Definition: err.h:57