parse.c File Reference
#include "squid.h"
#include "asn1.h"
#include "cache_snmp.h"
#include "parse.h"
#include "snmp_debug.h"
#include "snmp_pdu.h"
#include "snmp_vars.h"
#include "util.h"
Include dependency graph for parse.c:

Go to the source code of this file.

Classes

struct  subid
 
struct  node
 
struct  tok
 

Macros

#define CONTINUE   -1
 
#define ENDOFFILE   0
 
#define LABEL   1
 
#define SUBTREE   2
 
#define SYNTAX   3
 
#define OBJID   4
 
#define OCTETSTR   5
 
#define INTEGER   6
 
#define NETADDR   7
 
#define IPADDR   8
 
#define COUNTER   9
 
#define GAUGE   10
 
#define TIMETICKS   11
 
#define SNMP_OPAQUE   12
 
#define NUL   13
 
#define SEQUENCE   14
 
#define OF   15 /* SEQUENCE OF */
 
#define OBJTYPE   16
 
#define ACCESS   17
 
#define READONLY   18
 
#define READWRITE   19
 
#define WRITEONLY   20
 
#define NOACCESS   21
 
#define SNMP_STATUS   22
 
#define MANDATORY   23
 
#define SNMP_OPTIONAL   24
 
#define OBSOLETE   25
 
#define RECOMMENDED   26
 
#define PUNCT   27
 
#define EQUALS   28
 
#define NUMBER   29
 
#define LEFTBRACKET   30
 
#define RIGHTBRACKET   31
 
#define LEFTPAREN   32
 
#define RIGHTPAREN   33
 
#define COMMA   34
 
#define DESCRIPTION   35
 
#define INDEX   36
 
#define QUOTE   37
 
#define HASHSIZE   32
 
#define BUCKET(x)   (x & 0x01F)
 
#define NHASHSIZE   128
 
#define NBUCKET(x)   (x & 0x7F)
 

Functions

static void hash_init (void)
 
static void init_node_hash (struct node *nodes)
 
static void print_error (const char *string, const char *token, int type)
 
static void build_translation_table (void)
 
static void do_subtree (struct snmp_mib_tree *root, struct node **nodes)
 
static struct snmp_mib_treebuild_tree (struct node *nodes)
 
static int get_token (register FILE *fp, register char *token)
 
static int getoid (register FILE *fp, register struct subid *SubOid, int length)
 
static void free_node (struct node *np)
 
static void free_node_list (struct node *nl)
 
static struct nodeparse_objectid (FILE *fp, char *name)
 
static int parse_asntype (FILE *fp)
 
static struct nodeparse_objecttype (register FILE *fp, char *name)
 
static struct nodeparse (FILE *fp)
 
struct snmp_mib_treeread_mib (char *filename)
 

Variables

int Line = 1
 
struct tok tokens []
 
static struct tokbuckets [HASHSIZE]
 
struct nodenbuckets [NHASHSIZE]
 
int translation_table [40]
 
static char last = ' '
 

Macro Definition Documentation

#define ACCESS   17

Definition at line 136 of file parse.c.

Referenced by parse_objecttype().

#define BUCKET (   x)    (x & 0x01F)

Definition at line 217 of file parse.c.

Referenced by get_token(), and hash_init().

#define COMMA   34

Definition at line 154 of file parse.c.

#define CONTINUE   -1

Definition at line 116 of file parse.c.

Referenced by get_token().

#define COUNTER   9

Definition at line 128 of file parse.c.

Referenced by build_translation_table(), and parse_objecttype().

#define DESCRIPTION   35

Definition at line 156 of file parse.c.

Referenced by parse_objecttype().

#define ENDOFFILE   0

Definition at line 117 of file parse.c.

Referenced by get_token(), parse(), parse_asntype(), parse_objecttype(), and print_error().

#define EQUALS   28

Definition at line 148 of file parse.c.

Referenced by parse(), parse_objectid(), and parse_objecttype().

#define GAUGE   10

Definition at line 129 of file parse.c.

Referenced by build_translation_table(), and parse_objecttype().

#define HASHSIZE   32

Definition at line 216 of file parse.c.

#define INDEX   36

Definition at line 157 of file parse.c.

Referenced by parse_objecttype().

#define INTEGER   6

Definition at line 125 of file parse.c.

Referenced by build_translation_table(), and parse_objecttype().

#define IPADDR   8

Definition at line 127 of file parse.c.

Referenced by build_translation_table(), and parse_objecttype().

#define LABEL   1

Definition at line 118 of file parse.c.

Referenced by get_token(), getoid(), parse(), and parse_objecttype().

#define LEFTBRACKET   30

Definition at line 150 of file parse.c.

Referenced by getoid(), and parse_objecttype().

#define LEFTPAREN   32

Definition at line 152 of file parse.c.

Referenced by getoid(), and parse_objecttype().

#define MANDATORY   23

Definition at line 143 of file parse.c.

Referenced by parse_objecttype().

#define NBUCKET (   x)    (x & 0x7F)

Definition at line 242 of file parse.c.

Referenced by do_subtree(), and init_node_hash().

#define NETADDR   7

Definition at line 126 of file parse.c.

Referenced by build_translation_table(), and parse_objecttype().

#define NHASHSIZE   128

Definition at line 241 of file parse.c.

Referenced by build_tree().

#define NOACCESS   21

Definition at line 141 of file parse.c.

Referenced by parse_objecttype().

#define NUL   13

Definition at line 132 of file parse.c.

Referenced by build_translation_table(), and parse_objecttype().

#define NUMBER   29

Definition at line 149 of file parse.c.

Referenced by get_token(), getoid(), and parse_objecttype().

#define OBJID   4

Definition at line 122 of file parse.c.

Referenced by build_translation_table(), parse(), and parse_objecttype().

#define OBJTYPE   16

Definition at line 135 of file parse.c.

Referenced by parse().

#define OBSOLETE   25

Definition at line 145 of file parse.c.

Referenced by parse_objecttype().

#define OCTETSTR   5

Definition at line 123 of file parse.c.

Referenced by build_translation_table(), and parse_objecttype().

#define OF   15 /* SEQUENCE OF */

Definition at line 134 of file parse.c.

Referenced by parse_objecttype().

#define PUNCT   27

Definition at line 147 of file parse.c.

#define QUOTE   37

Definition at line 158 of file parse.c.

Referenced by parse_objecttype().

#define READONLY   18

Definition at line 137 of file parse.c.

Referenced by parse_objecttype().

#define READWRITE   19

Definition at line 138 of file parse.c.

Referenced by parse_objecttype().

#define RECOMMENDED   26

Definition at line 146 of file parse.c.

Referenced by parse_objecttype().

#define RIGHTBRACKET   31

Definition at line 151 of file parse.c.

Referenced by getoid(), parse_asntype(), and parse_objecttype().

#define RIGHTPAREN   33

Definition at line 153 of file parse.c.

Referenced by getoid(), and parse_objecttype().

#define SEQUENCE   14

Definition at line 133 of file parse.c.

Referenced by parse_asntype(), and parse_objecttype().

#define SNMP_OPAQUE   12

Definition at line 131 of file parse.c.

Referenced by build_translation_table(), and parse_objecttype().

#define SNMP_OPTIONAL   24

Definition at line 144 of file parse.c.

Referenced by parse_objecttype().

#define SNMP_STATUS   22

Definition at line 142 of file parse.c.

Referenced by parse_objecttype().

#define SUBTREE   2

Definition at line 119 of file parse.c.

#define SYNTAX   3

Definition at line 120 of file parse.c.

Referenced by parse_objecttype().

#define TIMETICKS   11

Definition at line 130 of file parse.c.

Referenced by build_translation_table(), and parse_objecttype().

#define WRITEONLY   20

Definition at line 139 of file parse.c.

Referenced by parse_objecttype().

Function Documentation

static void build_translation_table ( void  )
static
static void free_node ( struct node np)
static

Definition at line 618 of file parse.c.

References node::enums, enum_list::next, and xfree.

Referenced by free_node_list(), parse_objectid(), and parse_objecttype().

static void free_node_list ( struct node nl)
static

Definition at line 632 of file parse.c.

References free_node(), and node::next.

Referenced by parse(), and parse_objectid().

static int get_token ( register FILE *  fp,
register char *  token 
)
static
static int getoid ( register FILE *  fp,
register struct subid SubOid,
int  length 
)
static
static void hash_init ( void  )
static

Definition at line 222 of file parse.c.

References BUCKET, tok::hash, tok::name, and tok::next.

Referenced by parse().

static void init_node_hash ( struct node nodes)
static

Definition at line 246 of file parse.c.

References hash, NBUCKET, node::next, and node::parent.

Referenced by build_tree().

static int parse_asntype ( FILE *  fp)
static

Definition at line 736 of file parse.c.

References ENDOFFILE, get_token(), print_error(), RIGHTBRACKET, SEQUENCE, and type.

Referenced by parse().

static struct node* parse_objectid ( FILE *  fp,
char *  name 
)
static
static void print_error ( const char *  string,
const char *  token,
int  type 
)
static

Definition at line 265 of file parse.c.

References assert, ENDOFFILE, Line, NULL, and snmplib_debug().

Referenced by getoid(), parse(), parse_asntype(), parse_objectid(), and parse_objecttype().

struct snmp_mib_tree* read_mib ( char *  filename)

Definition at line 1084 of file parse.c.

References build_tree(), fp, mbuf, NULL, p, parse(), snmplib_debug(), and xstrerr().

Referenced by init_mib().

Variable Documentation

struct tok* buckets[HASHSIZE]
static

Definition at line 219 of file parse.c.

Referenced by Store::Disks::init(), wccp2AssignBuckets(), and wccpAssignBuckets().

int Line = 1

Definition at line 113 of file parse.c.

Referenced by get_token(), parse_objecttype(), and print_error().

struct node* nbuckets[NHASHSIZE]

Definition at line 243 of file parse.c.

struct tok tokens[]
int translation_table[40]

Definition at line 299 of file parse.c.

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors