Dependents:   SimpleLCDClock readCard2Twitter_http AnalogClock_StepperMotor_NTP ServoCamV1

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers snmp.h Source File

snmp.h

00001 /*
00002  * Copyright (c) 2001, 2002 Leon Woestenberg <leon.woestenberg@axon.tv>
00003  * Copyright (c) 2001, 2002 Axon Digital Design B.V., The Netherlands.
00004  * All rights reserved.
00005  * 
00006  * Redistribution and use in source and binary forms, with or without modification, 
00007  * are permitted provided that the following conditions are met:
00008  *
00009  * 1. Redistributions of source code must retain the above copyright notice,
00010  *    this list of conditions and the following disclaimer.
00011  * 2. Redistributions in binary form must reproduce the above copyright notice,
00012  *    this list of conditions and the following disclaimer in the documentation
00013  *    and/or other materials provided with the distribution.
00014  * 3. The name of the author may not be used to endorse or promote products
00015  *    derived from this software without specific prior written permission. 
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
00018  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
00019  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
00020  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
00021  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
00022  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
00023  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
00024  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
00025  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
00026  * OF SUCH DAMAGE.
00027  *
00028  * This file is part of the lwIP TCP/IP stack.
00029  * 
00030  * Author: Leon Woestenberg <leon.woestenberg@axon.tv>
00031  *
00032  */
00033 #ifndef __LWIP_SNMP_H__
00034 #define __LWIP_SNMP_H__
00035 
00036 #include "lwip/opt.h"
00037 
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif
00041 
00042 #include "lwip/ip_addr.h"
00043 
00044 struct udp_pcb;
00045 struct netif;
00046 
00047 /**
00048  * @see RFC1213, "MIB-II, 6. Definitions"
00049  */
00050 enum snmp_ifType {
00051   snmp_ifType_other=1,                /* none of the following */
00052   snmp_ifType_regular1822,
00053   snmp_ifType_hdh1822,
00054   snmp_ifType_ddn_x25,
00055   snmp_ifType_rfc877_x25,
00056   snmp_ifType_ethernet_csmacd,
00057   snmp_ifType_iso88023_csmacd,
00058   snmp_ifType_iso88024_tokenBus,
00059   snmp_ifType_iso88025_tokenRing,
00060   snmp_ifType_iso88026_man,
00061   snmp_ifType_starLan,
00062   snmp_ifType_proteon_10Mbit,
00063   snmp_ifType_proteon_80Mbit,
00064   snmp_ifType_hyperchannel,
00065   snmp_ifType_fddi,
00066   snmp_ifType_lapb,
00067   snmp_ifType_sdlc,
00068   snmp_ifType_ds1,                    /* T-1 */
00069   snmp_ifType_e1,                     /* european equiv. of T-1 */
00070   snmp_ifType_basicISDN,
00071   snmp_ifType_primaryISDN,            /* proprietary serial */
00072   snmp_ifType_propPointToPointSerial,
00073   snmp_ifType_ppp,
00074   snmp_ifType_softwareLoopback,
00075   snmp_ifType_eon,                    /* CLNP over IP [11] */
00076   snmp_ifType_ethernet_3Mbit,
00077   snmp_ifType_nsip,                   /* XNS over IP */
00078   snmp_ifType_slip,                   /* generic SLIP */
00079   snmp_ifType_ultra,                  /* ULTRA technologies */
00080   snmp_ifType_ds3,                    /* T-3 */
00081   snmp_ifType_sip,                    /* SMDS */
00082   snmp_ifType_frame_relay
00083 };
00084 
00085 #if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */
00086 
00087 /** SNMP "sysuptime" Interval */
00088 #define SNMP_SYSUPTIME_INTERVAL 10
00089 
00090 /** fixed maximum length for object identifier type */
00091 #define LWIP_SNMP_OBJ_ID_LEN 32
00092 
00093 /** internal object identifier representation */
00094 struct snmp_obj_id
00095 {
00096   u8_t len;
00097   s32_t id[LWIP_SNMP_OBJ_ID_LEN];
00098 };
00099 
00100 /* system */
00101 void snmp_set_sysdesr(u8_t* str, u8_t* len);
00102 void snmp_set_sysobjid(struct snmp_obj_id *oid);
00103 void snmp_get_sysobjid_ptr(struct snmp_obj_id **oid);
00104 void snmp_inc_sysuptime(void);
00105 void snmp_add_sysuptime(u32_t value);
00106 void snmp_get_sysuptime(u32_t *value);
00107 void snmp_set_syscontact(u8_t *ocstr, u8_t *ocstrlen);
00108 void snmp_set_sysname(u8_t *ocstr, u8_t *ocstrlen);
00109 void snmp_set_syslocation(u8_t *ocstr, u8_t *ocstrlen);
00110 
00111 /* network interface */
00112 void snmp_add_ifinoctets(struct netif *ni, u32_t value); 
00113 void snmp_inc_ifinucastpkts(struct netif *ni);
00114 void snmp_inc_ifinnucastpkts(struct netif *ni);
00115 void snmp_inc_ifindiscards(struct netif *ni);
00116 void snmp_add_ifoutoctets(struct netif *ni, u32_t value);
00117 void snmp_inc_ifoutucastpkts(struct netif *ni);
00118 void snmp_inc_ifoutnucastpkts(struct netif *ni);
00119 void snmp_inc_ifoutdiscards(struct netif *ni);
00120 void snmp_inc_iflist(void);
00121 void snmp_dec_iflist(void);
00122 
00123 /* ARP (for atTable and ipNetToMediaTable) */
00124 void snmp_insert_arpidx_tree(struct netif *ni, ip_addr_t *ip);
00125 void snmp_delete_arpidx_tree(struct netif *ni, ip_addr_t *ip);
00126 
00127 /* IP */
00128 void snmp_inc_ipinreceives(void);
00129 void snmp_inc_ipinhdrerrors(void);
00130 void snmp_inc_ipinaddrerrors(void);
00131 void snmp_inc_ipforwdatagrams(void);
00132 void snmp_inc_ipinunknownprotos(void);
00133 void snmp_inc_ipindiscards(void);
00134 void snmp_inc_ipindelivers(void);
00135 void snmp_inc_ipoutrequests(void);
00136 void snmp_inc_ipoutdiscards(void);
00137 void snmp_inc_ipoutnoroutes(void);
00138 void snmp_inc_ipreasmreqds(void);
00139 void snmp_inc_ipreasmoks(void);
00140 void snmp_inc_ipreasmfails(void);
00141 void snmp_inc_ipfragoks(void);
00142 void snmp_inc_ipfragfails(void);
00143 void snmp_inc_ipfragcreates(void);
00144 void snmp_inc_iproutingdiscards(void);
00145 void snmp_insert_ipaddridx_tree(struct netif *ni);
00146 void snmp_delete_ipaddridx_tree(struct netif *ni);
00147 void snmp_insert_iprteidx_tree(u8_t dflt, struct netif *ni);
00148 void snmp_delete_iprteidx_tree(u8_t dflt, struct netif *ni);
00149 
00150 /* ICMP */
00151 void snmp_inc_icmpinmsgs(void);
00152 void snmp_inc_icmpinerrors(void);
00153 void snmp_inc_icmpindestunreachs(void);
00154 void snmp_inc_icmpintimeexcds(void);
00155 void snmp_inc_icmpinparmprobs(void);
00156 void snmp_inc_icmpinsrcquenchs(void);
00157 void snmp_inc_icmpinredirects(void);
00158 void snmp_inc_icmpinechos(void);
00159 void snmp_inc_icmpinechoreps(void);
00160 void snmp_inc_icmpintimestamps(void);
00161 void snmp_inc_icmpintimestampreps(void);
00162 void snmp_inc_icmpinaddrmasks(void);
00163 void snmp_inc_icmpinaddrmaskreps(void);
00164 void snmp_inc_icmpoutmsgs(void);
00165 void snmp_inc_icmpouterrors(void);
00166 void snmp_inc_icmpoutdestunreachs(void);
00167 void snmp_inc_icmpouttimeexcds(void);
00168 void snmp_inc_icmpoutparmprobs(void);
00169 void snmp_inc_icmpoutsrcquenchs(void);
00170 void snmp_inc_icmpoutredirects(void); 
00171 void snmp_inc_icmpoutechos(void);
00172 void snmp_inc_icmpoutechoreps(void);
00173 void snmp_inc_icmpouttimestamps(void);
00174 void snmp_inc_icmpouttimestampreps(void);
00175 void snmp_inc_icmpoutaddrmasks(void);
00176 void snmp_inc_icmpoutaddrmaskreps(void);
00177 
00178 /* TCP */
00179 void snmp_inc_tcpactiveopens(void);
00180 void snmp_inc_tcppassiveopens(void);
00181 void snmp_inc_tcpattemptfails(void);
00182 void snmp_inc_tcpestabresets(void);
00183 void snmp_inc_tcpinsegs(void);
00184 void snmp_inc_tcpoutsegs(void);
00185 void snmp_inc_tcpretranssegs(void);
00186 void snmp_inc_tcpinerrs(void);
00187 void snmp_inc_tcpoutrsts(void);
00188 
00189 /* UDP */
00190 void snmp_inc_udpindatagrams(void);
00191 void snmp_inc_udpnoports(void);
00192 void snmp_inc_udpinerrors(void);
00193 void snmp_inc_udpoutdatagrams(void);
00194 void snmp_insert_udpidx_tree(struct udp_pcb *pcb);
00195 void snmp_delete_udpidx_tree(struct udp_pcb *pcb);
00196 
00197 /* SNMP */
00198 void snmp_inc_snmpinpkts(void);
00199 void snmp_inc_snmpoutpkts(void);
00200 void snmp_inc_snmpinbadversions(void);
00201 void snmp_inc_snmpinbadcommunitynames(void);
00202 void snmp_inc_snmpinbadcommunityuses(void);
00203 void snmp_inc_snmpinasnparseerrs(void);
00204 void snmp_inc_snmpintoobigs(void);
00205 void snmp_inc_snmpinnosuchnames(void);
00206 void snmp_inc_snmpinbadvalues(void);
00207 void snmp_inc_snmpinreadonlys(void);
00208 void snmp_inc_snmpingenerrs(void);
00209 void snmp_add_snmpintotalreqvars(u8_t value);
00210 void snmp_add_snmpintotalsetvars(u8_t value);
00211 void snmp_inc_snmpingetrequests(void);
00212 void snmp_inc_snmpingetnexts(void);
00213 void snmp_inc_snmpinsetrequests(void);
00214 void snmp_inc_snmpingetresponses(void);
00215 void snmp_inc_snmpintraps(void);
00216 void snmp_inc_snmpouttoobigs(void);
00217 void snmp_inc_snmpoutnosuchnames(void);
00218 void snmp_inc_snmpoutbadvalues(void);
00219 void snmp_inc_snmpoutgenerrs(void);
00220 void snmp_inc_snmpoutgetrequests(void);
00221 void snmp_inc_snmpoutgetnexts(void);
00222 void snmp_inc_snmpoutsetrequests(void);
00223 void snmp_inc_snmpoutgetresponses(void);
00224 void snmp_inc_snmpouttraps(void);
00225 void snmp_get_snmpgrpid_ptr(struct snmp_obj_id **oid);
00226 void snmp_set_snmpenableauthentraps(u8_t *value);
00227 void snmp_get_snmpenableauthentraps(u8_t *value);
00228 
00229 /* LWIP_SNMP support not available */
00230 /* define everything to be empty */
00231 #else
00232 
00233 /* system */
00234 #define snmp_set_sysdesr(str, len)
00235 #define snmp_set_sysobjid(oid);
00236 #define snmp_get_sysobjid_ptr(oid)
00237 #define snmp_inc_sysuptime()
00238 #define snmp_add_sysuptime(value)
00239 #define snmp_get_sysuptime(value)
00240 #define snmp_set_syscontact(ocstr, ocstrlen);
00241 #define snmp_set_sysname(ocstr, ocstrlen);
00242 #define snmp_set_syslocation(ocstr, ocstrlen);
00243 
00244 /* network interface */
00245 #define snmp_add_ifinoctets(ni,value) 
00246 #define snmp_inc_ifinucastpkts(ni)
00247 #define snmp_inc_ifinnucastpkts(ni)
00248 #define snmp_inc_ifindiscards(ni)
00249 #define snmp_add_ifoutoctets(ni,value)
00250 #define snmp_inc_ifoutucastpkts(ni)
00251 #define snmp_inc_ifoutnucastpkts(ni)
00252 #define snmp_inc_ifoutdiscards(ni)
00253 #define snmp_inc_iflist()
00254 #define snmp_dec_iflist()
00255 
00256 /* ARP */
00257 #define snmp_insert_arpidx_tree(ni,ip)
00258 #define snmp_delete_arpidx_tree(ni,ip)
00259 
00260 /* IP */
00261 #define snmp_inc_ipinreceives()
00262 #define snmp_inc_ipinhdrerrors()
00263 #define snmp_inc_ipinaddrerrors()
00264 #define snmp_inc_ipforwdatagrams()
00265 #define snmp_inc_ipinunknownprotos()
00266 #define snmp_inc_ipindiscards()
00267 #define snmp_inc_ipindelivers()
00268 #define snmp_inc_ipoutrequests()
00269 #define snmp_inc_ipoutdiscards()
00270 #define snmp_inc_ipoutnoroutes()
00271 #define snmp_inc_ipreasmreqds()
00272 #define snmp_inc_ipreasmoks()
00273 #define snmp_inc_ipreasmfails()
00274 #define snmp_inc_ipfragoks()
00275 #define snmp_inc_ipfragfails()
00276 #define snmp_inc_ipfragcreates()
00277 #define snmp_inc_iproutingdiscards()
00278 #define snmp_insert_ipaddridx_tree(ni)
00279 #define snmp_delete_ipaddridx_tree(ni)
00280 #define snmp_insert_iprteidx_tree(dflt, ni)
00281 #define snmp_delete_iprteidx_tree(dflt, ni)
00282 
00283 /* ICMP */
00284 #define snmp_inc_icmpinmsgs()
00285 #define snmp_inc_icmpinerrors() 
00286 #define snmp_inc_icmpindestunreachs() 
00287 #define snmp_inc_icmpintimeexcds()
00288 #define snmp_inc_icmpinparmprobs() 
00289 #define snmp_inc_icmpinsrcquenchs() 
00290 #define snmp_inc_icmpinredirects() 
00291 #define snmp_inc_icmpinechos() 
00292 #define snmp_inc_icmpinechoreps()
00293 #define snmp_inc_icmpintimestamps() 
00294 #define snmp_inc_icmpintimestampreps()
00295 #define snmp_inc_icmpinaddrmasks()
00296 #define snmp_inc_icmpinaddrmaskreps()
00297 #define snmp_inc_icmpoutmsgs()
00298 #define snmp_inc_icmpouterrors()
00299 #define snmp_inc_icmpoutdestunreachs() 
00300 #define snmp_inc_icmpouttimeexcds() 
00301 #define snmp_inc_icmpoutparmprobs()
00302 #define snmp_inc_icmpoutsrcquenchs()
00303 #define snmp_inc_icmpoutredirects() 
00304 #define snmp_inc_icmpoutechos() 
00305 #define snmp_inc_icmpoutechoreps()
00306 #define snmp_inc_icmpouttimestamps()
00307 #define snmp_inc_icmpouttimestampreps()
00308 #define snmp_inc_icmpoutaddrmasks()
00309 #define snmp_inc_icmpoutaddrmaskreps()
00310 /* TCP */
00311 #define snmp_inc_tcpactiveopens()
00312 #define snmp_inc_tcppassiveopens()
00313 #define snmp_inc_tcpattemptfails()
00314 #define snmp_inc_tcpestabresets()
00315 #define snmp_inc_tcpinsegs()
00316 #define snmp_inc_tcpoutsegs()
00317 #define snmp_inc_tcpretranssegs()
00318 #define snmp_inc_tcpinerrs()
00319 #define snmp_inc_tcpoutrsts()
00320 
00321 /* UDP */
00322 #define snmp_inc_udpindatagrams()
00323 #define snmp_inc_udpnoports()
00324 #define snmp_inc_udpinerrors()
00325 #define snmp_inc_udpoutdatagrams()
00326 #define snmp_insert_udpidx_tree(pcb)
00327 #define snmp_delete_udpidx_tree(pcb)
00328 
00329 /* SNMP */
00330 #define snmp_inc_snmpinpkts()
00331 #define snmp_inc_snmpoutpkts()
00332 #define snmp_inc_snmpinbadversions()
00333 #define snmp_inc_snmpinbadcommunitynames()
00334 #define snmp_inc_snmpinbadcommunityuses()
00335 #define snmp_inc_snmpinasnparseerrs()
00336 #define snmp_inc_snmpintoobigs()
00337 #define snmp_inc_snmpinnosuchnames()
00338 #define snmp_inc_snmpinbadvalues()
00339 #define snmp_inc_snmpinreadonlys()
00340 #define snmp_inc_snmpingenerrs()
00341 #define snmp_add_snmpintotalreqvars(value)
00342 #define snmp_add_snmpintotalsetvars(value)
00343 #define snmp_inc_snmpingetrequests()
00344 #define snmp_inc_snmpingetnexts()
00345 #define snmp_inc_snmpinsetrequests()
00346 #define snmp_inc_snmpingetresponses()
00347 #define snmp_inc_snmpintraps()
00348 #define snmp_inc_snmpouttoobigs()
00349 #define snmp_inc_snmpoutnosuchnames()
00350 #define snmp_inc_snmpoutbadvalues()
00351 #define snmp_inc_snmpoutgenerrs()
00352 #define snmp_inc_snmpoutgetrequests()
00353 #define snmp_inc_snmpoutgetnexts()
00354 #define snmp_inc_snmpoutsetrequests()
00355 #define snmp_inc_snmpoutgetresponses()
00356 #define snmp_inc_snmpouttraps()
00357 #define snmp_get_snmpgrpid_ptr(oid)
00358 #define snmp_set_snmpenableauthentraps(value)
00359 #define snmp_get_snmpenableauthentraps(value)
00360 
00361 #endif /* LWIP_SNMP */
00362 
00363 #ifdef __cplusplus
00364 }
00365 #endif
00366 
00367 #endif /* __LWIP_SNMP_H__ */