Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
3.8 KiB

  1. /*++
  2. Copyright (c) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. NMInsert.h
  5. Abstract:
  6. This header file defines constants types and functions for inserting
  7. frames into a running Netmon capture.
  8. Author:
  9. a-flexd 07-09-96 Created.
  10. Revision History:
  11. Mini-DOC:
  12. Netmon allows a programming interface to insert frames into a running capture.
  13. There are two different ways to do this. You can either used the defined
  14. interfaces in the NMExt API suite to start the capture, define the filter etc,
  15. or you can use the "raw" interface. Using this interface will insert a frame
  16. into EVERY running capture. For example, if you your two different Netmons
  17. running, one on ethernet and one on FDDI, you will get the inserted frame
  18. into both captures.
  19. Calling TransmitSpecialFrame if Netmon is not running is just fine. Nothing
  20. will happen, the data will just be dropped.
  21. The entry point defined below (TransmitSpecialFrame) is contained in NAL.DLL.
  22. NT4.0 is the first version of NT that contains the entry point, specifically
  23. build 346.
  24. NOTE NOTE NOTE: You should NOT link to the NAL.LIB to acquire this
  25. functionality. NAL.DLL is not gaurenteed to be installed on a standard NT
  26. machine. Instead use Loadlibrary to acquire the entry point.
  27. When a frame is inserted, a fake media header and parent protocol is created
  28. for your data. We create a "TRAIL" protocol header that hands off to your
  29. data. The parsing of your data depends on the FRAME_TYPE_ that you specify.
  30. If you specify a known frame type, we will parse it for you. For example, the
  31. FRAME_TYPE_MESSAGE uses a data structure that looks something like this:
  32. typedef struct _MessageFRAME
  33. {
  34. DWORD dwValue1;
  35. DWORD dwValue2;
  36. CHAR szMessage[];
  37. } MessageFRAME;
  38. Just fill out one of these and point to it when you call TransmitSpecialFrame
  39. with the FRAME_TYPE_MESSAGE.
  40. FRAME_TYPE_COMMENT is just an array of printable chars. If you want to make
  41. your own data structure, pick a number above 1000 and use that number as the
  42. FrameType parameter. Note that you must add your number and parser name to
  43. the TRAIL.INI file in the Netmon parsers directory.
  44. Example:
  45. setup:
  46. TRANSMITSPECIALFRAME_FN lpfnTransmitSpecialFrame = NULL;
  47. hInst = LoadLibrary ("NAL.DLL" );
  48. if (hInst)
  49. lpfnTransmitSpecialFrame = (TRANSMITSPECIALFRAME_FN)GetProcAddress ( hInst, "TransmitSpecialFrame" );
  50. if (( hInst==NULL ) || ( lpfnTransmitSpecialFrame==NULL) )
  51. {
  52. ...
  53. }
  54. usage:
  55. lpfnTransmitSpecialFrame( FRAME_TYPE_COMMENT, 0, (unsigned char *)pStr, strlen(pStr)+1 );
  56. Contacts:
  57. Flex Dolphynn (a-FlexD)
  58. Steve Hiskey (SteveHi)
  59. Arthur Brooking (ArthurB)
  60. --*/
  61. #ifndef _INSERTFRAME_
  62. #define _INSERTFRAME_
  63. #if _MSC_VER > 1000
  64. #pragma once
  65. #endif
  66. // VALUES BELOW 100 ARE FOR FUTURE NETMON USE
  67. // VALUES 100 - 1000 ARE FOR INTERNAL MICROSOFT USE
  68. // VALUES ABOVE 1000 ARE FOR USER-DEFINED TYPES
  69. #define FRAME_TYPE_GENERIC 101
  70. #define FRAME_TYPE_BOOKMARK 102
  71. #define FRAME_TYPE_STATISTICS 103
  72. #define FRAME_TYPE_ODBC 104
  73. #define FRAME_TYPE_MESSAGE 105
  74. #define FRAME_TYPE_COMMENT 106
  75. // FLAGS FOR INSERTSPECIALFRAME
  76. // THIS FLAG WILL CAUSE THE FRAME IT IS APPLIED TO TO BE SKIPPED AS AN ENDPOINT
  77. // FOR THE GENERATED STATISTICS
  78. #define SPECIALFLAG_SKIPSTAT 0x0001
  79. // THIS FLAG WILL CAUSE THE GENERATED STATISTICS TO ONLY TAKE
  80. // INTO CONSIDERATION THSE FRAMES WHICH PASS THE CURRENT FILTER
  81. #define SPECIALFLAG_FILTERSTAT 0x0002
  82. #ifdef __cplusplus
  83. extern "C" {
  84. #endif
  85. VOID WINAPI TransmitSpecialFrame( DWORD FrameType, DWORD Flags, LPBYTE pUserData, DWORD UserDataLength);
  86. // FUNCTION POINTER DEFINITION FOR GETPROCADDRESS
  87. typedef VOID (_stdcall * TRANSMITSPECIALFRAME_FN)(DWORD, DWORD, LPBYTE, DWORD);
  88. #ifdef __cplusplus
  89. }
  90. #endif
  91. #endif