sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
snmpv3.h
Go to the documentation of this file.
1
6
7/*
8 * Copyright (c) 2016 Elias Oenal.
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 * Author: Elias Oenal <lwip@eliasoenal.com>
34 */
35
36#ifndef LWIP_HDR_APPS_SNMP_V3_H
37#define LWIP_HDR_APPS_SNMP_V3_H
38
39#include "lwip/apps/snmp_opts.h"
40#include "lwip/err.h"
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46#if LWIP_SNMP && LWIP_SNMP_V3
47
48typedef enum
49{
50 SNMP_V3_AUTH_ALGO_INVAL = 0,
51 SNMP_V3_AUTH_ALGO_MD5 = 1,
52 SNMP_V3_AUTH_ALGO_SHA = 2
53} snmpv3_auth_algo_t;
54
55typedef enum
56{
57 SNMP_V3_PRIV_ALGO_INVAL = 0,
58 SNMP_V3_PRIV_ALGO_DES = 1,
59 SNMP_V3_PRIV_ALGO_AES = 2
60} snmpv3_priv_algo_t;
61
62typedef enum
63{
64 SNMP_V3_USER_STORAGETYPE_OTHER = 1,
65 SNMP_V3_USER_STORAGETYPE_VOLATILE = 2,
66 SNMP_V3_USER_STORAGETYPE_NONVOLATILE = 3,
67 SNMP_V3_USER_STORAGETYPE_PERMANENT = 4,
68 SNMP_V3_USER_STORAGETYPE_READONLY = 5
69} snmpv3_user_storagetype_t;
70
71/*
72 * The following callback functions must be implemented by the application.
73 * There is a dummy implementation in snmpv3_dummy.c.
74 */
75
76void snmpv3_get_engine_id(const char **id, u8_t *len);
77err_t snmpv3_set_engine_id(const char* id, u8_t len);
78
79u32_t snmpv3_get_engine_boots(void);
80void snmpv3_set_engine_boots(u32_t boots);
81
82u32_t snmpv3_get_engine_time(void);
83void snmpv3_reset_engine_time(void);
84
85err_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);
86u8_t snmpv3_get_amount_of_users(void);
87err_t snmpv3_get_user_storagetype(const char *username, snmpv3_user_storagetype_t *storagetype);
88err_t snmpv3_get_username(char *username, u8_t index);
89
90/* The following functions are provided by the SNMPv3 agent */
91
92void snmpv3_engine_id_changed(void);
93s32_t snmpv3_get_engine_time_internal(void);
94
95void snmpv3_password_to_key_md5(
96 const u8_t *password, /* IN */
97 size_t passwordlen, /* IN */
98 const u8_t *engineID, /* IN - pointer to snmpEngineID */
99 u8_t engineLength, /* IN - length of snmpEngineID */
100 u8_t *key); /* OUT - pointer to caller 16-octet buffer */
101
102void snmpv3_password_to_key_sha(
103 const u8_t *password, /* IN */
104 size_t passwordlen, /* IN */
105 const u8_t *engineID, /* IN - pointer to snmpEngineID */
106 u8_t engineLength, /* IN - length of snmpEngineID */
107 u8_t *key); /* OUT - pointer to caller 20-octet buffer */
108
109#endif
110
111#ifdef __cplusplus
112}
113#endif
114
115#endif /* LWIP_HDR_APPS_SNMP_V3_H */