Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers snmpv3.h Source File

snmpv3.h

Go to the documentation of this file.
00001 /**
00002  * @file
00003  * Additional SNMPv3 functionality RFC3414 and RFC3826.
00004  */
00005 
00006 /*
00007  * Copyright (c) 2016 Elias Oenal.
00008  * All rights reserved.
00009  *
00010  * Redistribution and use in source and binary forms, with or without modification,
00011  * are permitted provided that the following conditions are met:
00012  *
00013  * 1. Redistributions of source code must retain the above copyright notice,
00014  *    this list of conditions and the following disclaimer.
00015  * 2. Redistributions in binary form must reproduce the above copyright notice,
00016  *    this list of conditions and the following disclaimer in the documentation
00017  *    and/or other materials provided with the distribution.
00018  * 3. The name of the author may not be used to endorse or promote products
00019  *    derived from this software without specific prior written permission.
00020  *
00021  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00022  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00023  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
00024  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00025  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00026  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00027  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00028  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
00029  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00030  * OF SUCH DAMAGE.
00031  *
00032  * Author: Elias Oenal <lwip@eliasoenal.com>
00033  */
00034 
00035 #ifndef LWIP_HDR_APPS_SNMP_V3_H
00036 #define LWIP_HDR_APPS_SNMP_V3_H
00037 
00038 #include "lwip/apps/snmp_opts.h"
00039 #include "lwip/err.h"
00040 
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif
00044 
00045 #if LWIP_SNMP && LWIP_SNMP_V3
00046 
00047 typedef enum
00048 {
00049   SNMP_V3_AUTH_ALGO_INVAL = 0,
00050   SNMP_V3_AUTH_ALGO_MD5   = 1,
00051   SNMP_V3_AUTH_ALGO_SHA   = 2
00052 } snmpv3_auth_algo_t;
00053 
00054 typedef enum
00055 {
00056   SNMP_V3_PRIV_ALGO_INVAL = 0,
00057   SNMP_V3_PRIV_ALGO_DES   = 1,
00058   SNMP_V3_PRIV_ALGO_AES   = 2
00059 } snmpv3_priv_algo_t;
00060 
00061 typedef enum
00062 {
00063   SNMP_V3_USER_STORAGETYPE_OTHER       = 1,
00064   SNMP_V3_USER_STORAGETYPE_VOLATILE    = 2,
00065   SNMP_V3_USER_STORAGETYPE_NONVOLATILE = 3,
00066   SNMP_V3_USER_STORAGETYPE_PERMANENT   = 4,
00067   SNMP_V3_USER_STORAGETYPE_READONLY    = 5
00068 } snmpv3_user_storagetype_t;
00069 
00070 /*
00071  * The following callback functions must be implemented by the application.
00072  * There is a dummy implementation in snmpv3_dummy.c.
00073  */
00074 
00075 void snmpv3_get_engine_id(const char **id, u8_t *len);
00076 err_t snmpv3_set_engine_id(const char* id, u8_t len);
00077 
00078 u32_t snmpv3_get_engine_boots(void);
00079 void snmpv3_set_engine_boots(u32_t boots);
00080 
00081 u32_t snmpv3_get_engine_time(void);
00082 void snmpv3_reset_engine_time(void);
00083 
00084 err_t snmpv3_get_user(const char* username, snmpv3_auth_algo_t *auth_algo, u8_t *auth_key, snmpv3_priv_algo_t *priv_algo, u8_t *priv_key);
00085 u8_t snmpv3_get_amount_of_users(void);
00086 err_t snmpv3_get_user_storagetype(const char *username, snmpv3_user_storagetype_t *storagetype);
00087 err_t snmpv3_get_username(char *username, u8_t index);
00088 
00089 /* The following functions are provided by the SNMPv3 agent */
00090 
00091 void snmpv3_engine_id_changed(void);
00092 s32_t snmpv3_get_engine_time_internal(void);
00093 
00094 void snmpv3_password_to_key_md5(
00095     const u8_t *password,     /* IN */
00096     size_t      passwordlen,  /* IN */
00097     const u8_t *engineID,     /* IN  - pointer to snmpEngineID  */
00098     u8_t        engineLength, /* IN  - length of snmpEngineID */
00099     u8_t       *key);         /* OUT - pointer to caller 16-octet buffer */
00100 
00101 void snmpv3_password_to_key_sha(
00102     const u8_t *password,     /* IN */
00103     size_t      passwordlen,  /* IN */
00104     const u8_t *engineID,     /* IN  - pointer to snmpEngineID  */
00105     u8_t        engineLength, /* IN  - length of snmpEngineID */
00106     u8_t       *key);         /* OUT - pointer to caller 20-octet buffer */
00107 
00108 #endif
00109 
00110 #ifdef __cplusplus
00111 }
00112 #endif
00113 
00114 #endif /* LWIP_HDR_APPS_SNMP_V3_H */