ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

snmp_structs.h
Go to the documentation of this file.
00001 
00008 /*
00009  * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands.
00010  * All rights reserved.
00011  *
00012  * Redistribution and use in source and binary forms, with or without modification,
00013  * are permitted provided that the following conditions are met:
00014  *
00015  * 1. Redistributions of source code must retain the above copyright notice,
00016  *    this list of conditions and the following disclaimer.
00017  * 2. Redistributions in binary form must reproduce the above copyright notice,
00018  *    this list of conditions and the following disclaimer in the documentation
00019  *    and/or other materials provided with the distribution.
00020  * 3. The name of the author may not be used to endorse or promote products
00021  *    derived from this software without specific prior written permission.
00022  *
00023  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00024  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00025  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
00026  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00027  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00028  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00029  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00030  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
00031  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00032  * OF SUCH DAMAGE.
00033  *
00034  * Author: Christiaan Simons <christiaan.simons@axon.tv>
00035  */
00036 
00037 #ifndef __LWIP_SNMP_STRUCTS_H__
00038 #define __LWIP_SNMP_STRUCTS_H__
00039 
00040 #include "lwip/opt.h"
00041 
00042 #if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */
00043 
00044 #include "lwip/snmp.h"
00045 
00046 #if SNMP_PRIVATE_MIB
00047 /* When using a private MIB, you have to create a file 'private_mib.h' that contains
00048  * a 'struct mib_array_node mib_private' which contains your MIB. */
00049 #include "private_mib.h"
00050 #endif
00051 
00052 #ifdef __cplusplus
00053 extern "C" {
00054 #endif
00055 
00056 /* MIB object instance */
00057 #define MIB_OBJECT_NONE 0 
00058 #define MIB_OBJECT_SCALAR 1
00059 #define MIB_OBJECT_TAB 2
00060 
00061 /* MIB access types */
00062 #define MIB_ACCESS_READ   1
00063 #define MIB_ACCESS_WRITE  2
00064 
00065 /* MIB object access */
00066 #define MIB_OBJECT_READ_ONLY      MIB_ACCESS_READ
00067 #define MIB_OBJECT_READ_WRITE     (MIB_ACCESS_READ | MIB_ACCESS_WRITE)
00068 #define MIB_OBJECT_WRITE_ONLY     MIB_ACCESS_WRITE
00069 #define MIB_OBJECT_NOT_ACCESSIBLE 0
00070 
00072 struct obj_def
00073 {
00074   /* MIB_OBJECT_NONE (0), MIB_OBJECT_SCALAR (1), MIB_OBJECT_TAB (2) */
00075   u8_t instance;
00076   /* 0 read-only, 1 read-write, 2 write-only, 3 not-accessible */
00077   u8_t access;
00078   /* ASN type for this object */
00079   u8_t asn_type;
00080   /* value length (host length) */
00081   u16_t v_len;
00082   /* length of instance part of supplied object identifier */
00083   u8_t  id_inst_len;
00084   /* instance part of supplied object identifier */
00085   s32_t *id_inst_ptr;
00086 };
00087 
00088 struct snmp_name_ptr
00089 {
00090   u8_t ident_len;
00091   s32_t *ident;
00092 };
00093 
00095 #define MIB_NODE_SC 0x01
00096 
00097 #define MIB_NODE_AR 0x02
00098 
00099 #define MIB_NODE_RA 0x03
00100 
00101 #define MIB_NODE_LR 0x04
00102 
00103 #define MIB_NODE_EX 0x05
00104 
00106 struct mib_node
00107 {
00109   void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
00112   void (*get_value)(struct obj_def *od, u16_t len, void *value);
00114   u8_t (*set_test)(struct obj_def *od, u16_t len, void *value);
00116   void (*set_value)(struct obj_def *od, u16_t len, void *value);  
00118   u8_t node_type;
00119   /* array or max list length */
00120   u16_t maxlength;
00121 };
00122 
00124 typedef struct mib_node mib_scalar_node;
00125 
00128 struct mib_array_node
00129 {
00130   /* inherited "base class" members */
00131   void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
00132   void (*get_value)(struct obj_def *od, u16_t len, void *value);
00133   u8_t (*set_test)(struct obj_def *od, u16_t len, void *value);
00134   void (*set_value)(struct obj_def *od, u16_t len, void *value);
00135 
00136   u8_t node_type;
00137   u16_t maxlength;
00138 
00139   /* additional struct members */
00140   const s32_t *objid;
00141   struct mib_node* const *nptr;
00142 };
00143 
00146 struct mib_ram_array_node
00147 {
00148   /* inherited "base class" members */
00149   void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
00150   void (*get_value)(struct obj_def *od, u16_t len, void *value);
00151   u8_t (*set_test)(struct obj_def *od, u16_t len, void *value);
00152   void (*set_value)(struct obj_def *od, u16_t len, void *value);
00153 
00154   u8_t node_type;
00155   u16_t maxlength;
00156 
00157   /* aditional struct members */
00158   s32_t *objid;
00159   struct mib_node **nptr;
00160 };
00161 
00162 struct mib_list_node
00163 {
00164   struct mib_list_node *prev;  
00165   struct mib_list_node *next;
00166   s32_t objid;
00167   struct mib_node *nptr;
00168 };
00169 
00172 struct mib_list_rootnode
00173 {
00174   /* inherited "base class" members */
00175   void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
00176   void (*get_value)(struct obj_def *od, u16_t len, void *value);
00177   u8_t (*set_test)(struct obj_def *od, u16_t len, void *value);
00178   void (*set_value)(struct obj_def *od, u16_t len, void *value);
00179 
00180   u8_t node_type;
00181   u16_t maxlength;
00182 
00183   /* additional struct members */
00184   struct mib_list_node *head;
00185   struct mib_list_node *tail;
00186   /* counts list nodes in list  */
00187   u16_t count;
00188 };
00189 
00192 struct mib_external_node
00193 {
00194   /* inherited "base class" members */
00195   void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
00196   void (*get_value)(struct obj_def *od, u16_t len, void *value);
00197   u8_t (*set_test)(struct obj_def *od, u16_t len, void *value);
00198   void (*set_value)(struct obj_def *od, u16_t len, void *value);
00199 
00200   u8_t node_type;
00201   u16_t maxlength;
00202 
00203   /* additional struct members */
00206   void* addr_inf;
00208   u8_t tree_levels;
00210   u16_t (*level_length)(void* addr_inf, u8_t level);
00213   s32_t (*ident_cmp)(void* addr_inf, u8_t level, u16_t idx, s32_t sub_id);
00214   void (*get_objid)(void* addr_inf, u8_t level, u16_t idx, s32_t *sub_id);
00215 
00217   void (*get_object_def_q)(void* addr_inf, u8_t rid, u8_t ident_len, s32_t *ident);
00218   void (*get_value_q)(u8_t rid, struct obj_def *od);
00219   void (*set_test_q)(u8_t rid, struct obj_def *od);
00220   void (*set_value_q)(u8_t rid, struct obj_def *od, u16_t len, void *value);
00222   void (*get_object_def_a)(u8_t rid, u8_t ident_len, s32_t *ident, struct obj_def *od);
00223   void (*get_value_a)(u8_t rid, struct obj_def *od, u16_t len, void *value);
00224   u8_t (*set_test_a)(u8_t rid, struct obj_def *od, u16_t len, void *value);
00225   void (*set_value_a)(u8_t rid, struct obj_def *od, u16_t len, void *value);
00228   void (*get_object_def_pc)(u8_t rid, u8_t ident_len, s32_t *ident);
00229   void (*get_value_pc)(u8_t rid, struct obj_def *od);
00230   void (*set_test_pc)(u8_t rid, struct obj_def *od);
00231   void (*set_value_pc)(u8_t rid, struct obj_def *od);
00232 };
00233 
00235 extern const struct mib_array_node internet;
00236 
00238 void noleafs_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
00239 void noleafs_get_value(struct obj_def *od, u16_t len, void *value);
00240 u8_t noleafs_set_test(struct obj_def *od, u16_t len, void *value);
00241 void noleafs_set_value(struct obj_def *od, u16_t len, void *value);
00242 
00243 void snmp_oidtoip(s32_t *ident, ip_addr_t *ip);
00244 void snmp_iptooid(ip_addr_t *ip, s32_t *ident);
00245 void snmp_ifindextonetif(s32_t ifindex, struct netif **netif);
00246 void snmp_netiftoifindex(struct netif *netif, s32_t *ifidx);
00247 
00248 struct mib_list_node* snmp_mib_ln_alloc(s32_t id);
00249 void snmp_mib_ln_free(struct mib_list_node *ln);
00250 struct mib_list_rootnode* snmp_mib_lrn_alloc(void);
00251 void snmp_mib_lrn_free(struct mib_list_rootnode *lrn);
00252 
00253 s8_t snmp_mib_node_insert(struct mib_list_rootnode *rn, s32_t objid, struct mib_list_node **insn);
00254 s8_t snmp_mib_node_find(struct mib_list_rootnode *rn, s32_t objid, struct mib_list_node **fn);
00255 struct mib_list_rootnode *snmp_mib_node_delete(struct mib_list_rootnode *rn, struct mib_list_node *n);
00256 
00257 struct mib_node* snmp_search_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_name_ptr *np);
00258 struct mib_node* snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret);
00259 u8_t snmp_iso_prefix_tst(u8_t ident_len, s32_t *ident);
00260 u8_t snmp_iso_prefix_expand(u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret);
00261 
00262 #ifdef __cplusplus
00263 }
00264 #endif
00265 
00266 #endif /* LWIP_SNMP */
00267 
00268 #endif /* __LWIP_SNMP_STRUCTS_H__ */

Generated on Fri May 25 2012 04:34:36 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.