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