Official mbed lwIP library (version 1.4.0)

Dependents:   LwIPNetworking NetServicesMin EthernetInterface EthernetInterface_RSF ... more

Legacy Networking Libraries

This is an mbed 2 networking library. For mbed OS 5, lwip has been integrated with built-in networking interfaces. The networking libraries have been revised to better support additional network stacks and thread safety here.

This library is based on the code of lwIP v1.4.0

Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
All rights reserved. 

Redistribution and use in source and binary forms, with or without modification, 
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
   this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
   derived from this software without specific prior written permission. 

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
OF SUCH DAMAGE.
Committer:
mbed_official
Date:
Mon Mar 14 16:15:36 2016 +0000
Revision:
20:08f08bfc3f3d
Parent:
0:51ac1d130fd4
Synchronized with git revision fec574a5ed6db26aca1b13992ff271bf527d4a0d

Full URL: https://github.com/mbedmicro/mbed/commit/fec574a5ed6db26aca1b13992ff271bf527d4a0d/

Increased allocated netbufs to handle DTLS handshakes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 0:51ac1d130fd4 1 /**
mbed_official 0:51ac1d130fd4 2 * @file
mbed_official 0:51ac1d130fd4 3 * SNMP Agent message handling structures.
mbed_official 0:51ac1d130fd4 4 */
mbed_official 0:51ac1d130fd4 5
mbed_official 0:51ac1d130fd4 6 /*
mbed_official 0:51ac1d130fd4 7 * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands.
mbed_official 0:51ac1d130fd4 8 * All rights reserved.
mbed_official 0:51ac1d130fd4 9 *
mbed_official 0:51ac1d130fd4 10 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 0:51ac1d130fd4 11 * are permitted provided that the following conditions are met:
mbed_official 0:51ac1d130fd4 12 *
mbed_official 0:51ac1d130fd4 13 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 0:51ac1d130fd4 14 * this list of conditions and the following disclaimer.
mbed_official 0:51ac1d130fd4 15 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 0:51ac1d130fd4 16 * this list of conditions and the following disclaimer in the documentation
mbed_official 0:51ac1d130fd4 17 * and/or other materials provided with the distribution.
mbed_official 0:51ac1d130fd4 18 * 3. The name of the author may not be used to endorse or promote products
mbed_official 0:51ac1d130fd4 19 * derived from this software without specific prior written permission.
mbed_official 0:51ac1d130fd4 20 *
mbed_official 0:51ac1d130fd4 21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
mbed_official 0:51ac1d130fd4 22 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
mbed_official 0:51ac1d130fd4 23 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
mbed_official 0:51ac1d130fd4 24 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
mbed_official 0:51ac1d130fd4 25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
mbed_official 0:51ac1d130fd4 26 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
mbed_official 0:51ac1d130fd4 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
mbed_official 0:51ac1d130fd4 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
mbed_official 0:51ac1d130fd4 29 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
mbed_official 0:51ac1d130fd4 30 * OF SUCH DAMAGE.
mbed_official 0:51ac1d130fd4 31 *
mbed_official 0:51ac1d130fd4 32 * Author: Christiaan Simons <christiaan.simons@axon.tv>
mbed_official 0:51ac1d130fd4 33 */
mbed_official 0:51ac1d130fd4 34
mbed_official 0:51ac1d130fd4 35 #ifndef __LWIP_SNMP_MSG_H__
mbed_official 0:51ac1d130fd4 36 #define __LWIP_SNMP_MSG_H__
mbed_official 0:51ac1d130fd4 37
mbed_official 0:51ac1d130fd4 38 #include "lwip/opt.h"
mbed_official 0:51ac1d130fd4 39 #include "lwip/snmp.h"
mbed_official 0:51ac1d130fd4 40 #include "lwip/snmp_structs.h"
mbed_official 0:51ac1d130fd4 41 #include "lwip/ip_addr.h"
mbed_official 0:51ac1d130fd4 42 #include "lwip/err.h"
mbed_official 0:51ac1d130fd4 43
mbed_official 0:51ac1d130fd4 44 #if LWIP_SNMP
mbed_official 0:51ac1d130fd4 45
mbed_official 0:51ac1d130fd4 46 #if SNMP_PRIVATE_MIB
mbed_official 0:51ac1d130fd4 47 /* When using a private MIB, you have to create a file 'private_mib.h' that contains
mbed_official 0:51ac1d130fd4 48 * a 'struct mib_array_node mib_private' which contains your MIB. */
mbed_official 0:51ac1d130fd4 49 #include "private_mib.h"
mbed_official 0:51ac1d130fd4 50 #endif
mbed_official 0:51ac1d130fd4 51
mbed_official 0:51ac1d130fd4 52 #ifdef __cplusplus
mbed_official 0:51ac1d130fd4 53 extern "C" {
mbed_official 0:51ac1d130fd4 54 #endif
mbed_official 0:51ac1d130fd4 55
mbed_official 0:51ac1d130fd4 56 /* The listen port of the SNMP agent. Clients have to make their requests to
mbed_official 0:51ac1d130fd4 57 this port. Most standard clients won't work if you change this! */
mbed_official 0:51ac1d130fd4 58 #ifndef SNMP_IN_PORT
mbed_official 0:51ac1d130fd4 59 #define SNMP_IN_PORT 161
mbed_official 0:51ac1d130fd4 60 #endif
mbed_official 0:51ac1d130fd4 61 /* The remote port the SNMP agent sends traps to. Most standard trap sinks won't
mbed_official 0:51ac1d130fd4 62 work if you change this! */
mbed_official 0:51ac1d130fd4 63 #ifndef SNMP_TRAP_PORT
mbed_official 0:51ac1d130fd4 64 #define SNMP_TRAP_PORT 162
mbed_official 0:51ac1d130fd4 65 #endif
mbed_official 0:51ac1d130fd4 66
mbed_official 0:51ac1d130fd4 67 #define SNMP_ES_NOERROR 0
mbed_official 0:51ac1d130fd4 68 #define SNMP_ES_TOOBIG 1
mbed_official 0:51ac1d130fd4 69 #define SNMP_ES_NOSUCHNAME 2
mbed_official 0:51ac1d130fd4 70 #define SNMP_ES_BADVALUE 3
mbed_official 0:51ac1d130fd4 71 #define SNMP_ES_READONLY 4
mbed_official 0:51ac1d130fd4 72 #define SNMP_ES_GENERROR 5
mbed_official 0:51ac1d130fd4 73
mbed_official 0:51ac1d130fd4 74 #define SNMP_GENTRAP_COLDSTART 0
mbed_official 0:51ac1d130fd4 75 #define SNMP_GENTRAP_WARMSTART 1
mbed_official 0:51ac1d130fd4 76 #define SNMP_GENTRAP_AUTHFAIL 4
mbed_official 0:51ac1d130fd4 77 #define SNMP_GENTRAP_ENTERPRISESPC 6
mbed_official 0:51ac1d130fd4 78
mbed_official 0:51ac1d130fd4 79 struct snmp_varbind
mbed_official 0:51ac1d130fd4 80 {
mbed_official 0:51ac1d130fd4 81 /* next pointer, NULL for last in list */
mbed_official 0:51ac1d130fd4 82 struct snmp_varbind *next;
mbed_official 0:51ac1d130fd4 83 /* previous pointer, NULL for first in list */
mbed_official 0:51ac1d130fd4 84 struct snmp_varbind *prev;
mbed_official 0:51ac1d130fd4 85
mbed_official 0:51ac1d130fd4 86 /* object identifier length (in s32_t) */
mbed_official 0:51ac1d130fd4 87 u8_t ident_len;
mbed_official 0:51ac1d130fd4 88 /* object identifier array */
mbed_official 0:51ac1d130fd4 89 s32_t *ident;
mbed_official 0:51ac1d130fd4 90
mbed_official 0:51ac1d130fd4 91 /* object value ASN1 type */
mbed_official 0:51ac1d130fd4 92 u8_t value_type;
mbed_official 0:51ac1d130fd4 93 /* object value length (in u8_t) */
mbed_official 0:51ac1d130fd4 94 u8_t value_len;
mbed_official 0:51ac1d130fd4 95 /* object value */
mbed_official 0:51ac1d130fd4 96 void *value;
mbed_official 0:51ac1d130fd4 97
mbed_official 0:51ac1d130fd4 98 /* encoding varbind seq length length */
mbed_official 0:51ac1d130fd4 99 u8_t seqlenlen;
mbed_official 0:51ac1d130fd4 100 /* encoding object identifier length length */
mbed_official 0:51ac1d130fd4 101 u8_t olenlen;
mbed_official 0:51ac1d130fd4 102 /* encoding object value length length */
mbed_official 0:51ac1d130fd4 103 u8_t vlenlen;
mbed_official 0:51ac1d130fd4 104 /* encoding varbind seq length */
mbed_official 0:51ac1d130fd4 105 u16_t seqlen;
mbed_official 0:51ac1d130fd4 106 /* encoding object identifier length */
mbed_official 0:51ac1d130fd4 107 u16_t olen;
mbed_official 0:51ac1d130fd4 108 /* encoding object value length */
mbed_official 0:51ac1d130fd4 109 u16_t vlen;
mbed_official 0:51ac1d130fd4 110 };
mbed_official 0:51ac1d130fd4 111
mbed_official 0:51ac1d130fd4 112 struct snmp_varbind_root
mbed_official 0:51ac1d130fd4 113 {
mbed_official 0:51ac1d130fd4 114 struct snmp_varbind *head;
mbed_official 0:51ac1d130fd4 115 struct snmp_varbind *tail;
mbed_official 0:51ac1d130fd4 116 /* number of variable bindings in list */
mbed_official 0:51ac1d130fd4 117 u8_t count;
mbed_official 0:51ac1d130fd4 118 /* encoding varbind-list seq length length */
mbed_official 0:51ac1d130fd4 119 u8_t seqlenlen;
mbed_official 0:51ac1d130fd4 120 /* encoding varbind-list seq length */
mbed_official 0:51ac1d130fd4 121 u16_t seqlen;
mbed_official 0:51ac1d130fd4 122 };
mbed_official 0:51ac1d130fd4 123
mbed_official 0:51ac1d130fd4 124 /** output response message header length fields */
mbed_official 0:51ac1d130fd4 125 struct snmp_resp_header_lengths
mbed_official 0:51ac1d130fd4 126 {
mbed_official 0:51ac1d130fd4 127 /* encoding error-index length length */
mbed_official 0:51ac1d130fd4 128 u8_t erridxlenlen;
mbed_official 0:51ac1d130fd4 129 /* encoding error-status length length */
mbed_official 0:51ac1d130fd4 130 u8_t errstatlenlen;
mbed_official 0:51ac1d130fd4 131 /* encoding request id length length */
mbed_official 0:51ac1d130fd4 132 u8_t ridlenlen;
mbed_official 0:51ac1d130fd4 133 /* encoding pdu length length */
mbed_official 0:51ac1d130fd4 134 u8_t pdulenlen;
mbed_official 0:51ac1d130fd4 135 /* encoding community length length */
mbed_official 0:51ac1d130fd4 136 u8_t comlenlen;
mbed_official 0:51ac1d130fd4 137 /* encoding version length length */
mbed_official 0:51ac1d130fd4 138 u8_t verlenlen;
mbed_official 0:51ac1d130fd4 139 /* encoding sequence length length */
mbed_official 0:51ac1d130fd4 140 u8_t seqlenlen;
mbed_official 0:51ac1d130fd4 141
mbed_official 0:51ac1d130fd4 142 /* encoding error-index length */
mbed_official 0:51ac1d130fd4 143 u16_t erridxlen;
mbed_official 0:51ac1d130fd4 144 /* encoding error-status length */
mbed_official 0:51ac1d130fd4 145 u16_t errstatlen;
mbed_official 0:51ac1d130fd4 146 /* encoding request id length */
mbed_official 0:51ac1d130fd4 147 u16_t ridlen;
mbed_official 0:51ac1d130fd4 148 /* encoding pdu length */
mbed_official 0:51ac1d130fd4 149 u16_t pdulen;
mbed_official 0:51ac1d130fd4 150 /* encoding community length */
mbed_official 0:51ac1d130fd4 151 u16_t comlen;
mbed_official 0:51ac1d130fd4 152 /* encoding version length */
mbed_official 0:51ac1d130fd4 153 u16_t verlen;
mbed_official 0:51ac1d130fd4 154 /* encoding sequence length */
mbed_official 0:51ac1d130fd4 155 u16_t seqlen;
mbed_official 0:51ac1d130fd4 156 };
mbed_official 0:51ac1d130fd4 157
mbed_official 0:51ac1d130fd4 158 /** output response message header length fields */
mbed_official 0:51ac1d130fd4 159 struct snmp_trap_header_lengths
mbed_official 0:51ac1d130fd4 160 {
mbed_official 0:51ac1d130fd4 161 /* encoding timestamp length length */
mbed_official 0:51ac1d130fd4 162 u8_t tslenlen;
mbed_official 0:51ac1d130fd4 163 /* encoding specific-trap length length */
mbed_official 0:51ac1d130fd4 164 u8_t strplenlen;
mbed_official 0:51ac1d130fd4 165 /* encoding generic-trap length length */
mbed_official 0:51ac1d130fd4 166 u8_t gtrplenlen;
mbed_official 0:51ac1d130fd4 167 /* encoding agent-addr length length */
mbed_official 0:51ac1d130fd4 168 u8_t aaddrlenlen;
mbed_official 0:51ac1d130fd4 169 /* encoding enterprise-id length length */
mbed_official 0:51ac1d130fd4 170 u8_t eidlenlen;
mbed_official 0:51ac1d130fd4 171 /* encoding pdu length length */
mbed_official 0:51ac1d130fd4 172 u8_t pdulenlen;
mbed_official 0:51ac1d130fd4 173 /* encoding community length length */
mbed_official 0:51ac1d130fd4 174 u8_t comlenlen;
mbed_official 0:51ac1d130fd4 175 /* encoding version length length */
mbed_official 0:51ac1d130fd4 176 u8_t verlenlen;
mbed_official 0:51ac1d130fd4 177 /* encoding sequence length length */
mbed_official 0:51ac1d130fd4 178 u8_t seqlenlen;
mbed_official 0:51ac1d130fd4 179
mbed_official 0:51ac1d130fd4 180 /* encoding timestamp length */
mbed_official 0:51ac1d130fd4 181 u16_t tslen;
mbed_official 0:51ac1d130fd4 182 /* encoding specific-trap length */
mbed_official 0:51ac1d130fd4 183 u16_t strplen;
mbed_official 0:51ac1d130fd4 184 /* encoding generic-trap length */
mbed_official 0:51ac1d130fd4 185 u16_t gtrplen;
mbed_official 0:51ac1d130fd4 186 /* encoding agent-addr length */
mbed_official 0:51ac1d130fd4 187 u16_t aaddrlen;
mbed_official 0:51ac1d130fd4 188 /* encoding enterprise-id length */
mbed_official 0:51ac1d130fd4 189 u16_t eidlen;
mbed_official 0:51ac1d130fd4 190 /* encoding pdu length */
mbed_official 0:51ac1d130fd4 191 u16_t pdulen;
mbed_official 0:51ac1d130fd4 192 /* encoding community length */
mbed_official 0:51ac1d130fd4 193 u16_t comlen;
mbed_official 0:51ac1d130fd4 194 /* encoding version length */
mbed_official 0:51ac1d130fd4 195 u16_t verlen;
mbed_official 0:51ac1d130fd4 196 /* encoding sequence length */
mbed_official 0:51ac1d130fd4 197 u16_t seqlen;
mbed_official 0:51ac1d130fd4 198 };
mbed_official 0:51ac1d130fd4 199
mbed_official 0:51ac1d130fd4 200 /* Accepting new SNMP messages. */
mbed_official 0:51ac1d130fd4 201 #define SNMP_MSG_EMPTY 0
mbed_official 0:51ac1d130fd4 202 /* Search for matching object for variable binding. */
mbed_official 0:51ac1d130fd4 203 #define SNMP_MSG_SEARCH_OBJ 1
mbed_official 0:51ac1d130fd4 204 /* Perform SNMP operation on in-memory object.
mbed_official 0:51ac1d130fd4 205 Pass-through states, for symmetry only. */
mbed_official 0:51ac1d130fd4 206 #define SNMP_MSG_INTERNAL_GET_OBJDEF 2
mbed_official 0:51ac1d130fd4 207 #define SNMP_MSG_INTERNAL_GET_VALUE 3
mbed_official 0:51ac1d130fd4 208 #define SNMP_MSG_INTERNAL_SET_TEST 4
mbed_official 0:51ac1d130fd4 209 #define SNMP_MSG_INTERNAL_GET_OBJDEF_S 5
mbed_official 0:51ac1d130fd4 210 #define SNMP_MSG_INTERNAL_SET_VALUE 6
mbed_official 0:51ac1d130fd4 211 /* Perform SNMP operation on object located externally.
mbed_official 0:51ac1d130fd4 212 In theory this could be used for building a proxy agent.
mbed_official 0:51ac1d130fd4 213 Practical use is for an enterprise spc. app. gateway. */
mbed_official 0:51ac1d130fd4 214 #define SNMP_MSG_EXTERNAL_GET_OBJDEF 7
mbed_official 0:51ac1d130fd4 215 #define SNMP_MSG_EXTERNAL_GET_VALUE 8
mbed_official 0:51ac1d130fd4 216 #define SNMP_MSG_EXTERNAL_SET_TEST 9
mbed_official 0:51ac1d130fd4 217 #define SNMP_MSG_EXTERNAL_GET_OBJDEF_S 10
mbed_official 0:51ac1d130fd4 218 #define SNMP_MSG_EXTERNAL_SET_VALUE 11
mbed_official 0:51ac1d130fd4 219
mbed_official 0:51ac1d130fd4 220 #define SNMP_COMMUNITY_STR_LEN 64
mbed_official 0:51ac1d130fd4 221 struct snmp_msg_pstat
mbed_official 0:51ac1d130fd4 222 {
mbed_official 0:51ac1d130fd4 223 /* lwIP local port (161) binding */
mbed_official 0:51ac1d130fd4 224 struct udp_pcb *pcb;
mbed_official 0:51ac1d130fd4 225 /* source IP address */
mbed_official 0:51ac1d130fd4 226 ip_addr_t sip;
mbed_official 0:51ac1d130fd4 227 /* source UDP port */
mbed_official 0:51ac1d130fd4 228 u16_t sp;
mbed_official 0:51ac1d130fd4 229 /* request type */
mbed_official 0:51ac1d130fd4 230 u8_t rt;
mbed_official 0:51ac1d130fd4 231 /* request ID */
mbed_official 0:51ac1d130fd4 232 s32_t rid;
mbed_official 0:51ac1d130fd4 233 /* error status */
mbed_official 0:51ac1d130fd4 234 s32_t error_status;
mbed_official 0:51ac1d130fd4 235 /* error index */
mbed_official 0:51ac1d130fd4 236 s32_t error_index;
mbed_official 0:51ac1d130fd4 237 /* community name (zero terminated) */
mbed_official 0:51ac1d130fd4 238 u8_t community[SNMP_COMMUNITY_STR_LEN + 1];
mbed_official 0:51ac1d130fd4 239 /* community string length (exclusive zero term) */
mbed_official 0:51ac1d130fd4 240 u8_t com_strlen;
mbed_official 0:51ac1d130fd4 241 /* one out of MSG_EMPTY, MSG_DEMUX, MSG_INTERNAL, MSG_EXTERNAL_x */
mbed_official 0:51ac1d130fd4 242 u8_t state;
mbed_official 0:51ac1d130fd4 243 /* saved arguments for MSG_EXTERNAL_x */
mbed_official 0:51ac1d130fd4 244 struct mib_external_node *ext_mib_node;
mbed_official 0:51ac1d130fd4 245 struct snmp_name_ptr ext_name_ptr;
mbed_official 0:51ac1d130fd4 246 struct obj_def ext_object_def;
mbed_official 0:51ac1d130fd4 247 struct snmp_obj_id ext_oid;
mbed_official 0:51ac1d130fd4 248 /* index into input variable binding list */
mbed_official 0:51ac1d130fd4 249 u8_t vb_idx;
mbed_official 0:51ac1d130fd4 250 /* ptr into input variable binding list */
mbed_official 0:51ac1d130fd4 251 struct snmp_varbind *vb_ptr;
mbed_official 0:51ac1d130fd4 252 /* list of variable bindings from input */
mbed_official 0:51ac1d130fd4 253 struct snmp_varbind_root invb;
mbed_official 0:51ac1d130fd4 254 /* list of variable bindings to output */
mbed_official 0:51ac1d130fd4 255 struct snmp_varbind_root outvb;
mbed_official 0:51ac1d130fd4 256 /* output response lengths used in ASN encoding */
mbed_official 0:51ac1d130fd4 257 struct snmp_resp_header_lengths rhl;
mbed_official 0:51ac1d130fd4 258 };
mbed_official 0:51ac1d130fd4 259
mbed_official 0:51ac1d130fd4 260 struct snmp_msg_trap
mbed_official 0:51ac1d130fd4 261 {
mbed_official 0:51ac1d130fd4 262 /* lwIP local port (161) binding */
mbed_official 0:51ac1d130fd4 263 struct udp_pcb *pcb;
mbed_official 0:51ac1d130fd4 264 /* destination IP address in network order */
mbed_official 0:51ac1d130fd4 265 ip_addr_t dip;
mbed_official 0:51ac1d130fd4 266
mbed_official 0:51ac1d130fd4 267 /* source enterprise ID (sysObjectID) */
mbed_official 0:51ac1d130fd4 268 struct snmp_obj_id *enterprise;
mbed_official 0:51ac1d130fd4 269 /* source IP address, raw network order format */
mbed_official 0:51ac1d130fd4 270 u8_t sip_raw[4];
mbed_official 0:51ac1d130fd4 271 /* generic trap code */
mbed_official 0:51ac1d130fd4 272 u32_t gen_trap;
mbed_official 0:51ac1d130fd4 273 /* specific trap code */
mbed_official 0:51ac1d130fd4 274 u32_t spc_trap;
mbed_official 0:51ac1d130fd4 275 /* timestamp */
mbed_official 0:51ac1d130fd4 276 u32_t ts;
mbed_official 0:51ac1d130fd4 277 /* list of variable bindings to output */
mbed_official 0:51ac1d130fd4 278 struct snmp_varbind_root outvb;
mbed_official 0:51ac1d130fd4 279 /* output trap lengths used in ASN encoding */
mbed_official 0:51ac1d130fd4 280 struct snmp_trap_header_lengths thl;
mbed_official 0:51ac1d130fd4 281 };
mbed_official 0:51ac1d130fd4 282
mbed_official 0:51ac1d130fd4 283 /** Agent Version constant, 0 = v1 oddity */
mbed_official 0:51ac1d130fd4 284 extern const s32_t snmp_version;
mbed_official 0:51ac1d130fd4 285 /** Agent default "public" community string */
mbed_official 0:51ac1d130fd4 286 extern const char snmp_publiccommunity[7];
mbed_official 0:51ac1d130fd4 287
mbed_official 0:51ac1d130fd4 288 extern struct snmp_msg_trap trap_msg;
mbed_official 0:51ac1d130fd4 289
mbed_official 0:51ac1d130fd4 290 /** Agent setup, start listening to port 161. */
mbed_official 0:51ac1d130fd4 291 void snmp_init(void);
mbed_official 0:51ac1d130fd4 292 void snmp_trap_dst_enable(u8_t dst_idx, u8_t enable);
mbed_official 0:51ac1d130fd4 293 void snmp_trap_dst_ip_set(u8_t dst_idx, ip_addr_t *dst);
mbed_official 0:51ac1d130fd4 294
mbed_official 0:51ac1d130fd4 295 /** Varbind-list functions. */
mbed_official 0:51ac1d130fd4 296 struct snmp_varbind* snmp_varbind_alloc(struct snmp_obj_id *oid, u8_t type, u8_t len);
mbed_official 0:51ac1d130fd4 297 void snmp_varbind_free(struct snmp_varbind *vb);
mbed_official 0:51ac1d130fd4 298 void snmp_varbind_list_free(struct snmp_varbind_root *root);
mbed_official 0:51ac1d130fd4 299 void snmp_varbind_tail_add(struct snmp_varbind_root *root, struct snmp_varbind *vb);
mbed_official 0:51ac1d130fd4 300 struct snmp_varbind* snmp_varbind_tail_remove(struct snmp_varbind_root *root);
mbed_official 0:51ac1d130fd4 301
mbed_official 0:51ac1d130fd4 302 /** Handle an internal (recv) or external (private response) event. */
mbed_official 0:51ac1d130fd4 303 void snmp_msg_event(u8_t request_id);
mbed_official 0:51ac1d130fd4 304 err_t snmp_send_response(struct snmp_msg_pstat *m_stat);
mbed_official 0:51ac1d130fd4 305 err_t snmp_send_trap(s8_t generic_trap, struct snmp_obj_id *eoid, s32_t specific_trap);
mbed_official 0:51ac1d130fd4 306 void snmp_coldstart_trap(void);
mbed_official 0:51ac1d130fd4 307 void snmp_authfail_trap(void);
mbed_official 0:51ac1d130fd4 308
mbed_official 0:51ac1d130fd4 309 #ifdef __cplusplus
mbed_official 0:51ac1d130fd4 310 }
mbed_official 0:51ac1d130fd4 311 #endif
mbed_official 0:51ac1d130fd4 312
mbed_official 0:51ac1d130fd4 313 #endif /* LWIP_SNMP */
mbed_official 0:51ac1d130fd4 314
mbed_official 0:51ac1d130fd4 315 #endif /* __LWIP_SNMP_MSG_H__ */