00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef MT_SUPPORT_H
00013 #define MT_SUPPORT_H
00014
00015 #ifdef __cplusplus
00016 extern "C" {
00017 #endif
00018
00019
00020
00021
00022
00023 #define MT_LIBRARY_ID 0
00024 #define MT_APPLICATION_ID 1
00025 #define MT_TOKEN_ID 2
00026
00027 #define MT_MAX_IDS 3
00028 #define MT_MAX_SUBIDS 10
00029
00030
00031
00032
00033
00034
00035 #define MT_LIB_NONE 0
00036 #define MT_LIB_SESSION 1
00037 #define MT_LIB_REQUESTID 2
00038 #define MT_LIB_MESSAGEID 3
00039 #define MT_LIB_SESSIONID 4
00040 #define MT_LIB_TRANSID 5
00041
00042 #define MT_LIB_MAXIMUM 6
00043
00044
00045 #if defined(NS_REENTRANT) || defined(WIN32)
00046
00047 #if HAVE_PTHREAD_H
00048 #include <pthread.h>
00049 typedef pthread_mutex_t mutex_type;
00050 #ifdef pthread_mutexattr_default
00051 #define MT_MUTEX_INIT_DEFAULT pthread_mutexattr_default
00052 #else
00053 #define MT_MUTEX_INIT_DEFAULT 0
00054 #endif
00055
00056 #elif defined(WIN32) || defined(cygwin)
00057
00058 #include <windows.h>
00059 typedef CRITICAL_SECTION mutex_type;
00060
00061 #else
00062 error "There is no re-entrant support as defined."
00063 #endif
00064
00065
00066 int snmp_res_init(void);
00067 int snmp_res_lock(int groupID, int resourceID);
00068 int snmp_res_unlock(int groupID, int resourceID);
00069 int snmp_res_destroy_mutex(int groupID, int resourceID);
00070
00071 #else
00072
00073 #ifndef WIN32
00074 #define snmp_res_init() do {} while (0)
00075 #define snmp_res_lock(x,y) do {} while (0)
00076 #define snmp_res_unlock(x,y) do {} while (0)
00077 #define snmp_res_destroy_mutex(x,y) do {} while (0)
00078 #endif
00079
00080 #endif
00081
00082 #ifdef __cplusplus
00083 }
00084 #endif
00085 #endif