Marco Zecchini
/
Example_RTOS
Rtos API example
Embed:
(wiki syntax)
Show/hide line numbers
snmp.h
Go to the documentation of this file.
00001 /** 00002 * @file 00003 * SNMP server main API - start and basic configuration 00004 */ 00005 00006 /* 00007 * Copyright (c) 2001, 2002 Leon Woestenberg <leon.woestenberg@axon.tv> 00008 * Copyright (c) 2001, 2002 Axon Digital Design B.V., The Netherlands. 00009 * All rights reserved. 00010 * 00011 * Redistribution and use in source and binary forms, with or without modification, 00012 * are permitted provided that the following conditions are met: 00013 * 00014 * 1. Redistributions of source code must retain the above copyright notice, 00015 * this list of conditions and the following disclaimer. 00016 * 2. Redistributions in binary form must reproduce the above copyright notice, 00017 * this list of conditions and the following disclaimer in the documentation 00018 * and/or other materials provided with the distribution. 00019 * 3. The name of the author may not be used to endorse or promote products 00020 * derived from this software without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 00023 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00024 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 00025 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00026 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00027 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00028 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00029 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00030 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 00031 * OF SUCH DAMAGE. 00032 * 00033 * This file is part of the lwIP TCP/IP stack. 00034 * 00035 * Author: Leon Woestenberg <leon.woestenberg@axon.tv> 00036 * Martin Hentschel <info@cl-soft.de> 00037 * 00038 */ 00039 #ifndef LWIP_HDR_APPS_SNMP_H 00040 #define LWIP_HDR_APPS_SNMP_H 00041 00042 #include "lwip/apps/snmp_opts.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 #include "lwip/err.h" 00051 #include "lwip/apps/snmp_core.h" 00052 00053 /** SNMP variable binding descriptor (publically needed for traps) */ 00054 struct snmp_varbind 00055 { 00056 /** pointer to next varbind, NULL for last in list */ 00057 struct snmp_varbind *next; 00058 /** pointer to previous varbind, NULL for first in list */ 00059 struct snmp_varbind *prev; 00060 00061 /** object identifier */ 00062 struct snmp_obj_id oid; 00063 00064 /** value ASN1 type */ 00065 u8_t type; 00066 /** object value length */ 00067 u16_t value_len; 00068 /** object value */ 00069 void *value; 00070 }; 00071 00072 /** 00073 * @ingroup snmp_core 00074 * Agent setup, start listening to port 161. 00075 */ 00076 void snmp_init(void); 00077 void snmp_set_mibs(const struct snmp_mib **mibs, u8_t num_mibs); 00078 00079 void snmp_set_device_enterprise_oid(const struct snmp_obj_id* device_enterprise_oid); 00080 const struct snmp_obj_id* snmp_get_device_enterprise_oid(void); 00081 00082 void snmp_trap_dst_enable(u8_t dst_idx, u8_t enable); 00083 void snmp_trap_dst_ip_set(u8_t dst_idx, const ip_addr_t *dst); 00084 00085 /** Generic trap: cold start */ 00086 #define SNMP_GENTRAP_COLDSTART 0 00087 /** Generic trap: warm start */ 00088 #define SNMP_GENTRAP_WARMSTART 1 00089 /** Generic trap: link down */ 00090 #define SNMP_GENTRAP_LINKDOWN 2 00091 /** Generic trap: link up */ 00092 #define SNMP_GENTRAP_LINKUP 3 00093 /** Generic trap: authentication failure */ 00094 #define SNMP_GENTRAP_AUTH_FAILURE 4 00095 /** Generic trap: EGP neighbor lost */ 00096 #define SNMP_GENTRAP_EGP_NEIGHBOR_LOSS 5 00097 /** Generic trap: enterprise specific */ 00098 #define SNMP_GENTRAP_ENTERPRISE_SPECIFIC 6 00099 00100 err_t snmp_send_trap_generic(s32_t generic_trap); 00101 err_t snmp_send_trap_specific(s32_t specific_trap, struct snmp_varbind *varbinds); 00102 err_t snmp_send_trap(const struct snmp_obj_id* oid, s32_t generic_trap, s32_t specific_trap, struct snmp_varbind *varbinds); 00103 00104 #define SNMP_AUTH_TRAPS_DISABLED 0 00105 #define SNMP_AUTH_TRAPS_ENABLED 1 00106 void snmp_set_auth_traps_enabled(u8_t enable); 00107 u8_t snmp_get_auth_traps_enabled(void); 00108 00109 const char * snmp_get_community(void); 00110 const char * snmp_get_community_write(void); 00111 const char * snmp_get_community_trap(void); 00112 void snmp_set_community(const char * const community); 00113 void snmp_set_community_write(const char * const community); 00114 void snmp_set_community_trap(const char * const community); 00115 00116 void snmp_coldstart_trap(void); 00117 void snmp_authfail_trap(void); 00118 00119 typedef void (*snmp_write_callback_fct)(const u32_t* oid, u8_t oid_len, void* callback_arg); 00120 void snmp_set_write_callback(snmp_write_callback_fct write_callback, void* callback_arg); 00121 00122 #endif /* LWIP_SNMP */ 00123 00124 #ifdef __cplusplus 00125 } 00126 #endif 00127 00128 #endif /* LWIP_HDR_APPS_SNMP_H */
Generated on Sun Jul 17 2022 08:25:30 by 1.7.2