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

Go to the source code of this file.

Functions

static void snmpPortOpened (Ipc::StartListeningAnswer &)
 
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)
 
static 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

◆ addr2oid()

void addr2oid ( Ip::Address addr,
oid Dest 
)

◆ client_Inst()

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

◆ oid2addr()

void oid2addr ( oid id,
Ip::Address addr,
u_int  size 
)

Definition at line 1115 of file snmp_core.cc.

References debugs, size, and snmpDebugOid().

Referenced by client_Inst(), and snmp_meshCtblFn().

◆ peer_Inst()

◆ snmpAddNode()

static mib_tree_entry * snmpAddNode ( oid name,
int  len,
oid_ParseFn parsefunction,
instance_Fn instancefunction,
AggrType  aggrType,
int  children,
  ... 
)
static

◆ snmpAddNodeChild()

static void snmpAddNodeChild ( mib_tree_entry entry,
mib_tree_entry child 
)
static

◆ snmpAddNodeStr()

static mib_tree_entry * snmpAddNodeStr ( const char *  base_str,
int  o,
oid_ParseFn parsefunction,
instance_Fn instancefunction,
AggrType  aggrType = atNone 
)
static

◆ snmpAgentResponse()

◆ snmpAggrType()

AggrType snmpAggrType ( oid Current,
snint  CurrentLen 
)

◆ snmpClosePorts()

◆ snmpConstructReponse()

◆ snmpCreateOid()

static oid * snmpCreateOid ( int  length,
  ... 
)
static

Definition at line 1033 of file snmp_core.cc.

References xmalloc.

Referenced by snmpInit().

◆ snmpCreateOidFromStr()

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

Definition at line 934 of file snmp_core.cc.

References safe_free, and xrealloc().

Referenced by snmpAddNodeStr(), and snmpLookupNodeStr().

◆ snmpDebugOid()

◆ snmpDecodePacket()

◆ snmpHandleUdp()

◆ snmpInit()

void snmpInit ( void  )

Definition at line 71 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, mib_tree_head, mib_tree_last, NET_DNS_CACHE, NET_FQDN_CACHE, NET_IP_CACHE, 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().

◆ snmpLookupNodeStr()

mib_tree_entry * snmpLookupNodeStr ( mib_tree_entry entry,
const char *  str 
)

◆ snmpOpenPorts()

◆ snmpPortOpened()

◆ snmpSnmplibDebug()

void snmpSnmplibDebug ( int  lvl,
char *  buf 
)

Definition at line 1071 of file snmp_core.cc.

References debugs.

Referenced by snmpInit().

◆ snmpTreeEntry()

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

Definition at line 865 of file snmp_core.cc.

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

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

◆ snmpTreeGet()

static oid_ParseFn * snmpTreeGet ( oid Current,
snint  CurrentLen 
)
static

◆ snmpTreeNext()

◆ snmpTreeSiblingEntry()

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

Definition at line 838 of file snmp_core.cc.

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

Referenced by snmpTreeNext().

◆ static_Inst()

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

Definition at line 683 of file snmp_core.cc.

References instance, _mib_tree_entry::parsefunction, and xmalloc.

Referenced by snmpInit().

◆ time_Inst()

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

Definition at line 697 of file snmp_core.cc.

References identifier, instance, _mib_tree_entry::parsefunction, TIME_INDEX, TIME_INDEX_LEN, and xmalloc.

Referenced by snmpInit().

Variable Documentation

◆ mib_tree_head

mib_tree_entry* mib_tree_head

◆ mib_tree_last

mib_tree_entry* mib_tree_last

Definition at line 36 of file snmp_core.cc.

Referenced by snmpInit(), and snmpTreeNext().

◆ snmpIncomingConn

Comm::ConnectionPointer snmpIncomingConn

Definition at line 38 of file snmp_core.cc.

Referenced by snmpClosePorts(), snmpOpenPorts(), and snmpPortOpened().

◆ snmplib_debug_hook

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

Definition at line 46 of file snmp_core.cc.

Referenced by snmpInit().

◆ snmpOutgoingConn

Comm::ConnectionPointer snmpOutgoingConn

Definition at line 39 of file snmp_core.cc.

Referenced by snmpClosePorts(), snmpOpenPorts(), and snmpPortOpened().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors