Mistake on this page?
Report an issue in GitHub or email us
apps/snmp.h
Go to the documentation of this file.
1 /**
2  * @file
3  * SNMP server main API - start and basic configuration
4  */
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
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 
53 /** SNMP variable binding descriptor (publically needed for traps) */
54 struct snmp_varbind
55 {
56  /** pointer to next varbind, NULL for last in list */
57  struct snmp_varbind *next;
58  /** pointer to previous varbind, NULL for first in list */
59  struct snmp_varbind *prev;
60 
61  /** object identifier */
62  struct snmp_obj_id oid;
63 
64  /** value ASN1 type */
65  u8_t type;
66  /** object value length */
67  u16_t value_len;
68  /** object value */
69  void *value;
70 };
71 
72 /**
73  * @ingroup snmp_core
74  * Agent setup, start listening to port 161.
75  */
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 
85 /** Generic trap: cold start */
86 #define SNMP_GENTRAP_COLDSTART 0
87 /** Generic trap: warm start */
88 #define SNMP_GENTRAP_WARMSTART 1
89 /** Generic trap: link down */
90 #define SNMP_GENTRAP_LINKDOWN 2
91 /** Generic trap: link up */
92 #define SNMP_GENTRAP_LINKUP 3
93 /** Generic trap: authentication failure */
94 #define SNMP_GENTRAP_AUTH_FAILURE 4
95 /** Generic trap: EGP neighbor lost */
96 #define SNMP_GENTRAP_EGP_NEIGHBOR_LOSS 5
97 /** Generic trap: enterprise specific */
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 u8_t snmp_v1_enabled(void);
110 u8_t snmp_v2c_enabled(void);
111 u8_t snmp_v3_enabled(void);
112 void snmp_v1_enable(u8_t enable);
113 void snmp_v2c_enable(u8_t enable);
114 void snmp_v3_enable(u8_t enable);
115 
116 const char * snmp_get_community(void);
117 const char * snmp_get_community_write(void);
118 const char * snmp_get_community_trap(void);
119 void snmp_set_community(const char * const community);
120 void snmp_set_community_write(const char * const community);
121 void snmp_set_community_trap(const char * const community);
122 
123 void snmp_coldstart_trap(void);
124 void snmp_authfail_trap(void);
125 
126 typedef void (*snmp_write_callback_fct)(const u32_t* oid, u8_t oid_len, void* callback_arg);
127 void snmp_set_write_callback(snmp_write_callback_fct write_callback, void* callback_arg);
128 
129 #endif /* LWIP_SNMP */
130 
131 #ifdef __cplusplus
132 }
133 #endif
134 
135 #endif /* LWIP_HDR_APPS_SNMP_H */
SNMP core API for implementing MIBs.
lwIP Error codes
SNMP server options list.
IP address structure for passing IP addresses by value.
Definition: nsapi_types.h:235
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.