00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _EVENTLISTHOLDER_H_
00031 #define _EVENTLISTHOLDER_H_
00032
00033
00034 #include "snmp_pp/config_snmp_pp.h"
00035 #include "snmp_pp/snmperrs.h"
00036 #include "snmp_pp/eventlist.h"
00037 #include "snmp_pp/reentrant.h"
00038 #include "snmp_pp/usertimeout.h"
00039 #include "snmp_pp/userdefined.h"
00040
00041 #ifdef SNMP_PP_NAMESPACE
00042 namespace Snmp_pp {
00043 #endif
00044
00045 class CSNMPMessageQueue;
00046 class CNotifyEventQueue;
00047 class CUDEventQueue;
00048 class CUTEventQueue;
00049 class Pdu;
00050 class v3MP;
00051 class Snmp;
00052
00053 typedef unsigned long Uint32;
00054
00055
00056 #ifdef SNMPX11
00057 #include <X11/Intrinsic.h>
00058 #define TIMER_NOT_SET ((unsigned long) -1)
00059 #define CONTEXT_NOT_SET ((XtAppContext) NULL)
00060
00061 void SnmpX11TimerCallback(XtPointer client_data, XtIntervalId *id);
00062 void SnmpX11InputCallback(XtPointer client_data, int *source, XtInputId *id);
00063 int SNMPX11Initialize(const XtAppContext app_context);
00064
00065 #endif // SNMPX11
00066
00067 class DLLOPT EventListHolder
00068 {
00069 public:
00070 EventListHolder(Snmp *snmp_session);
00071 ~EventListHolder();
00072
00073 CSNMPMessageQueue *&snmpEventList() { return m_snmpMessageQueue; };
00074 CNotifyEventQueue *¬ifyEventList() { return m_notifyEventQueue; };
00075 #ifdef _USER_DEFINED_EVENTS
00076 CUDEventQueue *&udEventList() { return m_udEventQueue; };
00077 #endif
00078 #ifdef _USER_DEFINED_TIMEOUTS
00079 CUTEventQueue *&utEventList() { return m_utEventQueue; };
00080 #endif
00081
00082 #ifdef SNMPX11
00083
00084 int SnmpX11AddInput(int inputFd, XtInputId &inputId);
00085 int SnmpX11RemoveInput(XtInputId &inputId);
00086 void SnmpX11SetTimer();
00087 #endif // SNMPX11
00088
00089 Uint32 SNMPGetNextTimeout();
00090
00091 void SNMPGetFdSets(int & maxfds,
00092 fd_set & readfds,
00093 fd_set & writefds,
00094 fd_set & exceptfds);
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105 void SNMPMainLoop(const int max_block_milliseconds = 0 );
00106
00107
00108
00109 void SNMPExitMainLoop();
00110
00111
00112
00113
00114
00115
00116
00117
00118 int SNMPProcessEvents(const int max_block_milliseconds = 0 );
00119
00120
00121
00122 int SNMPProcessPendingEvents();
00123
00124
00125
00126
00127 int SNMPBlockForResponse(const unsigned long req_id,
00128 Pdu & pdu);
00129
00130
00131 #ifdef _USER_DEFINED_TIMEOUTS
00132 UtId SNMPAddTimeOut(const unsigned long interval,
00133 const ut_callback callBack,
00134 const void * callData);
00135 void SNMPRemoveTimeOut(const UtId utId) { m_utEventQueue->DeleteEntry(utId);};
00136 #endif
00137
00138
00139 #ifdef _USER_DEFINED_EVENTS
00140 UdId SNMPAddInput(const int source,
00141 const UdInputMask condition,
00142 const ud_callback callBack,
00143 const void * callData);
00144 void SNMPRemoveInput(const UdId udId) { m_udEventQueue->DeleteEntry(udId); };
00145 #endif
00146
00147 private:
00148
00149 CSNMPMessageQueue *m_snmpMessageQueue;
00150 CNotifyEventQueue *m_notifyEventQueue;
00151 #ifdef _USER_DEFINED_EVENTS
00152 CUDEventQueue *m_udEventQueue;
00153 #endif
00154 #ifdef _USER_DEFINED_TMEOUTS
00155 CUTEventQueue *m_utEventQueue;
00156 #endif
00157 CEventList m_eventList;
00158
00159 SnmpSynchronized pevents_mutex;
00160 };
00161
00162 #ifdef SNMP_PP_NAMESPACE
00163 };
00164 #endif
00165
00166 #endif // _EVENTLISTHOLDER_H_