mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
Added new library packet.dll
svn path=/trunk/; revision=3128
This commit is contained in:
parent
0f848a3fd1
commit
a493f4baea
9 changed files with 3224 additions and 0 deletions
1411
reactos/lib/packet/Packet32.c
Normal file
1411
reactos/lib/packet/Packet32.c
Normal file
File diff suppressed because it is too large
Load diff
90
reactos/lib/packet/include/Devioctl.h_old
Normal file
90
reactos/lib/packet/include/Devioctl.h_old
Normal file
|
@ -0,0 +1,90 @@
|
|||
/*++ BUILD Version: 0004 // Increment this if a change has global effects
|
||||
Copyright (c) 1992-1993 Microsoft Corporation
|
||||
Module Name:
|
||||
devioctl.h
|
||||
Revision History:
|
||||
-- */
|
||||
// begin_winioctl
|
||||
#ifndef _DEVIOCTL_
|
||||
#define _DEVIOCTL_
|
||||
// begin_ntddk begin_nthal begin_ntifs
|
||||
//
|
||||
// Define the various device type values. Note that values used by Microsoft
|
||||
// Corporation are in the range 0-32767, and 32768-65535 are reserved for use
|
||||
// by customers.
|
||||
//
|
||||
#define DEVICE_TYPE ULONG
|
||||
#define FILE_DEVICE_BEEP 0x00000001
|
||||
#define FILE_DEVICE_CD_ROM 0x00000002
|
||||
#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003
|
||||
#define FILE_DEVICE_CONTROLLER 0x00000004
|
||||
#define FILE_DEVICE_DATALINK 0x00000005
|
||||
#define FILE_DEVICE_DFS 0x00000006
|
||||
#define FILE_DEVICE_DISK 0x00000007
|
||||
#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008
|
||||
#define FILE_DEVICE_FILE_SYSTEM 0x00000009
|
||||
#define FILE_DEVICE_INPORT_PORT 0x0000000a
|
||||
#define FILE_DEVICE_KEYBOARD 0x0000000b
|
||||
#define FILE_DEVICE_MAILSLOT 0x0000000c
|
||||
#define FILE_DEVICE_MIDI_IN 0x0000000d
|
||||
#define FILE_DEVICE_MIDI_OUT 0x0000000e
|
||||
#define FILE_DEVICE_MOUSE 0x0000000f
|
||||
#define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010
|
||||
#define FILE_DEVICE_NAMED_PIPE 0x00000011
|
||||
#define FILE_DEVICE_NETWORK 0x00000012
|
||||
#define FILE_DEVICE_NETWORK_BROWSER 0x00000013
|
||||
#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014
|
||||
#define FILE_DEVICE_NULL 0x00000015
|
||||
#define FILE_DEVICE_PARALLEL_PORT 0x00000016
|
||||
#define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017
|
||||
#define FILE_DEVICE_PRINTER 0x00000018
|
||||
#define FILE_DEVICE_SCANNER 0x00000019
|
||||
#define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a
|
||||
#define FILE_DEVICE_SERIAL_PORT 0x0000001b
|
||||
#define FILE_DEVICE_SCREEN 0x0000001c
|
||||
#define FILE_DEVICE_SOUND 0x0000001d
|
||||
#define FILE_DEVICE_STREAMS 0x0000001e
|
||||
#define FILE_DEVICE_TAPE 0x0000001f
|
||||
#define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020
|
||||
#define FILE_DEVICE_TRANSPORT 0x00000021
|
||||
#define FILE_DEVICE_UNKNOWN 0x00000022
|
||||
#define FILE_DEVICE_VIDEO 0x00000023
|
||||
#define FILE_DEVICE_VIRTUAL_DISK 0x00000024
|
||||
#define FILE_DEVICE_WAVE_IN 0x00000025
|
||||
#define FILE_DEVICE_WAVE_OUT 0x00000026
|
||||
#define FILE_DEVICE_8042_PORT 0x00000027
|
||||
#define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028
|
||||
#define FILE_DEVICE_BATTERY 0x00000029
|
||||
#define FILE_DEVICE_BUS_EXTENDER 0x0000002a
|
||||
#define FILE_DEVICE_MODEM 0x0000002b
|
||||
#define FILE_DEVICE_VDM 0x0000002c
|
||||
#define FILE_DEVICE_MASS_STORAGE 0x0000002d
|
||||
//
|
||||
// Macro definition for defining IOCTL and FSCTL function control codes. Note
|
||||
// that function codes 0-2047 are reserved for Microsoft Corporation, and
|
||||
// 2048-4095 are reserved for customers.
|
||||
//
|
||||
#define CTL_CODE( DeviceType, Function, Method, Access ) ( \
|
||||
((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \
|
||||
)
|
||||
//
|
||||
// Define the method codes for how buffers are passed for I/O and FS controls
|
||||
//
|
||||
#define METHOD_BUFFERED 0
|
||||
#define METHOD_IN_DIRECT 1
|
||||
#define METHOD_OUT_DIRECT 2
|
||||
#define METHOD_NEITHER 3
|
||||
//
|
||||
// Define the access check value for any access
|
||||
//
|
||||
//
|
||||
// The FILE_READ_ACCESS and FILE_WRITE_ACCESS constants are also defined in
|
||||
// ntioapi.h as FILE_READ_DATA and FILE_WRITE_DATA. The values for these
|
||||
// constants *MUST* always be in sync.
|
||||
//
|
||||
#define FILE_ANY_ACCESS 0
|
||||
#define FILE_READ_ACCESS ( 0x0001 ) // file & pipe
|
||||
#define FILE_WRITE_ACCESS ( 0x0002 ) // file & pipe
|
||||
// end_ntddk end_nthal end_ntifs
|
||||
#endif // _DEVIOCTL_
|
||||
// end_winioctl
|
1400
reactos/lib/packet/include/Ntddndis.h_old
Normal file
1400
reactos/lib/packet/include/Ntddndis.h_old
Normal file
File diff suppressed because it is too large
Load diff
179
reactos/lib/packet/include/Packet32.h_rex
Normal file
179
reactos/lib/packet/include/Packet32.h_rex
Normal file
|
@ -0,0 +1,179 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2000
|
||||
* Politecnico di Torino. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code distributions
|
||||
* retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
* distributions including binary code include the above copyright notice and
|
||||
* this paragraph in its entirety in the documentation or other materials
|
||||
* provided with the distribution, and (3) all advertising materials mentioning
|
||||
* features or use of this software display the following acknowledgement:
|
||||
* ``This product includes software developed by the Politecnico
|
||||
* di Torino, and its contributors.'' Neither the name of
|
||||
* the University nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifndef __PACKET32
|
||||
#define __PACKET32
|
||||
|
||||
#include <winsock2.h>
|
||||
#include "devioctl.h"
|
||||
|
||||
// Working modes
|
||||
#define PACKET_MODE_CAPT 0x0 ///< Capture mode
|
||||
#define PACKET_MODE_STAT 0x1 ///< Statistical mode
|
||||
#define PACKET_MODE_DUMP 0x10 ///< Dump mode
|
||||
#define PACKET_MODE_STAT_DUMP MODE_DUMP | MODE_STAT ///< Statistical dump Mode
|
||||
|
||||
// ioctls
|
||||
#define FILE_DEVICE_PROTOCOL 0x8000
|
||||
|
||||
#define IOCTL_PROTOCOL_STATISTICS CTL_CODE(FILE_DEVICE_PROTOCOL, 2 , METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
#define IOCTL_PROTOCOL_RESET CTL_CODE(FILE_DEVICE_PROTOCOL, 3 , METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
#define IOCTL_PROTOCOL_READ CTL_CODE(FILE_DEVICE_PROTOCOL, 4 , METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
#define IOCTL_PROTOCOL_WRITE CTL_CODE(FILE_DEVICE_PROTOCOL, 5 , METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
#define IOCTL_PROTOCOL_MACNAME CTL_CODE(FILE_DEVICE_PROTOCOL, 6 , METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
#define IOCTL_OPEN CTL_CODE(FILE_DEVICE_PROTOCOL, 7 , METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
#define IOCTL_CLOSE CTL_CODE(FILE_DEVICE_PROTOCOL, 8 , METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
|
||||
#define pBIOCSETBUFFERSIZE 9592
|
||||
#define pBIOCSETF 9030
|
||||
#define pBIOCGSTATS 9031
|
||||
#define pBIOCSRTIMEOUT 7416
|
||||
#define pBIOCSMODE 7412
|
||||
#define pBIOCSWRITEREP 7413
|
||||
#define pBIOCSMINTOCOPY 7414
|
||||
#define pBIOCSETOID 2147483648
|
||||
#define pBIOCQUERYOID 2147483652
|
||||
#define pATTACHPROCESS 7117
|
||||
#define pDETACHPROCESS 7118
|
||||
#define pBIOCSETDUMPFILENAME 9029
|
||||
#define pBIOCEVNAME 7415
|
||||
|
||||
#define pBIOCSTIMEZONE 7471
|
||||
|
||||
// Alignment macros. Packet_WORDALIGN rounds up to the next
|
||||
// even multiple of Packet_ALIGNMENT.
|
||||
#define Packet_ALIGNMENT sizeof(int)
|
||||
#define Packet_WORDALIGN(x) (((x)+(Packet_ALIGNMENT-1))&~(Packet_ALIGNMENT-1))
|
||||
|
||||
typedef struct NetType
|
||||
{
|
||||
UINT LinkType;
|
||||
UINT LinkSpeed;
|
||||
}NetType;
|
||||
|
||||
|
||||
//some definitions stolen from libpcap
|
||||
|
||||
#ifndef BPF_MAJOR_VERSION
|
||||
|
||||
struct bpf_program {
|
||||
UINT bf_len;
|
||||
struct bpf_insn *bf_insns;
|
||||
};
|
||||
|
||||
struct bpf_insn {
|
||||
USHORT code;
|
||||
UCHAR jt;
|
||||
UCHAR jf;
|
||||
int k;
|
||||
};
|
||||
|
||||
struct bpf_stat {
|
||||
UINT bs_recv;
|
||||
|
||||
|
||||
UINT bs_drop;
|
||||
|
||||
|
||||
};
|
||||
|
||||
struct bpf_hdr {
|
||||
struct timeval bh_tstamp;
|
||||
UINT bh_caplen;
|
||||
UINT bh_datalen;
|
||||
USHORT bh_hdrlen;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#define DOSNAMEPREFIX TEXT("Packet_")
|
||||
#define MAX_LINK_NAME_LENGTH 64
|
||||
#define NMAX_PACKET 65535
|
||||
|
||||
typedef struct _ADAPTER {
|
||||
HANDLE hFile;
|
||||
TCHAR SymbolicLink[MAX_LINK_NAME_LENGTH];
|
||||
int NumWrites;
|
||||
HANDLE ReadEvent;
|
||||
UINT ReadTimeOut;
|
||||
} ADAPTER, *LPADAPTER;
|
||||
|
||||
typedef struct _PACKET {
|
||||
HANDLE hEvent;
|
||||
OVERLAPPED OverLapped;
|
||||
PVOID Buffer;
|
||||
UINT Length;
|
||||
UINT ulBytesReceived;
|
||||
BOOLEAN bIoComplete;
|
||||
} PACKET, *LPPACKET;
|
||||
|
||||
struct _PACKET_OID_DATA {
|
||||
ULONG Oid;
|
||||
ULONG Length;
|
||||
UCHAR Data[1];
|
||||
|
||||
};
|
||||
typedef struct _PACKET_OID_DATA PACKET_OID_DATA, *PPACKET_OID_DATA;
|
||||
|
||||
typedef struct npf_if_addr {
|
||||
struct sockaddr IPAddress;
|
||||
struct sockaddr SubnetMask;
|
||||
struct sockaddr Broadcast;
|
||||
}npf_if_addr;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// FUNCTIONS
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
PCHAR PacketGetVersion();
|
||||
BOOLEAN PacketSetMinToCopy(LPADAPTER AdapterObject,int nbytes);
|
||||
BOOLEAN PacketSetNumWrites(LPADAPTER AdapterObject,int nwrites);
|
||||
BOOLEAN PacketSetMode(LPADAPTER AdapterObject,int mode);
|
||||
BOOLEAN PacketSetReadTimeout(LPADAPTER AdapterObject,int timeout);
|
||||
BOOLEAN PacketSetBpf(LPADAPTER AdapterObject,struct bpf_program *fp);
|
||||
BOOLEAN PacketGetStats(LPADAPTER AdapterObject,struct bpf_stat *s);
|
||||
BOOLEAN PacketSetBuff(LPADAPTER AdapterObject,int dim);
|
||||
BOOLEAN PacketGetNetType (LPADAPTER AdapterObject,NetType *type);
|
||||
LPADAPTER PacketOpenAdapter(LPTSTR AdapterName);
|
||||
BOOLEAN PacketSendPacket(LPADAPTER AdapterObject,LPPACKET pPacket,BOOLEAN Sync);
|
||||
LPPACKET PacketAllocatePacket(void);
|
||||
VOID PacketInitPacket(LPPACKET lpPacket,PVOID Buffer,UINT Length);
|
||||
VOID PacketFreePacket(LPPACKET lpPacket);
|
||||
BOOLEAN PacketReceivePacket(LPADAPTER AdapterObject,LPPACKET lpPacket,BOOLEAN Sync);
|
||||
BOOLEAN PacketSetHwFilter(LPADAPTER AdapterObject,ULONG Filter);
|
||||
BOOLEAN PacketGetAdapterNames(PTSTR pStr,PULONG BufferSize);
|
||||
BOOLEAN PacketGetNetInfo(LPTSTR AdapterName, PULONG netp, PULONG maskp);
|
||||
BOOLEAN PacketGetNetInfoEx(LPTSTR AdapterName, npf_if_addr* buffer, PLONG NEntries);
|
||||
BOOLEAN PacketRequest(LPADAPTER AdapterObject,BOOLEAN Set,PPACKET_OID_DATA OidData);
|
||||
HANDLE PacketGetReadEvent(LPADAPTER AdapterObject);
|
||||
BOOLEAN PacketSetDumpName(LPADAPTER AdapterObject, void *name, int len);
|
||||
BOOL PacketStopDriver();
|
||||
VOID PacketCloseAdapter(LPADAPTER lpAdapter);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //__PACKET32
|
24
reactos/lib/packet/makefile
Normal file
24
reactos/lib/packet/makefile
Normal file
|
@ -0,0 +1,24 @@
|
|||
# $Id: makefile,v 1.1 2002/06/19 15:50:29 robd Exp $
|
||||
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
TARGET_TYPE = dynlink
|
||||
|
||||
TARGET_NAME = packet
|
||||
|
||||
TARGET_BASE = 0x77780000
|
||||
|
||||
TARGET_CFLAGS = -I./include -DUNICODE -DLE -DDBG
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a kernel32.a advapi32.a
|
||||
|
||||
TARGET_OBJECTS = \
|
||||
Packet32.o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
TARGET_CLEAN = misc/*.o
|
||||
|
||||
# EOF
|
29
reactos/lib/packet/packet.def
Normal file
29
reactos/lib/packet/packet.def
Normal file
|
@ -0,0 +1,29 @@
|
|||
LIBRARY packet
|
||||
|
||||
DESCRIPTION 'Packet driver dll'
|
||||
|
||||
EXPORTS
|
||||
PacketLibraryVersion
|
||||
PacketGetVersion
|
||||
PacketOpenAdapter
|
||||
PacketSendPacket
|
||||
PacketAllocatePacket
|
||||
PacketInitPacket
|
||||
PacketFreePacket
|
||||
PacketReceivePacket
|
||||
PacketCloseAdapter
|
||||
PacketSetHwFilter
|
||||
PacketGetAdapterNames
|
||||
PacketRequest
|
||||
PacketSetBuff
|
||||
PacketSetBpf
|
||||
PacketGetStats
|
||||
PacketGetNetType
|
||||
PacketSetReadTimeout
|
||||
PacketSetMode
|
||||
PacketSetNumWrites
|
||||
PacketGetNetInfo
|
||||
PacketGetNetInfoEx
|
||||
PacketSetMinToCopy
|
||||
PacketGetReadEvent
|
||||
PacketStopDriver
|
32
reactos/lib/packet/packet.edf
Normal file
32
reactos/lib/packet/packet.edf
Normal file
|
@ -0,0 +1,32 @@
|
|||
; PACKET.DLL - Windows Packet Capture DLL
|
||||
|
||||
LIBRARY packet.dll
|
||||
|
||||
EXPORTS
|
||||
;WEP
|
||||
PacketLibraryVersion=PacketLibraryVersion
|
||||
PacketGetVersion=PacketGetVersion
|
||||
PacketOpenAdapter=PacketOpenAdapter
|
||||
PacketSendPacket=PacketSendPacket
|
||||
PacketAllocatePacket=PacketAllocatePacket
|
||||
PacketInitPacket=PacketInitPacket
|
||||
PacketFreePacket=PacketFreePacket
|
||||
PacketReceivePacket=PacketReceivePacket
|
||||
PacketCloseAdapter=PacketCloseAdapter
|
||||
PacketSetHwFilter=PacketSetHwFilter
|
||||
PacketGetAdapterNames=PacketGetAdapterNames
|
||||
PacketRequest=PacketRequest
|
||||
PacketSetBuff=PacketSetBuff
|
||||
PacketSetBpf=PacketSetBpf
|
||||
PacketGetStats=PacketGetStats
|
||||
PacketGetNetType=PacketGetNetType
|
||||
PacketSetReadTimeout=PacketSetReadTimeout
|
||||
PacketSetMode=PacketSetMode
|
||||
PacketSetNumWrites=PacketSetNumWrites
|
||||
PacketGetNetInfo=PacketGetNetInfo
|
||||
PacketGetNetInfoEx=PacketGetNetInfoEx
|
||||
PacketSetMinToCopy=PacketSetMinToCopy
|
||||
PacketGetReadEvent=PacketGetReadEvent
|
||||
PacketStopDriver=PacketStopDriver
|
||||
|
||||
; EOF
|
44
reactos/lib/packet/packet.rc
Normal file
44
reactos/lib/packet/packet.rc
Normal file
|
@ -0,0 +1,44 @@
|
|||
#include "resource.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 2,3,0,33
|
||||
PRODUCTVERSION 2,3,0,33
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "WinPcap low level packet library\0"
|
||||
VALUE "CompanyName", "Politecnico di Torino\0"
|
||||
VALUE "FileDescription", "Packet\0"
|
||||
VALUE "FileVersion", "2, 3, 0, 33\0"
|
||||
VALUE "InternalName", "Packet\0"
|
||||
VALUE "LegalCopyright", "Copyright © 1999-2002\0"
|
||||
VALUE "LegalTrademarks", "\0"
|
||||
VALUE "OriginalFilename", "Packet.dll\0"
|
||||
VALUE "PrivateBuild", "\0"
|
||||
VALUE "ProductName", "WinPcap low level packet library\0"
|
||||
VALUE "ProductVersion", "2, 3, 0, 33\0"
|
||||
VALUE "SpecialBuild", "\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
15
reactos/lib/packet/resource.h
Normal file
15
reactos/lib/packet/resource.h
Normal file
|
@ -0,0 +1,15 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by version.rc
|
||||
//
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
Loading…
Reference in a new issue