BA / Mbed OS BaBoRo1
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 #if LWIP_SNMP && LWIP_SNMP_V3
00042 
00043 #define SNMP_V3_AUTH_ALGO_INVAL  0
00044 #define SNMP_V3_AUTH_ALGO_MD5    1
00045 #define SNMP_V3_AUTH_ALGO_SHA    2
00046 
00047 #define SNMP_V3_PRIV_ALGO_INVAL  0
00048 #define SNMP_V3_PRIV_ALGO_DES    1
00049 #define SNMP_V3_PRIV_ALGO_AES    2
00050 
00051 #define SNMP_V3_PRIV_MODE_DECRYPT  0
00052 #define SNMP_V3_PRIV_MODE_ENCRYPT  1
00053 
00054 /*
00055  * The following callback functions must be implemented by the application.
00056  * There is a dummy implementation in snmpv3_dummy.c.
00057  */
00058 
00059 void snmpv3_get_engine_id(const char **id, u8_t *len);
00060 err_t snmpv3_set_engine_id(const char* id, u8_t len);
00061 
00062 u32_t snmpv3_get_engine_boots(void);
00063 void snmpv3_set_engine_boots(u32_t boots);
00064 
00065 u32_t snmpv3_get_engine_time(void);
00066 void snmpv3_reset_engine_time(void);
00067 
00068 err_t snmpv3_get_user (const char* username, u8_t *auth_algo, u8_t *auth_key, u8_t *priv_algo, u8_t *priv_key);
00069 
00070 /* The following functions are provided by the SNMPv3 agent */
00071 
00072 void snmpv3_engine_id_changed(void);
00073 
00074 void snmpv3_password_to_key_md5(
00075     const u8_t *password,     /* IN */
00076     u8_t        passwordlen,  /* IN */
00077     const u8_t *engineID,     /* IN  - pointer to snmpEngineID  */
00078     u8_t        engineLength, /* IN  - length of snmpEngineID */
00079     u8_t       *key);         /* OUT - pointer to caller 16-octet buffer */
00080 
00081 void snmpv3_password_to_key_sha(
00082     const u8_t *password,     /* IN */
00083     u8_t        passwordlen,  /* IN */
00084     const u8_t *engineID,     /* IN  - pointer to snmpEngineID  */
00085     u8_t        engineLength, /* IN  - length of snmpEngineID */
00086     u8_t       *key);         /* OUT - pointer to caller 20-octet buffer */
00087 
00088 #endif
00089 
00090 #endif /* LWIP_HDR_APPS_SNMP_V3_H */