#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"
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_tree * | build_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 node * | parse_objectid (FILE *fp, char *name) |
static int | parse_asntype (FILE *fp) |
static struct node * | parse_objecttype (register FILE *fp, char *name) |
static struct node * | parse (FILE *fp) |
struct snmp_mib_tree * | read_mib (char *filename) |
Variables | |
int | Line = 1 |
struct tok | tokens [] |
static struct tok * | buckets [HASHSIZE] |
struct node * | nbuckets [NHASHSIZE] |
int | translation_table [40] |
static char | last = ' ' |
Macro Definition Documentation
◆ ACCESS
◆ BUCKET
◆ COMMA
◆ CONTINUE
◆ COUNTER
◆ DESCRIPTION
◆ ENDOFFILE
◆ EQUALS
◆ GAUGE
◆ HASHSIZE
◆ INDEX
◆ INTEGER
◆ IPADDR
◆ LABEL
◆ LEFTBRACKET
◆ LEFTPAREN
◆ MANDATORY
◆ NBUCKET
◆ NETADDR
◆ NHASHSIZE
◆ NOACCESS
◆ NUL
◆ NUMBER
◆ OBJID
◆ OBJTYPE
◆ OBSOLETE
◆ OCTETSTR
◆ OF
◆ PUNCT
◆ QUOTE
◆ READONLY
◆ READWRITE
◆ RECOMMENDED
◆ RIGHTBRACKET
◆ RIGHTPAREN
◆ SEQUENCE
◆ SNMP_OPAQUE
◆ SNMP_OPTIONAL
◆ SNMP_STATUS
◆ SUBTREE
◆ SYNTAX
◆ TIMETICKS
◆ WRITEONLY
Function Documentation
◆ build_translation_table()
|
static |
Definition at line 279 of file parse.c.
References COUNTER, GAUGE, INTEGER, IPADDR, NETADDR, NUL, OBJID, OCTETSTR, SNMP_OPAQUE, TIMETICKS, translation_table, TYPE_COUNTER, TYPE_GAUGE, TYPE_INTEGER, TYPE_IPADDR, TYPE_NULL, TYPE_OBJID, TYPE_OCTETSTR, TYPE_OPAQUE, TYPE_OTHER, and TYPE_TIMETICKS.
Referenced by build_tree().
◆ build_tree()
|
static |
Definition at line 408 of file parse.c.
References build_translation_table(), snmp_mib_tree::child_list, do_subtree(), snmp_mib_tree::enums, init_node_hash(), snmp_mib_tree::label, node::label, nbuckets, node::next, snmp_mib_tree::next_peer, NHASHSIZE, NULL, snmp_mib_tree::parent, node::parent, snmplib_debug(), snmp_mib_tree::subid, node::subid, snmp_mib_tree::type, node::type, and xmalloc.
Referenced by read_mib().
◆ do_subtree()
|
static |
Definition at line 327 of file parse.c.
References snmp_mib_tree::child_list, do_subtree(), snmp_mib_tree::enums, node::enums, hash, snmp_mib_tree::label, node::label, NBUCKET, nbuckets, node::next, snmp_mib_tree::next_peer, NULL, snmp_mib_tree::parent, node::parent, snmp_mib_tree::subid, node::subid, translation_table, snmp_mib_tree::type, node::type, xfree, and xmalloc.
Referenced by build_tree(), and do_subtree().
◆ free_node()
|
static |
Definition at line 590 of file parse.c.
References node::enums, enum_list::next, and xfree.
Referenced by free_node_list(), parse_objectid(), and parse_objecttype().
◆ free_node_list()
|
static |
Definition at line 604 of file parse.c.
References free_node(), and node::next.
Referenced by parse(), and parse_objectid().
◆ get_token()
|
static |
Definition at line 454 of file parse.c.
References BUCKET, buckets, CONTINUE, ENDOFFILE, get_token(), tok::hash, hash, LABEL, last, Line, tok::name, tok::next, NUMBER, tok::token, xisdigit, and xisspace.
Referenced by get_token(), getoid(), parse(), parse_asntype(), parse_objectid(), and parse_objecttype().
◆ getoid()
Definition at line 537 of file parse.c.
References subid::subid, get_token(), subid::label, LABEL, LEFTBRACKET, LEFTPAREN, NUMBER, print_error(), RIGHTBRACKET, RIGHTPAREN, tok::token, and xmalloc.
Referenced by parse_objectid(), and parse_objecttype().
◆ hash_init()
|
static |
◆ init_node_hash()
|
static |
Definition at line 246 of file parse.c.
References hash, NBUCKET, nbuckets, node::next, and node::parent.
Referenced by build_tree().
◆ parse()
|
static |
Definition at line 965 of file parse.c.
References ENDOFFILE, EQUALS, free_node_list(), get_token(), hash_init(), LABEL, node::next, NULL, OBJID, OBJTYPE, parse_asntype(), parse_objectid(), parse_objecttype(), print_error(), and node::type.
Referenced by read_mib().
◆ parse_asntype()
|
static |
Definition at line 708 of file parse.c.
References ENDOFFILE, get_token(), print_error(), RIGHTBRACKET, SEQUENCE, and node::type.
Referenced by parse().
◆ parse_objectid()
|
static |
Definition at line 620 of file parse.c.
References subid::subid, EQUALS, free_node(), free_node_list(), get_token(), getoid(), subid::label, node::next, NULL, print_error(), node::type, xfree, and xmalloc.
Referenced by parse().
◆ parse_objecttype()
|
static |
Definition at line 731 of file parse.c.
References subid::subid, ACCESS, COUNTER, DESCRIPTION, ENDOFFILE, node::enums, EQUALS, free_node(), GAUGE, get_token(), getoid(), INDEX, INTEGER, IPADDR, enum_list::label, subid::label, node::label, LABEL, last, LEFTBRACKET, LEFTPAREN, Line, MANDATORY, NETADDR, enum_list::next, node::next, NOACCESS, NUL, NULL, NUMBER, OBJID, OBSOLETE, OCTETSTR, OF, node::parent, print_error(), QUOTE, READONLY, READWRITE, RECOMMENDED, RIGHTBRACKET, RIGHTPAREN, SEQUENCE, SNMP_OPAQUE, SNMP_OPTIONAL, SNMP_STATUS, node::subid, SYNTAX, TIMETICKS, node::type, enum_list::value, WRITEONLY, xfree, and xmalloc.
Referenced by parse().
◆ print_error()
|
static |
Definition at line 265 of file parse.c.
References assert, ENDOFFILE, Line, NULL, snmplib_debug(), and node::type.
Referenced by getoid(), parse(), parse_asntype(), parse_objectid(), and parse_objecttype().
◆ read_mib()
struct snmp_mib_tree * read_mib | ( | char * | filename | ) |
Definition at line 1038 of file parse.c.
References build_tree(), NULL, parse(), snmplib_debug(), and xstrerr().
Referenced by init_mib().
Variable Documentation
◆ buckets
Definition at line 219 of file parse.c.
Referenced by get_token(), hash_init(), Store::Disks::init(), wccp2AssignBuckets(), and wccpAssignBuckets().
◆ last
|
static |
Definition at line 451 of file parse.c.
Referenced by fdAdjustReserved(), Debug::Finish(), get_token(), heap_print_inorder(), parse_objecttype(), CbDataList< C >::push_back_unique(), and CbDataList< C >::tail().
◆ Line
int Line = 1 |
Definition at line 113 of file parse.c.
Referenced by get_token(), parse_objecttype(), and print_error().
◆ nbuckets
Definition at line 243 of file parse.c.
Referenced by build_tree(), do_subtree(), init_node_hash(), and storeKeyHashBuckets().
◆ tokens
struct tok tokens[] |
Definition at line 168 of file parse.c.
Referenced by Format::Token::~Token(), ftpListParseParts(), hash_init(), and Format::FmtConfig::registerTokens().
◆ translation_table
int translation_table[40] |
Definition at line 276 of file parse.c.
Referenced by build_translation_table(), and do_subtree().