snmp_core.cc File Reference
#include "squid.h"
#include "acl/FilledChecklist.h"
#include "base/CbcPointer.h"
#include "CachePeer.h"
#include "client_db.h"
#include "comm.h"
#include "comm/Connection.h"
#include "comm/Loops.h"
#include "comm/UdpOpenDialer.h"
#include "fatal.h"
#include "ip/Address.h"
#include "ip/tools.h"
#include "snmp/Forwarder.h"
#include "snmp_agent.h"
#include "snmp_core.h"
#include "SnmpRequest.h"
#include "SquidConfig.h"
#include "tools.h"
Include dependency graph for snmp_core.cc:

Go to the source code of this file.

Functions

static void snmpPortOpened (const Comm::ConnectionPointer &conn, int errNo)
 
static mib_tree_entrysnmpAddNodeStr (const char *base_str, int o, oid_ParseFn *parsefunction, instance_Fn *instancefunction, AggrType aggrType=atNone)
 
static mib_tree_entrysnmpAddNode (oid *name, int len, oid_ParseFn *parsefunction, instance_Fn *instancefunction, AggrType aggrType, int children,...)
 
static oidsnmpCreateOid (int length,...)
 
mib_tree_entrysnmpLookupNodeStr (mib_tree_entry *entry, const char *str)
 
bool snmpCreateOidFromStr (const char *str, oid **name, int *nl)
 
static oidstatic_Inst (oid *name, snint *len, mib_tree_entry *current, oid_ParseFn **Fn)
 
static oidtime_Inst (oid *name, snint *len, mib_tree_entry *current, oid_ParseFn **Fn)
 
static oidpeer_Inst (oid *name, snint *len, mib_tree_entry *current, oid_ParseFn **Fn)
 
static oidclient_Inst (oid *name, snint *len, mib_tree_entry *current, oid_ParseFn **Fn)
 
static void snmpDecodePacket (SnmpRequest *rq)
 
static void snmpConstructReponse (SnmpRequest *rq)
 
static oid_ParseFnsnmpTreeNext (oid *Current, snint CurrentLen, oid **Next, snint *NextLen)
 
static oid_ParseFnsnmpTreeGet (oid *Current, snint CurrentLen)
 
static mib_tree_entrysnmpTreeEntry (oid entry, snint len, mib_tree_entry *current)
 
static mib_tree_entrysnmpTreeSiblingEntry (oid entry, snint len, mib_tree_entry *current)
 
void snmpSnmplibDebug (int lvl, char *buf)
 
void snmpInit (void)
 
void snmpOpenPorts (void)
 
void snmpClosePorts (void)
 
void snmpHandleUdp (int sock, void *)
 
struct snmp_pdusnmpAgentResponse (struct snmp_pdu *PDU)
 
AggrType snmpAggrType (oid *Current, snint CurrentLen)
 
void snmpAddNodeChild (mib_tree_entry *entry, mib_tree_entry *child)
 
const char * snmpDebugOid (oid *Name, snint Len, MemBuf &outbuf)
 
void addr2oid (Ip::Address &addr, oid *Dest)
 
void oid2addr (oid *id, Ip::Address &addr, u_int size)
 

Variables

mib_tree_entrymib_tree_head
 
mib_tree_entrymib_tree_last
 
Comm::ConnectionPointer snmpIncomingConn
 
Comm::ConnectionPointer snmpOutgoingConn
 
SQUIDCEXTERN void(* snmplib_debug_hook )(int, char *)
 

Function Documentation

void addr2oid ( Ip::Address addr,
oid Dest 
)
static oid * client_Inst ( oid name,
snint len,
mib_tree_entry current,
oid_ParseFn **  Fn 
)
static
void oid2addr ( oid id,
Ip::Address addr,
u_int  size 
)

Definition at line 1110 of file snmp_core.cc.

References debugs, i, size, and snmpDebugOid().

Referenced by client_Inst(), and snmp_meshCtblFn().

static mib_tree_entry * snmpAddNode ( oid name,
int  len,
oid_ParseFn parsefunction,
instance_Fn instancefunction,
AggrType  aggrType,
int  children,
  ... 
)
static
void snmpAddNodeChild ( mib_tree_entry entry,
mib_tree_entry child 
)
static mib_tree_entry * snmpAddNodeStr ( const char *  base_str,
int  o,
oid_ParseFn parsefunction,
instance_Fn instancefunction,
AggrType  aggrType = atNone 
)
static

Definition at line 958 of file snmp_core.cc.

References debugs, NULL, snmpAddNode(), snmpAddNodeChild(), snmpCreateOidFromStr(), and snmpLookupNodeStr().

Referenced by snmpInit().

AggrType snmpAggrType ( oid Current,
snint  CurrentLen 
)
void snmpClosePorts ( void  )
static oid * snmpCreateOid ( int  length,
  ... 
)
static

Definition at line 1028 of file snmp_core.cc.

References xmalloc.

Referenced by snmpInit().

bool snmpCreateOidFromStr ( const char *  str,
oid **  name,
int nl 
)

Definition at line 929 of file snmp_core.cc.

References len, NULL, safe_free, and xrealloc().

Referenced by snmpAddNodeStr(), and snmpLookupNodeStr().

void snmpInit ( void  )

Definition at line 68 of file snmp_core.cc.

References assert, atAverage, atMax, atMin, atNone, atSum, client_Inst(), CONF_ADMIN, CONF_LOG_FAC, CONF_ST_MMAXSZ, CONF_ST_SWHIWM, CONF_ST_SWLOWM, CONF_ST_SWMAXSZ, CONF_STORAGE, CONF_UNIQNAME, CONF_VERSION, CONF_VERSION_ID, debugs, DNS_REP, DNS_REQ, DNS_SERVERS, FQDN_ENT, FQDN_GHBN, FQDN_HITS, FQDN_MISS, FQDN_NEGHIT, FQDN_PENDHIT, FQDN_REQ, IP_ENT, IP_GHBN, IP_HITS, IP_LOC, IP_MISS, IP_NEGHIT, IP_PENDHIT, IP_REQ, MESH_CTBL, MESH_CTBL_ADDR, MESH_CTBL_ADDR_TYPE, MESH_CTBL_HTBYTES, MESH_CTBL_HTHITBYTES, MESH_CTBL_HTHITS, MESH_CTBL_HTREQ, MESH_CTBL_ICPBYTES, MESH_CTBL_ICPHITBYTES, MESH_CTBL_ICPHITS, MESH_CTBL_ICPREQ, MESH_PTBL, MESH_PTBL_ADDR, MESH_PTBL_ADDR_TYPE, MESH_PTBL_FETCHES, MESH_PTBL_HTTP, MESH_PTBL_ICP, MESH_PTBL_IGN, MESH_PTBL_INDEX, MESH_PTBL_KEEPAL_R, MESH_PTBL_KEEPAL_S, MESH_PTBL_NAME, MESH_PTBL_PACKED, MESH_PTBL_RTT, MESH_PTBL_SENT, MESH_PTBL_STATE, MESH_PTBL_TYPE, NET_DNS_CACHE, NET_FQDN_CACHE, NET_IP_CACHE, NULL, peer_Inst(), PERF_MEDIAN_BHR, PERF_MEDIAN_DNS, PERF_MEDIAN_HTTP_ALL, PERF_MEDIAN_HTTP_HIT, PERF_MEDIAN_HTTP_MISS, PERF_MEDIAN_HTTP_NH, PERF_MEDIAN_HTTP_NM, PERF_MEDIAN_ICP_QUERY, PERF_MEDIAN_ICP_REPLY, PERF_MEDIAN_RHR, PERF_MEDIAN_TIME, PERF_PROTO, PERF_PROTOSTAT_AGGR, PERF_PROTOSTAT_AGGR_CLIENTS, PERF_PROTOSTAT_AGGR_CURSWAP, PERF_PROTOSTAT_AGGR_ERRORS, PERF_PROTOSTAT_AGGR_HTTP_ERRORS, PERF_PROTOSTAT_AGGR_HTTP_HITS, PERF_PROTOSTAT_AGGR_HTTP_KBYTES_IN, PERF_PROTOSTAT_AGGR_HTTP_KBYTES_OUT, PERF_PROTOSTAT_AGGR_HTTP_REQ, PERF_PROTOSTAT_AGGR_ICP_R, PERF_PROTOSTAT_AGGR_ICP_RKB, PERF_PROTOSTAT_AGGR_ICP_S, PERF_PROTOSTAT_AGGR_ICP_SKB, PERF_PROTOSTAT_AGGR_KBYTES_IN, PERF_PROTOSTAT_AGGR_KBYTES_OUT, PERF_PROTOSTAT_AGGR_REQ, PERF_PROTOSTAT_MEDIAN, PERF_SYS, PERF_SYS_CPUTIME, PERF_SYS_CPUUSAGE, PERF_SYS_CURLRUEXP, PERF_SYS_CURMAX_FD, PERF_SYS_CURRESERVED_FD, PERF_SYS_CURUNLREQ, PERF_SYS_CURUNUSED_FD, PERF_SYS_CURUSED_FD, PERF_SYS_MAXRESSZ, PERF_SYS_MEMUSAGE, PERF_SYS_NUMOBJCNT, PERF_SYS_NUMR, PERF_SYS_PF, snmp_confFn(), snmp_meshCtblFn(), snmp_meshPtblFn(), snmp_netDnsFn(), snmp_netFqdnFn(), snmp_netIpFn(), snmp_prfProtoFn(), snmp_prfSysFn(), snmp_sysFn(), snmpAddNode(), snmpAddNodeStr(), snmpCreateOid(), snmplib_debug_hook, snmpLookupNodeStr(), snmpSnmplibDebug(), static_Inst(), SYS_UPTIME, SYSSTOR, SYSVMSIZ, and time_Inst().

Referenced by mainInitialize().

mib_tree_entry * snmpLookupNodeStr ( mib_tree_entry entry,
const char *  str 
)
static void snmpPortOpened ( const Comm::ConnectionPointer conn,
int  errNo 
)
static
void snmpSnmplibDebug ( int  lvl,
char *  buf 
)

Definition at line 1066 of file snmp_core.cc.

References debugs.

Referenced by snmpInit().

static mib_tree_entry * snmpTreeEntry ( oid  entry,
snint  len,
mib_tree_entry current 
)
static

Definition at line 860 of file snmp_core.cc.

References _mib_tree_entry::leaves, _mib_tree_entry::name, and NULL.

Referenced by snmpAggrType(), snmpTreeGet(), and snmpTreeNext().

static oid_ParseFn * snmpTreeGet ( oid Current,
snint  CurrentLen 
)
static
static mib_tree_entry * snmpTreeSiblingEntry ( oid  entry,
snint  len,
mib_tree_entry current 
)
static

Definition at line 833 of file snmp_core.cc.

References _mib_tree_entry::leaves, _mib_tree_entry::name, and NULL.

Referenced by snmpTreeNext().

static oid * static_Inst ( oid name,
snint len,
mib_tree_entry current,
oid_ParseFn **  Fn 
)
static

Definition at line 678 of file snmp_core.cc.

References len, NULL, _mib_tree_entry::parsefunction, and xmalloc.

Referenced by snmpInit().

static oid * time_Inst ( oid name,
snint len,
mib_tree_entry current,
oid_ParseFn **  Fn 
)
static

Definition at line 692 of file snmp_core.cc.

References identifier, len, NULL, _mib_tree_entry::parsefunction, TIME_INDEX, TIME_INDEX_LEN, and xmalloc.

Referenced by snmpInit().

Variable Documentation

mib_tree_entry* mib_tree_head

Definition at line 32 of file snmp_core.cc.

Referenced by snmpAggrType(), snmpLookupNodeStr(), snmpTreeGet(), and snmpTreeNext().

mib_tree_entry* mib_tree_last

Definition at line 33 of file snmp_core.cc.

Comm::ConnectionPointer snmpIncomingConn

Definition at line 35 of file snmp_core.cc.

Referenced by snmpOpenPorts().

SQUIDCEXTERN void(* snmplib_debug_hook)(int, char *)

Definition at line 43 of file snmp_core.cc.

Referenced by snmpInit().

Comm::ConnectionPointer snmpOutgoingConn

Definition at line 36 of file snmp_core.cc.

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors