Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

PSNMPClient Class Reference

#include <psnmp.h>

Inheritance diagram for PSNMPClient:

PSNMP PIndirectChannel PChannel PObject

List of all members.


Detailed Description

Class which gets SNMP data

Definition at line 227 of file psnmp.h.


Miscellaneous functions

void AbortCommandString ()
BOOL SendCommandString (const PString &command)
BOOL SetBufferSize (PINDEX newSize)
enum  ShutdownValue { ShutdownRead = 0, ShutdownWrite = 1, ShutdownReadAndWrite = 2 }

Comparison functions

virtual Comparison CompareObjectMemoryDirect (const PObject &obj) const
bool operator!= (const PObject &obj) const
bool operator< (const PObject &obj) const
bool operator<= (const PObject &obj) const
bool operator== (const PObject &obj) const
bool operator> (const PObject &obj) const
bool operator>= (const PObject &obj) const
enum  Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 }

Run Time Type functions

virtual const char * GetClass (unsigned=0) const
virtual BOOL InternalIsDescendant (const char *clsName) const
BOOL IsClass (const char *cls) const
static const char * Class ()

Error functions

Errors GetErrorCode (ErrorGroup group=NumErrorGroups) const
int GetErrorNumber (ErrorGroup group=NumErrorGroups) const
enum  ErrorGroup { LastReadError, LastWriteError, LastGeneralError, NumErrorGroups }
enum  Errors {
  NoError, NotFound, FileExists, DiskFull,
  AccessDenied, DeviceInUse, BadParameter, NoMemory,
  NotOpen, Timeout, Interrupted, BufferTooSmall,
  Miscellaneous, ProtocolFailure, NumNormalisedErrors
}
static PString GetErrorText (Errors lastError, int osError=0)

I/O functions

virtual void PrintOn (ostream &strm) const
virtual void ReadFrom (istream &strm)
ostream & operator<< (ostream &strm, const PObject &obj)
istream & operator>> (istream &strm, PObject &obj)

Scattered read/write functions

virtual BOOL Read (const VectorOfSlice &slices)
virtual BOOL Write (const VectorOfSlice &slices)
typedef std::vector< SliceVectorOfSlice

Public Types

enum  { TrapPort = 162 }
enum  ErrorType {
  NoError = 0, TooBig = 1, NoSuchName = 2, BadValue = 3,
  ReadOnly = 4, GenErr = 5, NoResponse, MalformedResponse,
  SendFailed, RxBufferTooSmall, TxDataTooBig, NumErrors
}
enum  PXBlockType { PXReadBlock, PXWriteBlock, PXAcceptBlock, PXConnectBlock }
enum  RequestType {
  GetRequest = 0, GetNextRequest = 1, GetResponse = 2, SetRequest = 3,
  Trap = 4
}
enum  TrapType {
  ColdStart = 0, WarmStart = 1, LinkDown = 2, LinkUp = 3,
  AuthenticationFailure = 4, EGPNeighbourLoss = 5, EnterpriseSpecific = 6, NumTrapTypes
}

Public Member Functions

PString GetCommunity () const
ErrorType GetLastErrorCode () const
PINDEX GetLastErrorIndex () const
PString GetLastErrorText () const
PASNInt GetRequestID () const
PASNInt GetVersion () const
 PSNMPClient (PINDEX retryMax=5, PINDEX timeoutMax=5, PINDEX rxBufferSize=1500, PINDEX txSize=484)
 PSNMPClient (const PString &host, PINDEX retryMax=5, PINDEX timeoutMax=5, PINDEX rxBufferSize=1500, PINDEX txSize=484)
void SetCommunity (const PString &str)
void SetRequestID (PASNInt requestID)
void SetVersion (PASNInt version)
BOOL WriteGetNextRequest (PSNMPVarBindingList &varsIn, PSNMPVarBindingList &varsOut)
BOOL WriteGetRequest (PSNMPVarBindingList &varsIn, PSNMPVarBindingList &varsOut)
BOOL WriteSetRequest (PSNMPVarBindingList &varsIn, PSNMPVarBindingList &varsOut)
Miscellaneous functions
virtual PObjectClone () const
Overrides from class PChannel
virtual BOOL Close ()
virtual PChannelGetBaseReadChannel () const
virtual PChannelGetBaseWriteChannel () const
virtual PString GetErrorText (ErrorGroup group=NumErrorGroups) const
virtual PString GetName () const
virtual BOOL IsOpen () const
virtual BOOL Read (void *buf, PINDEX len)
virtual BOOL Shutdown (ShutdownValue option)
virtual BOOL Write (const void *buf, PINDEX len)
Overrides from class PObject
Comparison Compare (const PObject &obj) const
Information functions
int GetHandle () const
Reading functions
virtual PINDEX GetLastReadCount () const
PTimeInterval GetReadTimeout () const
virtual void OnReadComplete (void *buf, PINDEX len)
virtual BOOL ReadAsync (void *buf, PINDEX len)
BOOL ReadBlock (void *buf, PINDEX len)
virtual int ReadChar ()
PString ReadString (PINDEX len)
void SetReadTimeout (const PTimeInterval &time)
Writing functions
virtual PINDEX GetLastWriteCount () const
PTimeInterval GetWriteTimeout () const
virtual void OnWriteComplete (const void *buf, PINDEX len)
void SetWriteTimeout (const PTimeInterval &time)
virtual BOOL WriteAsync (const void *buf, PINDEX len)
BOOL WriteChar (int c)
BOOL WriteString (const PString &str)
Channel establish functions
PChannelGetReadChannel () const
PChannelGetWriteChannel () const
BOOL Open (PChannel *readChannel, PChannel *writeChannel, BOOL autoDeleteRead=TRUE, BOOL autoDeleteWrite=TRUE)
BOOL Open (PChannel *channel, BOOL autoDelete=TRUE)
BOOL Open (PChannel &channel)
BOOL SetReadChannel (PChannel *channel, BOOL autoDelete=TRUE)
BOOL SetWriteChannel (PChannel *channel, BOOL autoDelete=TRUE)
Overrides from class PObject
virtual PINDEX HashFunction () const

Static Public Member Functions

static BOOL ConvertOSError (int libcReturnValue, Errors &lastError, int &osError)
static BOOL DecodeTrap (const PBYTEArray &readBuffer, PINDEX &version, PString &community, PString &enterprise, PIPSocket::Address &address, PINDEX &genericTrapType, PINDEX &specificTrapType, PASNUnsigned &timeTicks, PSNMPVarBindingList &varsOut)
static PString GetErrorText (ErrorType err)
static PString GetTrapTypeText (PINDEX code)
static void SendEnterpriseTrap (const PIPSocket::Address &addr, const PString &community, const PString &enterprise, PINDEX specificTrap, PASNUnsigned timeTicks, const PSNMPVarBindingList &vars, WORD sendPort=TrapPort)
static void SendEnterpriseTrap (const PIPSocket::Address &addr, const PString &community, const PString &enterprise, PINDEX specificTrap, PASNUnsigned timeTicks, WORD sendPort=TrapPort)
static void SendTrap (const PIPSocket::Address &addr, PSNMP::TrapType trapType, const PString &community, const PString &enterprise, PINDEX specificTrap, PASNUnsigned timeTicks, const PSNMPVarBindingList &vars, const PIPSocket::Address &agentAddress, WORD sendPort=TrapPort)
static void SendTrap (const PIPSocket::Address &addr, PSNMP::TrapType trapType, const PString &community, const PString &enterprise, PINDEX specificTrap, PASNUnsigned timeTicks, const PSNMPVarBindingList &vars, WORD sendPort=TrapPort)
static void WriteTrap (PChannel &channel, PSNMP::TrapType trapType, const PString &community, const PString &enterprise, PINDEX specificTrap, PASNUnsigned timeTicks, const PSNMPVarBindingList &vars, const PIPSocket::Address &agentAddress)

Protected Member Functions

virtual BOOL ConvertOSError (int libcReturnValue, ErrorGroup group=LastGeneralError)
virtual BOOL OnOpen ()
int PXClose ()
BOOL PXSetIOBlock (PXBlockType type, const PTimeInterval &timeout)
int ReadCharWithTimeout (PTimeInterval &timeout)
BOOL ReadRequest (PBYTEArray &readBuffer)
BOOL ReceiveCommandString (int nextChar, const PString &reply, PINDEX &pos, PINDEX start)
BOOL SetErrorValues (Errors errorCode, int osError, ErrorGroup group=LastGeneralError)
BOOL WriteRequest (PASNInt requestCode, PSNMPVarBindingList &varsIn, PSNMPVarBindingList &varsOut)

Protected Attributes

PString channelName
PReadWriteMutex channelPointerMutex
 Race condition prevention on closing channel.
PString community
PString hostName
ErrorType lastErrorCode
 The platform independant error code.
PINDEX lastErrorIndex
int lastErrorNumber [NumErrorGroups+1]
 The operating system error number (eg as returned by errno).
PINDEX lastReadCount
 Number of byte last read by the Read() function.
PINDEX lastWriteCount
 Number of byte last written by the Write() function.
PINDEX maxRxSize
PINDEX maxTxSize
int os_handle
 The operating system file handle return by standard open() function.
PXBlockType px_lastBlockType
PThreadpx_readThread
PMutex px_selectMutex
PThreadpx_selectThread
PMutex px_threadMutex
PMutex px_writeMutex
PThreadpx_writeThread
BOOL readAutoDelete
 Automatically delete read channel on destruction.
PBYTEArray readBuffer
PChannelreadChannel
 Channel for read operations.
PTimeInterval readTimeout
 Timeout for read operations.
PASNInt requestId
PINDEX retryMax
PASNInt version
BOOL writeAutoDelete
 Automatically delete write channel on destruction.
PChannelwriteChannel
 Channel for write operations.
PTimeInterval writeTimeout
 Timeout for write operations.

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index