nmblob.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:17k
源码类别:

模拟服务器

开发平台:

C/C++

  1. //=============================================================================
  2. //  Microsoft (R) Network Monitor (tm). 
  3. //  Copyright (C) 1996-1999. All rights reserved.
  4. //
  5. //  MODULE: nmblob.h
  6. //
  7. //  External Header for the blob helpers
  8. //=============================================================================
  9. #ifndef _NMBLOB_H_
  10. #define _NMBLOB_H_
  11. #ifdef _DEBUG
  12. #ifndef DEBUG
  13. #define DEBUG
  14. #endif
  15. #endif
  16. /////////////////////////////////////////////////////////////////////////////
  17. // Blob Definitions - (they are all in npptypes.idl)
  18. /////////////////////////////////////////////////////////////////////////////
  19. #include "npptypes.h"
  20. #ifdef __cplusplus
  21. extern "C"
  22. {
  23. #endif
  24. /////////////////////////////////////////////////////////////////////////////
  25. // Blob Constants
  26. /////////////////////////////////////////////////////////////////////////////
  27. #define INITIAL_RESTART_KEY 0xFFFFFFFF
  28. /////////////////////////////////////////////////////////////////////////////
  29. // Blob Core Helper Routines - these mess with internals (BlobCore.c)
  30. /////////////////////////////////////////////////////////////////////////////
  31. DWORD _cdecl CreateBlob(HBLOB * phBlob);
  32. DWORD _cdecl DestroyBlob(HBLOB hBlob);
  33. DWORD _cdecl SetStringInBlob(HBLOB  hBlob,         
  34.                       const char * pOwnerName,    
  35.                       const char * pCategoryName, 
  36.                       const char * pTagName,      
  37.                       const char * pString);      
  38. DWORD _cdecl GetStringFromBlob(HBLOB   hBlob,
  39.                         const char *  pOwnerName,
  40.                         const char *  pCategoryName,
  41.                         const char *  pTagName,
  42.                         const char ** ppString);
  43. DWORD _cdecl GetStringsFromBlob(HBLOB   hBlob,
  44.                          const char * pRequestedOwnerName,
  45.                          const char * pRequestedCategoryName,
  46.                          const char * pRequestedTagName,
  47.                          const char ** ppReturnedOwnerName,
  48.                          const char ** ppReturnedCategoryName,
  49.                          const char ** ppReturnedTagName,
  50.                          const char ** ppReturnedString,
  51.                          DWORD *       pRestartKey);
  52. DWORD _cdecl RemoveFromBlob(HBLOB   hBlob,
  53.                      const char *  pOwnerName,
  54.                      const char *  pCategoryName,
  55.                      const char *  pTagName);
  56. DWORD _cdecl LockBlob(HBLOB hBlob);
  57. DWORD _cdecl UnlockBlob(HBLOB hBlob);
  58. DWORD _cdecl FindUnknownBlobCategories( HBLOB hBlob,
  59.                                  const char *  pOwnerName,
  60.                                  const char *  pKnownCategoriesTable[],
  61.                                  HBLOB hUnknownCategoriesBlob);
  62. /////////////////////////////////////////////////////////////////////////////
  63. // Blob Helper Routines - these just call core helpers (BlobHelp.c)
  64. /////////////////////////////////////////////////////////////////////////////
  65. DWORD _cdecl MergeBlob(HBLOB hDstBlob,
  66.                 HBLOB hSrcBlob); 
  67. DWORD _cdecl DuplicateBlob (HBLOB hSrcBlob,
  68.  HBLOB *hBlobThatWillBeCreated ); 
  69. DWORD _cdecl WriteBlobToFile(HBLOB  hBlob,
  70.                       const char * pFileName);
  71. DWORD _cdecl ReadBlobFromFile(HBLOB* phBlob,
  72.                        const char * pFileName);
  73. DWORD _cdecl RegCreateBlobKey(HKEY hkey, const char* szBlobName, HBLOB hBlob);
  74. DWORD _cdecl RegOpenBlobKey(HKEY hkey, const char* szBlobName, HBLOB* phBlob);
  75. DWORD _cdecl MarshalBlob(HBLOB hBlob, DWORD* pSize, BYTE** ppBytes);
  76. DWORD _cdecl UnMarshalBlob(HBLOB* phBlob, DWORD Size, BYTE* pBytes);
  77. DWORD _cdecl SetDwordInBlob(HBLOB hBlob,
  78.                      const char *  pOwnerName,
  79.                      const char *  pCategoryName,
  80.                      const char *  pTagName,
  81.                      DWORD         Dword);
  82. DWORD _cdecl GetDwordFromBlob(HBLOB   hBlob,
  83.                        const char *  pOwnerName,
  84.                        const char *  pCategoryName,
  85.                        const char *  pTagName,
  86.                        DWORD      *  pDword);
  87. DWORD _cdecl SetBoolInBlob(HBLOB   hBlob,
  88.                     const char *  pOwnerName,
  89.                     const char *  pCategoryName,
  90.                     const char *  pTagName,
  91.                     BOOL          Bool);
  92. DWORD _cdecl GetBoolFromBlob(HBLOB   hBlob,
  93.                       const char *  pOwnerName,
  94.                       const char *  pCategoryName,
  95.                       const char *  pTagName,
  96.                       BOOL       *  pBool);
  97. DWORD _cdecl GetMacAddressFromBlob(HBLOB   hBlob,
  98.                             const char *  pOwnerName,
  99.                             const char *  pCategoryName,
  100.                             const char *  pTagName,
  101.                             BYTE *  pMacAddress);
  102. DWORD _cdecl SetMacAddressInBlob(HBLOB   hBlob,
  103.                           const char *  pOwnerName,
  104.                           const char *  pCategoryName,
  105.                           const char *  pTagName,
  106.                           const BYTE *  pMacAddress);
  107. DWORD _cdecl FindUnknownBlobTags( HBLOB hBlob,
  108.                            const char *  pOwnerName,
  109.                            const char *  pCategoryName,
  110.                            const char *  pKnownTagsTable[],
  111.                            HBLOB hUnknownTagsBlob);
  112. /////////////////////////////////////////////////////////////////////////////
  113. // Blob NPP Helper Routines - these are specific to the NPP interfaces (BlobNPP.c)
  114. /////////////////////////////////////////////////////////////////////////////
  115. DWORD _cdecl SetNetworkInfoInBlob(HBLOB hBlob, 
  116.                            LPNETWORKINFO lpNetworkInfo);
  117. DWORD _cdecl GetNetworkInfoFromBlob(HBLOB hBlob, 
  118.                              LPNETWORKINFO lpNetworkInfo);
  119. DWORD _cdecl CreateNPPInterface ( HBLOB hBlob,
  120.                            REFIID iid,
  121.                            void ** ppvObject);
  122. DWORD _cdecl SetClassIDInBlob(HBLOB hBlob,
  123.                        const char* pOwnerName,
  124.                        const char* pCategoryName,
  125.                        const char* pTagName,
  126.                        const CLSID*  pClsID);
  127. DWORD _cdecl GetClassIDFromBlob(HBLOB hBlob,
  128.                          const char* pOwnerName,
  129.                          const char* pCategoryName,
  130.                          const char* pTagName,
  131.                          CLSID * pClsID);
  132. DWORD _cdecl SetNPPPatternFilterInBlob( HBLOB hBlob,
  133.                                  LPEXPRESSION pExpression,
  134.                                  HBLOB hErrorBlob);
  135. DWORD _cdecl GetNPPPatternFilterFromBlob( HBLOB hBlob,
  136.                                    LPEXPRESSION pExpression,
  137.                                    HBLOB hErrorBlob);
  138. DWORD _cdecl SetNPPAddressFilterInBlob( HBLOB hBlob,
  139.                                  LPADDRESSTABLE pAddressTable);
  140. DWORD _cdecl GetNPPAddressFilterFromBlob( HBLOB hBlob,
  141.                                    LPADDRESSTABLE pAddressTable,
  142.                                    HBLOB hErrorBlob);
  143. DWORD _cdecl SetNPPTriggerInBlob( HBLOB hBlob,
  144.                            LPTRIGGER   pTrigger,
  145.                            HBLOB hErrorBlob);
  146. DWORD _cdecl GetNPPTriggerFromBlob( HBLOB hBlob,
  147.                              LPTRIGGER   pTrigger,
  148.                              HBLOB hErrorBlob);
  149. DWORD _cdecl SetNPPEtypeSapFilter(HBLOB  hBlob, 
  150.                            WORD   nSaps,
  151.                            WORD   nEtypes,
  152.                            LPBYTE lpSapTable,
  153.                            LPWORD lpEtypeTable,
  154.                            DWORD  FilterFlags,
  155.                            HBLOB  hErrorBlob);
  156. DWORD _cdecl GetNPPEtypeSapFilter(HBLOB  hBlob, 
  157.                            WORD   *pnSaps,
  158.                            WORD   *pnEtypes,
  159.                            LPBYTE *ppSapTable,
  160.                            LPWORD *ppEtypeTable,
  161.                            DWORD  *pFilterFlags,
  162.                            HBLOB  hErrorBlob);
  163. // GetNPPMacTypeAsNumber maps the tag NPP:NetworkInfo:MacType to the MAC_TYPE_*
  164. // defined in the NPPTYPES.h.  If the tag is unavailable, the API returns MAC_TYPE_UNKNOWN.
  165. DWORD _cdecl GetNPPMacTypeAsNumber(HBLOB hBlob, 
  166.                             LPDWORD lpMacType);
  167. // See if a remote catagory exists... and make sure that the remote computername
  168. // isn't the same as the local computername.
  169. BOOL  _cdecl IsRemoteNPP ( HBLOB hBLOB);
  170. /////////////////////////////////////////////////////////////////////////////
  171. // Blob Errors
  172. /////////////////////////////////////////////////////////////////////////////
  173. // basic blob errors
  174. #define NMERR_BLOB_NOT_INITIALIZED          1000
  175. #define NMERR_INVALID_BLOB                  1001
  176. #define NMERR_UPLEVEL_BLOB                  1002
  177. #define NMERR_BLOB_ENTRY_ALREADY_EXISTS     1003
  178. #define NMERR_BLOB_ENTRY_DOES_NOT_EXIST     1004
  179. #define NMERR_AMBIGUOUS_SPECIFIER           1005
  180. #define NMERR_BLOB_OWNER_NOT_FOUND          1006
  181. #define NMERR_BLOB_CATEGORY_NOT_FOUND       1007
  182. #define NMERR_UNKNOWN_CATEGORY              1008
  183. #define NMERR_UNKNOWN_TAG                   1009
  184. #define NMERR_BLOB_CONVERSION_ERROR         1010
  185. #define NMERR_ILLEGAL_TRIGGER               1011
  186. #define NMERR_BLOB_STRING_INVALID           1012
  187. // FINDER errors -- see also nmerr.h, finder.h
  188. #define NMERR_UNABLE_TO_LOAD_LIBRARY        1013
  189. #define NMERR_UNABLE_TO_GET_PROCADDR        1014
  190. #define NMERR_CLASS_NOT_REGISTERED          1015
  191. #define NMERR_INVALID_REMOTE_COMPUTERNAME   1016
  192. #define NMERR_RPC_REMOTE_FAILURE            1017
  193. //////////////////////////////////////////////////////////////////////////////
  194. // npp tag definitions
  195. //////////////////////////////////////////////////////////////////////////////
  196. #define OWNER_NPP               "NPP"
  197. #define CATEGORY_NETWORKINFO        "NetworkInfo"
  198. #define TAG_RAS                         "Dial-up Connection"
  199. #define TAG_MACTYPE "MacType"
  200. #define TAG_CURRENTADDRESS              "CurrentAddress"
  201. #define TAG_LINKSPEED                   "LinkSpeed"
  202. #define TAG_MAXFRAMESIZE                "MaxFrameSize"
  203. #define TAG_FLAGS                       "Flags"
  204. #define TAG_TIMESTAMPSCALEFACTOR        "TimeStampScaleFactor"
  205. #define TAG_COMMENT                     "Comment"
  206. #define TAG_NODENAME                    "NodeName"
  207. #define TAG_NAME                        "Name"
  208. #define TAG_FAKENPP                     "Fake"
  209. #define TAG_PROMISCUOUS_MODE            "PMode"
  210. #define CATEGORY_LOCATION           "Location"
  211. #define TAG_MACADDRESS                  "MacAddress"
  212. #define TAG_CLASSID                     "ClassID"
  213. #define TAG_NAME                        "Name"
  214. #define CATEGORY_CONFIG             "Config"
  215. #define TAG_FRAME_SIZE                  "FrameSize"
  216. #define TAG_UPDATE_FREQUENCY            "UpdateFreq"
  217. #define TAG_BUFFER_SIZE                 "BufferSize"
  218. #define TAG_DRIVE_LETTER                "DriveLetter"
  219. #define TAG_PATTERN_DESIGNATOR          "PatternMatch"
  220. #define TAG_PATTERN                     "Pattern"
  221. #define TAG_ADDRESS_PAIR                "AddressPair"
  222. #define TAG_CONNECTIONFLAGS             "ConnectionFlags"
  223. #define TAG_ETYPES                      "Etypes"
  224. #define TAG_SAPS                        "Saps"
  225. #define TAG_NO_CONVERSATION_STATS       "NoConversationStats"
  226. #define TAG_NO_STATS_FRAME              "NoStatsFrame"
  227. #define TAG_DONT_DELETE_EMPTY_CAPTURE   "DontDeleteEmptyCapture"
  228. #define TAG_WANT_PROTOCOL_INFO          "WantProtocolInfo"
  229. #define TAG_INTERFACE_DELAYED_CAPTURE   "IDdC"
  230. #define TAG_INTERFACE_REALTIME_CAPTURE  "IRTC"
  231. #define TAG_INTERFACE_STATS             "ISts"
  232. #define TAG_INTERFACE_EXPERT_STATS      "IESP"
  233. #define TAG_LOCAL_ONLY                  "LocalOnly"
  234. // Is_Remote is set to TRUE by NPPs that go remote.  Note that when you
  235. //  are looking for a remote NPP, you probably also need to ask for 
  236. //  blobs that have the TAG_GET_SPECIAL_BLOBS bool set
  237. #define TAG_IS_REMOTE                   "IsRemote"
  238. #define CATEGORY_TRIGGER            "Trigger"
  239. #define TAG_TRIGGER                     "Trigger"
  240. #define CATEGORY_FINDER             "Finder"
  241. #define TAG_ROOT                        "Root"
  242. #define TAG_PROCNAME                    "ProcName"
  243. #define TAG_DISP_STRING                 "Display"
  244. #define TAG_DLL_FILENAME                "DLLName"
  245. #define TAG_GET_SPECIAL_BLOBS           "Specials"
  246. #define CATEGORY_REMOTE              "Remote"
  247. #define TAG_REMOTECOMPUTER              "RemoteComputer"
  248. #define TAG_REMOTECLASSID               "ClassID"
  249. #define CATEGORY_ESP                "ESP"
  250. #define TAG_ESP_GENERAL_ACTIVE          "ESPGeneralActive"
  251. #define TAG_ESP_PROTOCOL_ACTIVE         "ESPProtocolActive"
  252. #define TAG_ESP_MAC_ACTIVE              "ESPMacActive"
  253. #define TAG_ESP_MAC2MAC_ACTIVE          "ESPMac2MacActive"
  254. #define TAG_ESP_IP_ACTIVE               "ESPIpActive"
  255. #define TAG_ESP_IP2IP_ACTIVE            "ESPIp2IpActive"
  256. #define TAG_ESP_IP_APP_ACTIVE           "ESPIpAppActive"
  257. #define TAG_ESP_IPX_ACTIVE              "ESPIpxActive"
  258. #define TAG_ESP_IPX2IPX_ACTIVE          "ESPIpx2IpxActive"
  259. #define TAG_ESP_IPX_APP_ACTIVE          "ESPIpxAppActive"
  260. #define TAG_ESP_DEC_ACTIVE              "ESPDecActive"
  261. #define TAG_ESP_DEC2DEC_ACTIVE          "ESPDec2DecActive"
  262. #define TAG_ESP_DEC_APP_ACTIVE          "ESPDecAppActive"
  263. #define TAG_ESP_APPLE_ACTIVE            "ESPAppleActive"
  264. #define TAG_ESP_APPLE2APPLE_ACTIVE      "ESPApple2AppleActive"
  265. #define TAG_ESP_APPLE_APP_ACTIVE        "ESPAppleAppActive"
  266. #define TAG_ESP_UTIL_SIZE               "ESPUtilSize"
  267. #define TAG_ESP_TIME_SIZE               "ESPTimeSize"
  268. #define TAG_ESP_BPS_SIZE "ESPBpsSize"
  269. #define TAG_ESP_BPS_THRESH "ESPBpsThresh"
  270. #define TAG_ESP_FPS_THRESH "ESPFpsThresh"
  271. #define TAG_ESP_MAC                     "ESPMac"
  272. #define TAG_ESP_IPX                     "ESPIpx"
  273. #define TAG_ESP_IPXSPX                  "ESPIpxSpx"
  274. #define TAG_ESP_NCP                     "ESPNcp"
  275. #define TAG_ESP_IP                      "ESPIp"
  276. #define TAG_ESP_UDP                     "ESPUdp"
  277. #define TAG_ESP_TCP                     "ESPTcp"
  278. #define TAG_ESP_ICMP                    "ESPIcmp"
  279. #define TAG_ESP_ARP                     "ESPArp"
  280. #define TAG_ESP_RARP                    "ESPRarp"
  281. #define TAG_ESP_APPLE                   "ESPApple"
  282. #define TAG_ESP_AARP                    "ESPAarp"
  283. #define TAG_ESP_DEC                     "ESPDec"
  284. #define TAG_ESP_NETBIOS                 "ESPNetbios"
  285. #define TAG_ESP_SNA                     "ESPSna"
  286. #define TAG_ESP_BPDU                    "ESPBpdu"
  287. #define TAG_ESP_LLC                     "ESPLlc"
  288. #define TAG_ESP_RPL                     "ESPRpl"
  289. #define TAG_ESP_BANYAN                  "ESPBanyan"
  290. #define TAG_ESP_LANMAN                  "ESPLanMan"
  291. #define TAG_ESP_SNMP                    "ESPSnmp"
  292. #define TAG_ESP_X25                     "ESPX25"
  293. #define TAG_ESP_XNS                     "ESPXns"
  294. #define TAG_ESP_ISO                     "ESPIso"
  295. #define TAG_ESP_UNKNOWN                 "ESPUnknown"
  296. #define TAG_ESP_ATP                     "ESPAtp"
  297. #define TAG_ESP_ADSP                    "ESPAdsp"
  298. //////////////////////////////////////////////////////////////////////////////
  299. // npp value definitions
  300. //////////////////////////////////////////////////////////////////////////////
  301. // Mac types
  302. #define PROTOCOL_STRING_ETHERNET_TXT   "ETHERNET"
  303. #define PROTOCOL_STRING_TOKENRING_TXT  "TOKENRING"
  304. #define PROTOCOL_STRING_FDDI_TXT       "FDDI"
  305. #define PROTOCOL_STRING_ATM_TXT        "ATM"
  306. // lower protocols
  307. #define PROTOCOL_STRING_IP_TXT         "IP"
  308. #define PROTOCOL_STRING_IPX_TXT        "IPX"
  309. #define PROTOCOL_STRING_XNS_TXT        "XNS"
  310. #define PROTOCOL_STRING_VINES_IP_TXT   "VINES IP"
  311. // upper protocols
  312. #define PROTOCOL_STRING_ICMP_TXT       "ICMP"
  313. #define PROTOCOL_STRING_TCP_TXT        "TCP"
  314. #define PROTOCOL_STRING_UDP_TXT        "UDP"
  315. #define PROTOCOL_STRING_SPX_TXT        "SPX"
  316. #define PROTOCOL_STRING_NCP_TXT        "NCP"
  317. // pseudo protocols
  318. #define PROTOCOL_STRING_ANY_TXT        "ANY"
  319. #define PROTOCOL_STRING_ANY_GROUP_TXT  "ANY GROUP"
  320. #define PROTOCOL_STRING_HIGHEST_TXT    "HIGHEST"
  321. #define PROTOCOL_STRING_LOCAL_ONLY_TXT "LOCAL ONLY"
  322. #define PROTOCOL_STRING_UNKNOWN_TXT    "UNKNOWN"
  323. #define PROTOCOL_STRING_DATA_TXT       "DATA"
  324. #define PROTOCOL_STRING_FRAME_TXT      "FRAME"
  325. #define PROTOCOL_STRING_NONE_TXT       "NONE"
  326. #define PROTOCOL_STRING_EFFECTIVE_TXT  "EFFECTIVE"
  327. #define ADDRESS_PAIR_INCLUDE_TXT    "INCLUDE"
  328. #define ADDRESS_PAIR_EXCLUDE_TXT    "EXCLUDE"
  329. #define INCLUDE_ALL_EXCEPT_TXT      "INCLUDE ALL EXCEPT"
  330. #define EXCLUDE_ALL_EXCEPT_TXT      "EXCLUDE ALL EXCEPT"
  331. #define PATTERN_MATCH_OR_TXT        "OR("
  332. #define PATTERN_MATCH_AND_TXT       "AND("
  333. #define TRIGGER_PATTERN_TXT               "PATTERN MATCH"
  334. #define TRIGGER_BUFFER_TXT                "BUFFER CONTENT"
  335. #define TRIGGER_NOTIFY_TXT      "NOTIFY"
  336. #define TRIGGER_STOP_TXT        "STOP"
  337. #define TRIGGER_PAUSE_TXT       "PAUSE"
  338. #define TRIGGER_25_PERCENT_TXT  "25 PERCENT"
  339. #define TRIGGER_50_PERCENT_TXT  "50 PERCENT"
  340. #define TRIGGER_75_PERCENT_TXT  "75 PERCENT"
  341. #define TRIGGER_100_PERCENT_TXT "100 PERCENT"
  342. #define PATTERN_MATCH_NOT_TXT   "NOT"
  343. #ifdef __cplusplus
  344. }
  345. #endif
  346. #endif // _BLOBHELP_H_