38 #ifndef LWIP_HDR_APPS_SNMP_MSG_H 39 #define LWIP_HDR_APPS_SNMP_MSG_H 47 #include "snmp_pbuf_stream.h" 52 #include "snmpv3_priv.h" 61 #define SNMP_VERSION_1 0 62 #define SNMP_VERSION_2c 1 63 #define SNMP_VERSION_3 3 65 struct snmp_varbind_enumerator {
66 struct snmp_pbuf_stream pbuf_stream;
71 SNMP_VB_ENUMERATOR_ERR_OK = 0,
72 SNMP_VB_ENUMERATOR_ERR_EOVB = 1,
73 SNMP_VB_ENUMERATOR_ERR_ASN1ERROR = 2,
74 SNMP_VB_ENUMERATOR_ERR_INVALIDLENGTH = 3
75 } snmp_vb_enumerator_err_t;
77 void snmp_vb_enumerator_init(
struct snmp_varbind_enumerator *enumerator,
struct pbuf *p, u16_t offset, u16_t length);
78 snmp_vb_enumerator_err_t snmp_vb_enumerator_get_next(
struct snmp_varbind_enumerator *enumerator,
struct snmp_varbind *varbind);
92 u16_t community_strlen;
104 s32_t max_repetitions;
107 u8_t request_out_type;
113 s32_t msg_security_model;
114 u8_t msg_authoritative_engine_id[SNMP_V3_MAX_ENGINE_ID_LENGTH];
115 u8_t msg_authoritative_engine_id_len;
116 s32_t msg_authoritative_engine_boots;
117 s32_t msg_authoritative_engine_time;
118 u8_t msg_user_name[SNMP_V3_MAX_USER_LENGTH];
119 u8_t msg_user_name_len;
120 u8_t msg_authentication_parameters[SNMP_V3_MAX_AUTH_PARAM_LENGTH];
121 u8_t msg_authentication_parameters_len;
122 u8_t msg_privacy_parameters[SNMP_V3_MAX_PRIV_PARAM_LENGTH];
123 u8_t msg_privacy_parameters_len;
124 u8_t context_engine_id[SNMP_V3_MAX_ENGINE_ID_LENGTH];
125 u8_t context_engine_id_len;
126 u8_t context_name[SNMP_V3_MAX_ENGINE_ID_LENGTH];
127 u8_t context_name_len;
130 struct pbuf *inbound_pbuf;
131 struct snmp_varbind_enumerator inbound_varbind_enumerator;
132 u16_t inbound_varbind_offset;
133 u16_t inbound_varbind_len;
134 u16_t inbound_padding_len;
136 struct pbuf *outbound_pbuf;
137 struct snmp_pbuf_stream outbound_pbuf_stream;
138 u16_t outbound_pdu_offset;
139 u16_t outbound_error_status_offset;
140 u16_t outbound_error_index_offset;
141 u16_t outbound_varbind_offset;
143 u16_t outbound_msg_global_data_offset;
144 u16_t outbound_msg_global_data_end;
145 u16_t outbound_msg_security_parameters_str_offset;
146 u16_t outbound_msg_security_parameters_seq_offset;
147 u16_t outbound_msg_security_parameters_end;
148 u16_t outbound_msg_authentication_parameters_offset;
149 u16_t outbound_scoped_pdu_seq_offset;
150 u16_t outbound_scoped_pdu_string_offset;
157 struct snmp_varbind_len {
163 u16_t value_value_len;
167 extern const char *snmp_community;
169 extern const char *snmp_community_write;
171 extern void *snmp_traps_handle;
173 void snmp_receive(
void *handle,
struct pbuf *p,
const ip_addr_t *source_ip, u16_t port);
174 err_t snmp_sendto(
void *handle,
struct pbuf *p,
const ip_addr_t *dst, u16_t port);
175 u8_t snmp_get_local_ip_for_dst(
void *handle,
const ip_addr_t *dst,
ip_addr_t *result);
176 err_t snmp_varbind_length(
struct snmp_varbind *varbind,
struct snmp_varbind_len *len);
177 err_t snmp_append_outbound_varbind(
struct snmp_pbuf_stream *pbuf_stream,
struct snmp_varbind *varbind);
#define SNMP_MAX_COMMUNITY_STR_LEN
The maximum length of community string.
SNMP core API for implementing MIBs.
Main packet buffer struct.
SNMP server options list.
SNMP server main API - start and basic configuration.
IP address structure for passing IP addresses by value.
IP address API (common IPv4 and IPv6)
#define SNMP_MAX_VALUE_SIZE
The maximum size of a value.