netkitty 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +53 -0
- package/.idea/codeStyles/Project.xml +18 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/inspectionProfiles/Project_Default.xml +10 -0
- package/.idea/modules.xml +8 -0
- package/.idea/netkitty.iml +13 -0
- package/.idea/vcs.xml +6 -0
- package/LICENSE +21 -0
- package/README.md +2 -0
- package/binding.gyp +5 -0
- package/build/NetKitty.d.ts +31 -0
- package/build/NetKitty.d.ts.map +1 -0
- package/build/NetKitty.js +33 -0
- package/build/errors/ActionNotFoundError.d.ts +5 -0
- package/build/errors/ActionNotFoundError.d.ts.map +1 -0
- package/build/errors/ActionNotFoundError.js +12 -0
- package/build/errors/CodecSchemaValidateError.d.ts +5 -0
- package/build/errors/CodecSchemaValidateError.d.ts.map +1 -0
- package/build/errors/CodecSchemaValidateError.js +12 -0
- package/build/errors/DeviceNotFoundError.d.ts +5 -0
- package/build/errors/DeviceNotFoundError.d.ts.map +1 -0
- package/build/errors/DeviceNotFoundError.js +12 -0
- package/build/errors/NoAvailableCodecError.d.ts +5 -0
- package/build/errors/NoAvailableCodecError.d.ts.map +1 -0
- package/build/errors/NoAvailableCodecError.js +12 -0
- package/build/errors/NpcapLoadError.d.ts +5 -0
- package/build/errors/NpcapLoadError.d.ts.map +1 -0
- package/build/errors/NpcapLoadError.js +12 -0
- package/build/errors/SocketDownError.d.ts +5 -0
- package/build/errors/SocketDownError.d.ts.map +1 -0
- package/build/errors/SocketDownError.js +12 -0
- package/build/errors/UnknownPipeMessageTypeError.d.ts +5 -0
- package/build/errors/UnknownPipeMessageTypeError.d.ts.map +1 -0
- package/build/errors/UnknownPipeMessageTypeError.js +12 -0
- package/build/errors/common/ErrorCode.d.ts +31 -0
- package/build/errors/common/ErrorCode.d.ts.map +1 -0
- package/build/errors/common/ErrorCode.js +33 -0
- package/build/lib/GeneratePipeAddress.d.ts +7 -0
- package/build/lib/GeneratePipeAddress.d.ts.map +1 -0
- package/build/lib/GeneratePipeAddress.js +23 -0
- package/build/lib/GetBinding.d.ts +2 -0
- package/build/lib/GetBinding.d.ts.map +1 -0
- package/build/lib/GetBinding.js +6 -0
- package/build/lib/GetCaptureTemporaryDirectory.d.ts +7 -0
- package/build/lib/GetCaptureTemporaryDirectory.d.ts.map +1 -0
- package/build/lib/GetCaptureTemporaryDirectory.js +15 -0
- package/build/lib/GetDeviceCaptureTemporaryFilename.d.ts +8 -0
- package/build/lib/GetDeviceCaptureTemporaryFilename.d.ts.map +1 -0
- package/build/lib/GetDeviceCaptureTemporaryFilename.js +18 -0
- package/build/lib/codec/Codec.d.ts +33 -0
- package/build/lib/codec/Codec.d.ts.map +1 -0
- package/build/lib/codec/Codec.js +166 -0
- package/build/lib/codec/abstracts/BaseHeader.d.ts +204 -0
- package/build/lib/codec/abstracts/BaseHeader.d.ts.map +1 -0
- package/build/lib/codec/abstracts/BaseHeader.js +339 -0
- package/build/lib/codec/headers/ARP.d.ts +9 -0
- package/build/lib/codec/headers/ARP.d.ts.map +1 -0
- package/build/lib/codec/headers/ARP.js +223 -0
- package/build/lib/codec/headers/EthernetII.d.ts +9 -0
- package/build/lib/codec/headers/EthernetII.d.ts.map +1 -0
- package/build/lib/codec/headers/EthernetII.js +80 -0
- package/build/lib/codec/headers/Goose.d.ts +12 -0
- package/build/lib/codec/headers/Goose.d.ts.map +1 -0
- package/build/lib/codec/headers/Goose.js +701 -0
- package/build/lib/codec/headers/IEC61850SampledValues.d.ts +12 -0
- package/build/lib/codec/headers/IEC61850SampledValues.d.ts.map +1 -0
- package/build/lib/codec/headers/IEC61850SampledValues.js +369 -0
- package/build/lib/codec/headers/IPv4.d.ts +15 -0
- package/build/lib/codec/headers/IPv4.d.ts.map +1 -0
- package/build/lib/codec/headers/IPv4.js +338 -0
- package/build/lib/codec/headers/RawData.d.ts +9 -0
- package/build/lib/codec/headers/RawData.d.ts.map +1 -0
- package/build/lib/codec/headers/RawData.js +34 -0
- package/build/lib/codec/headers/TCP.d.ts +15 -0
- package/build/lib/codec/headers/TCP.d.ts.map +1 -0
- package/build/lib/codec/headers/TCP.js +897 -0
- package/build/lib/codec/headers/UDP.d.ts +15 -0
- package/build/lib/codec/headers/UDP.d.ts.map +1 -0
- package/build/lib/codec/headers/UDP.js +191 -0
- package/build/lib/codec/headers/VLAN_802dot1Q.d.ts +9 -0
- package/build/lib/codec/headers/VLAN_802dot1Q.d.ts.map +1 -0
- package/build/lib/codec/headers/VLAN_802dot1Q.js +77 -0
- package/build/lib/codec/lib/BufferToHex.d.ts +2 -0
- package/build/lib/codec/lib/BufferToHex.d.ts.map +1 -0
- package/build/lib/codec/lib/BufferToHex.js +6 -0
- package/build/lib/codec/lib/BufferToIP.d.ts +13 -0
- package/build/lib/codec/lib/BufferToIP.d.ts.map +1 -0
- package/build/lib/codec/lib/BufferToIP.js +21 -0
- package/build/lib/codec/lib/BufferToNumber.d.ts +10 -0
- package/build/lib/codec/lib/BufferToNumber.d.ts.map +1 -0
- package/build/lib/codec/lib/BufferToNumber.js +22 -0
- package/build/lib/codec/lib/FixHexString.d.ts +7 -0
- package/build/lib/codec/lib/FixHexString.d.ts.map +1 -0
- package/build/lib/codec/lib/FixHexString.js +11 -0
- package/build/lib/codec/lib/FlexibleObject.d.ts +28 -0
- package/build/lib/codec/lib/FlexibleObject.d.ts.map +1 -0
- package/build/lib/codec/lib/FlexibleObject.js +102 -0
- package/build/lib/codec/lib/HexToNumber.d.ts +10 -0
- package/build/lib/codec/lib/HexToNumber.d.ts.map +1 -0
- package/build/lib/codec/lib/HexToNumber.js +39 -0
- package/build/lib/codec/lib/IPToBuffer.d.ts +13 -0
- package/build/lib/codec/lib/IPToBuffer.d.ts.map +1 -0
- package/build/lib/codec/lib/IPToBuffer.js +28 -0
- package/build/lib/codec/lib/NumberToBERBuffer.d.ts +9 -0
- package/build/lib/codec/lib/NumberToBERBuffer.d.ts.map +1 -0
- package/build/lib/codec/lib/NumberToBERBuffer.js +20 -0
- package/build/lib/codec/lib/NumberToBERHex.d.ts +9 -0
- package/build/lib/codec/lib/NumberToBERHex.d.ts.map +1 -0
- package/build/lib/codec/lib/NumberToBERHex.js +23 -0
- package/build/lib/codec/lib/NumberToBuffer.d.ts +10 -0
- package/build/lib/codec/lib/NumberToBuffer.d.ts.map +1 -0
- package/build/lib/codec/lib/NumberToBuffer.js +22 -0
- package/build/lib/codec/lib/NumberToHex.d.ts +10 -0
- package/build/lib/codec/lib/NumberToHex.d.ts.map +1 -0
- package/build/lib/codec/lib/NumberToHex.js +26 -0
- package/build/lib/codec/lib/ProcessPacketPostHandlers.d.ts +14 -0
- package/build/lib/codec/lib/ProcessPacketPostHandlers.d.ts.map +1 -0
- package/build/lib/codec/lib/ProcessPacketPostHandlers.js +53 -0
- package/build/lib/codec/lib/SortPostHandlers.d.ts +8 -0
- package/build/lib/codec/lib/SortPostHandlers.d.ts.map +1 -0
- package/build/lib/codec/lib/SortPostHandlers.js +11 -0
- package/build/lib/codec/lib/StringContentEncodingEnum.d.ts +8 -0
- package/build/lib/codec/lib/StringContentEncodingEnum.d.ts.map +1 -0
- package/build/lib/codec/lib/StringContentEncodingEnum.js +11 -0
- package/build/lib/codec/types/CodecData.d.ts +7 -0
- package/build/lib/codec/types/CodecData.d.ts.map +1 -0
- package/build/lib/codec/types/CodecData.js +2 -0
- package/build/lib/codec/types/CodecDecodeResult.d.ts +9 -0
- package/build/lib/codec/types/CodecDecodeResult.d.ts.map +1 -0
- package/build/lib/codec/types/CodecDecodeResult.js +2 -0
- package/build/lib/codec/types/CodecEncodeInput.d.ts +5 -0
- package/build/lib/codec/types/CodecEncodeInput.d.ts.map +1 -0
- package/build/lib/codec/types/CodecEncodeInput.js +2 -0
- package/build/lib/codec/types/CodecEncodeResult.d.ts +6 -0
- package/build/lib/codec/types/CodecEncodeResult.d.ts.map +1 -0
- package/build/lib/codec/types/CodecEncodeResult.js +2 -0
- package/build/lib/codec/types/CodecErrorInfo.d.ts +6 -0
- package/build/lib/codec/types/CodecErrorInfo.d.ts.map +1 -0
- package/build/lib/codec/types/CodecErrorInfo.js +2 -0
- package/build/lib/codec/types/CodecModule.d.ts +3 -0
- package/build/lib/codec/types/CodecModule.d.ts.map +1 -0
- package/build/lib/codec/types/CodecModule.js +2 -0
- package/build/lib/codec/types/CodecModuleConstructor.d.ts +3 -0
- package/build/lib/codec/types/CodecModuleConstructor.d.ts.map +1 -0
- package/build/lib/codec/types/CodecModuleConstructor.js +2 -0
- package/build/lib/codec/types/CodecSchema.d.ts +7 -0
- package/build/lib/codec/types/CodecSchema.d.ts.map +1 -0
- package/build/lib/codec/types/CodecSchema.js +2 -0
- package/build/lib/codec/types/HeaderTreeNode.d.ts +5 -0
- package/build/lib/codec/types/HeaderTreeNode.d.ts.map +1 -0
- package/build/lib/codec/types/HeaderTreeNode.js +2 -0
- package/build/lib/codec/types/PostHandlerItem.d.ts +5 -0
- package/build/lib/codec/types/PostHandlerItem.d.ts.map +1 -0
- package/build/lib/codec/types/PostHandlerItem.js +2 -0
- package/build/lib/nodepcap/Capture.d.ts +75 -0
- package/build/lib/nodepcap/Capture.d.ts.map +1 -0
- package/build/lib/nodepcap/Capture.js +309 -0
- package/build/lib/nodepcap/GetNetworkInterfaces.d.ts +7 -0
- package/build/lib/nodepcap/GetNetworkInterfaces.d.ts.map +1 -0
- package/build/lib/nodepcap/GetNetworkInterfaces.js +22 -0
- package/build/lib/nodepcap/interfaces/IBindingCapture.d.ts +16 -0
- package/build/lib/nodepcap/interfaces/IBindingCapture.d.ts.map +1 -0
- package/build/lib/nodepcap/interfaces/IBindingCapture.js +2 -0
- package/build/lib/nodepcap/interfaces/IBindingCaptureOptions.d.ts +5 -0
- package/build/lib/nodepcap/interfaces/IBindingCaptureOptions.d.ts.map +1 -0
- package/build/lib/nodepcap/interfaces/IBindingCaptureOptions.js +2 -0
- package/build/lib/nodepcap/interfaces/ICaptureOptions.d.ts +19 -0
- package/build/lib/nodepcap/interfaces/ICaptureOptions.d.ts.map +1 -0
- package/build/lib/nodepcap/interfaces/ICaptureOptions.js +2 -0
- package/build/lib/nodepcap/interfaces/INetworkInterface.d.ts +5 -0
- package/build/lib/nodepcap/interfaces/INetworkInterface.d.ts.map +1 -0
- package/build/lib/nodepcap/interfaces/INetworkInterface.js +2 -0
- package/build/lib/nodepcap/lib/BindingCapture.d.ts +15 -0
- package/build/lib/nodepcap/lib/BindingCapture.d.ts.map +1 -0
- package/build/lib/nodepcap/lib/BindingCapture.js +35 -0
- package/build/lib/nodepcap/lib/GetNodePcapBinding.d.ts +2 -0
- package/build/lib/nodepcap/lib/GetNodePcapBinding.d.ts.map +1 -0
- package/build/lib/nodepcap/lib/GetNodePcapBinding.js +55 -0
- package/build/lib/nodepcap/lib/GetNodePcapBindingCapture.d.ts +3 -0
- package/build/lib/nodepcap/lib/GetNodePcapBindingCapture.d.ts.map +1 -0
- package/build/lib/nodepcap/lib/GetNodePcapBindingCapture.js +18 -0
- package/build/lib/nodepcap/workers/CaptureWorker.d.ts +2 -0
- package/build/lib/nodepcap/workers/CaptureWorker.d.ts.map +1 -0
- package/build/lib/nodepcap/workers/CaptureWorker.js +25 -0
- package/build/lib/pcap/PCAPGenerator.d.ts +34 -0
- package/build/lib/pcap/PCAPGenerator.d.ts.map +1 -0
- package/build/lib/pcap/PCAPGenerator.js +95 -0
- package/build/lib/pcap/PcapParser.d.ts +27 -0
- package/build/lib/pcap/PcapParser.d.ts.map +1 -0
- package/build/lib/pcap/PcapParser.js +149 -0
- package/build/lib/pcap/PcapReader.d.ts +87 -0
- package/build/lib/pcap/PcapReader.d.ts.map +1 -0
- package/build/lib/pcap/PcapReader.js +207 -0
- package/build/lib/pcap/PcapWriter.d.ts +29 -0
- package/build/lib/pcap/PcapWriter.d.ts.map +1 -0
- package/build/lib/pcap/PcapWriter.js +80 -0
- package/build/lib/pcap/interfaces/IPcapPacketInfo.d.ts +13 -0
- package/build/lib/pcap/interfaces/IPcapPacketInfo.d.ts.map +1 -0
- package/build/lib/pcap/interfaces/IPcapPacketInfo.js +2 -0
- package/build/lib/pipe/PipeClient.d.ts +35 -0
- package/build/lib/pipe/PipeClient.d.ts.map +1 -0
- package/build/lib/pipe/PipeClient.js +71 -0
- package/build/lib/pipe/PipeClientSocket.d.ts +39 -0
- package/build/lib/pipe/PipeClientSocket.d.ts.map +1 -0
- package/build/lib/pipe/PipeClientSocket.js +82 -0
- package/build/lib/pipe/PipeMessage.d.ts +27 -0
- package/build/lib/pipe/PipeMessage.d.ts.map +1 -0
- package/build/lib/pipe/PipeMessage.js +61 -0
- package/build/lib/pipe/PipeMessageHandler.d.ts +16 -0
- package/build/lib/pipe/PipeMessageHandler.d.ts.map +1 -0
- package/build/lib/pipe/PipeMessageHandler.js +95 -0
- package/build/lib/pipe/PipeServer.d.ts +25 -0
- package/build/lib/pipe/PipeServer.d.ts.map +1 -0
- package/build/lib/pipe/PipeServer.js +59 -0
- package/build/lib/schema/ProtocolFieldJSONSchema.d.ts +35 -0
- package/build/lib/schema/ProtocolFieldJSONSchema.d.ts.map +1 -0
- package/build/lib/schema/ProtocolFieldJSONSchema.js +2 -0
- package/build/lib/schema/ProtocolFieldJSONSchemaDefinition.d.ts +3 -0
- package/build/lib/schema/ProtocolFieldJSONSchemaDefinition.d.ts.map +1 -0
- package/build/lib/schema/ProtocolFieldJSONSchemaDefinition.js +2 -0
- package/build/lib/schema/ProtocolJSONSchema.d.ts +32 -0
- package/build/lib/schema/ProtocolJSONSchema.d.ts.map +1 -0
- package/build/lib/schema/ProtocolJSONSchema.js +2 -0
- package/build/tests/Test.spec.d.ts +2 -0
- package/build/tests/Test.spec.d.ts.map +1 -0
- package/build/tests/Test.spec.js +25 -0
- package/build/tests/units/CaptureTest.spec.d.ts +2 -0
- package/build/tests/units/CaptureTest.spec.d.ts.map +1 -0
- package/build/tests/units/CaptureTest.spec.js +31 -0
- package/build/tests/units/Codec.spec.d.ts +2 -0
- package/build/tests/units/Codec.spec.d.ts.map +1 -0
- package/build/tests/units/Codec.spec.js +70 -0
- package/cpp/nodepcap/deps/include/Packet32.h +429 -0
- package/cpp/nodepcap/deps/include/pcap/bluetooth.h +56 -0
- package/cpp/nodepcap/deps/include/pcap/bpf.h +292 -0
- package/cpp/nodepcap/deps/include/pcap/can_socketcan.h +56 -0
- package/cpp/nodepcap/deps/include/pcap/compiler-tests.h +163 -0
- package/cpp/nodepcap/deps/include/pcap/dlt.h +1514 -0
- package/cpp/nodepcap/deps/include/pcap/funcattrs.h +325 -0
- package/cpp/nodepcap/deps/include/pcap/ipnet.h +43 -0
- package/cpp/nodepcap/deps/include/pcap/namedb.h +84 -0
- package/cpp/nodepcap/deps/include/pcap/nflog.h +94 -0
- package/cpp/nodepcap/deps/include/pcap/pcap-inttypes.h +101 -0
- package/cpp/nodepcap/deps/include/pcap/pcap.h +1219 -0
- package/cpp/nodepcap/deps/include/pcap/sll.h +149 -0
- package/cpp/nodepcap/deps/include/pcap/socket.h +84 -0
- package/cpp/nodepcap/deps/include/pcap/usb.h +143 -0
- package/cpp/nodepcap/deps/include/pcap/vlan.h +46 -0
- package/cpp/nodepcap/deps/include/pcap-bpf.h +45 -0
- package/cpp/nodepcap/deps/include/pcap-namedb.h +40 -0
- package/cpp/nodepcap/deps/include/pcap.h +43 -0
- package/cpp/nodepcap/deps/lib/ARM64/Packet.lib +0 -0
- package/cpp/nodepcap/deps/lib/Packet.lib +0 -0
- package/cpp/nodepcap/deps/lib/wpcap.lib +0 -0
- package/cpp/nodepcap/deps/lib/x64/Packet.lib +0 -0
- package/cpp/nodepcap/deps/lib/x64/wpcap.lib +0 -0
- package/cpp/nodepcap/nodepcap.gypi +104 -0
- package/cpp/nodepcap/src/binding.cc +14 -0
- package/cpp/nodepcap/src/capture.cc +400 -0
- package/cpp/nodepcap/src/capture.h +53 -0
- package/cpp/nodepcap/src/utils.cc +218 -0
- package/cpp/nodepcap/src/utils.h +13 -0
- package/package.json +65 -0
- package/src/NetKitty.ts +31 -0
- package/src/errors/ActionNotFoundError.ts +6 -0
- package/src/errors/CodecSchemaValidateError.ts +6 -0
- package/src/errors/DeviceNotFoundError.ts +6 -0
- package/src/errors/NoAvailableCodecError.ts +6 -0
- package/src/errors/NpcapLoadError.ts +6 -0
- package/src/errors/SocketDownError.ts +6 -0
- package/src/errors/UnknownPipeMessageTypeError.ts +6 -0
- package/src/errors/common/ErrorCode.ts +30 -0
- package/src/lib/GeneratePipeAddress.ts +17 -0
- package/src/lib/GetBinding.ts +3 -0
- package/src/lib/GetCaptureTemporaryDirectory.ts +12 -0
- package/src/lib/GetDeviceCaptureTemporaryFilename.ts +13 -0
- package/src/lib/codec/Codec.ts +181 -0
- package/src/lib/codec/abstracts/BaseHeader.ts +413 -0
- package/src/lib/codec/headers/ARP.ts +218 -0
- package/src/lib/codec/headers/EthernetII.ts +77 -0
- package/src/lib/codec/headers/Goose.ts +658 -0
- package/src/lib/codec/headers/IEC61850SampledValues.ts +359 -0
- package/src/lib/codec/headers/IPv4.ts +329 -0
- package/src/lib/codec/headers/RawData.ts +34 -0
- package/src/lib/codec/headers/TCP.ts +931 -0
- package/src/lib/codec/headers/UDP.ts +180 -0
- package/src/lib/codec/headers/VLAN_802dot1Q.ts +74 -0
- package/src/lib/codec/lib/BufferToHex.ts +3 -0
- package/src/lib/codec/lib/BufferToIP.ts +19 -0
- package/src/lib/codec/lib/BufferToNumber.ts +31 -0
- package/src/lib/codec/lib/FixHexString.ts +8 -0
- package/src/lib/codec/lib/FlexibleObject.ts +100 -0
- package/src/lib/codec/lib/HexToNumber.ts +25 -0
- package/src/lib/codec/lib/IPToBuffer.ts +25 -0
- package/src/lib/codec/lib/NumberToBERBuffer.ts +19 -0
- package/src/lib/codec/lib/NumberToBERHex.ts +13 -0
- package/src/lib/codec/lib/NumberToBuffer.ts +21 -0
- package/src/lib/codec/lib/NumberToHex.ts +15 -0
- package/src/lib/codec/lib/ProcessPacketPostHandlers.ts +53 -0
- package/src/lib/codec/lib/SortPostHandlers.ts +10 -0
- package/src/lib/codec/lib/StringContentEncodingEnum.ts +7 -0
- package/src/lib/codec/types/CodecData.ts +7 -0
- package/src/lib/codec/types/CodecDecodeResult.ts +9 -0
- package/src/lib/codec/types/CodecEncodeInput.ts +5 -0
- package/src/lib/codec/types/CodecEncodeResult.ts +6 -0
- package/src/lib/codec/types/CodecErrorInfo.ts +5 -0
- package/src/lib/codec/types/CodecModule.ts +3 -0
- package/src/lib/codec/types/CodecModuleConstructor.ts +3 -0
- package/src/lib/codec/types/CodecSchema.ts +7 -0
- package/src/lib/codec/types/HeaderTreeNode.ts +5 -0
- package/src/lib/codec/types/PostHandlerItem.ts +4 -0
- package/src/lib/nodepcap/Capture.ts +291 -0
- package/src/lib/nodepcap/GetNetworkInterfaces.ts +18 -0
- package/src/lib/nodepcap/interfaces/IBindingCapture.ts +27 -0
- package/src/lib/nodepcap/interfaces/IBindingCaptureOptions.ts +4 -0
- package/src/lib/nodepcap/interfaces/ICaptureOptions.ts +19 -0
- package/src/lib/nodepcap/interfaces/INetworkInterface.ts +4 -0
- package/src/lib/nodepcap/lib/BindingCapture.ts +46 -0
- package/src/lib/nodepcap/lib/GetNodePcapBinding.ts +17 -0
- package/src/lib/nodepcap/lib/GetNodePcapBindingCapture.ts +15 -0
- package/src/lib/nodepcap/workers/CaptureWorker.ts +30 -0
- package/src/lib/pcap/PCAPGenerator.ts +118 -0
- package/src/lib/pcap/PcapParser.ts +170 -0
- package/src/lib/pcap/PcapReader.ts +239 -0
- package/src/lib/pcap/PcapWriter.ts +93 -0
- package/src/lib/pcap/interfaces/IPcapPacketInfo.ts +12 -0
- package/src/lib/pipe/PipeClient.ts +91 -0
- package/src/lib/pipe/PipeClientSocket.ts +99 -0
- package/src/lib/pipe/PipeMessage.ts +74 -0
- package/src/lib/pipe/PipeMessageHandler.ts +91 -0
- package/src/lib/pipe/PipeServer.ts +74 -0
- package/src/lib/schema/ProtocolFieldJSONSchema.ts +45 -0
- package/src/lib/schema/ProtocolFieldJSONSchemaDefinition.ts +3 -0
- package/src/lib/schema/ProtocolJSONSchema.ts +37 -0
- package/src/tests/Test.spec.ts +22 -0
- package/src/tests/units/CaptureTest.spec.ts +30 -0
- package/src/tests/units/Codec.spec.ts +85 -0
- package/tsconfig.json +41 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/*-
|
|
2
|
+
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
|
3
|
+
* The Regents of the University of California. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This code is derived from the Stanford/CMU enet packet filter,
|
|
6
|
+
* (net/enet.c) distributed as part of 4.3BSD, and code contributed
|
|
7
|
+
* to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
|
|
8
|
+
* Berkeley Laboratory.
|
|
9
|
+
*
|
|
10
|
+
* Redistribution and use in source and binary forms, with or without
|
|
11
|
+
* modification, are permitted provided that the following conditions
|
|
12
|
+
* are met:
|
|
13
|
+
* 1. Redistributions of source code must retain the above copyright
|
|
14
|
+
* notice, this list of conditions and the following disclaimer.
|
|
15
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
|
16
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
17
|
+
* documentation and/or other materials provided with the distribution.
|
|
18
|
+
* 3. All advertising materials mentioning features or use of this software
|
|
19
|
+
* must display the following acknowledgement:
|
|
20
|
+
* This product includes software developed by the University of
|
|
21
|
+
* California, Berkeley and its contributors.
|
|
22
|
+
* 4. Neither the name of the University nor the names of its contributors
|
|
23
|
+
* may be used to endorse or promote products derived from this software
|
|
24
|
+
* without specific prior written permission.
|
|
25
|
+
*
|
|
26
|
+
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
27
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
28
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
29
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
30
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
31
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
32
|
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
33
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
34
|
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
35
|
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
36
|
+
* SUCH DAMAGE.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/*
|
|
40
|
+
* For captures on Linux cooked sockets, we construct a fake header
|
|
41
|
+
* that includes:
|
|
42
|
+
*
|
|
43
|
+
* a 2-byte "packet type" which is one of:
|
|
44
|
+
*
|
|
45
|
+
* LINUX_SLL_HOST packet was sent to us
|
|
46
|
+
* LINUX_SLL_BROADCAST packet was broadcast
|
|
47
|
+
* LINUX_SLL_MULTICAST packet was multicast
|
|
48
|
+
* LINUX_SLL_OTHERHOST packet was sent to somebody else
|
|
49
|
+
* LINUX_SLL_OUTGOING packet was sent *by* us;
|
|
50
|
+
*
|
|
51
|
+
* a 2-byte Ethernet protocol field;
|
|
52
|
+
*
|
|
53
|
+
* a 2-byte link-layer type;
|
|
54
|
+
*
|
|
55
|
+
* a 2-byte link-layer address length;
|
|
56
|
+
*
|
|
57
|
+
* an 8-byte source link-layer address, whose actual length is
|
|
58
|
+
* specified by the previous value.
|
|
59
|
+
*
|
|
60
|
+
* All fields except for the link-layer address are in network byte order.
|
|
61
|
+
*
|
|
62
|
+
* DO NOT change the layout of this structure, or change any of the
|
|
63
|
+
* LINUX_SLL_ values below. If you must change the link-layer header
|
|
64
|
+
* for a "cooked" Linux capture, introduce a new DLT_ type (ask
|
|
65
|
+
* "tcpdump-workers@lists.tcpdump.org" for one, so that you don't give it
|
|
66
|
+
* a value that collides with a value already being used), and use the
|
|
67
|
+
* new header in captures of that type, so that programs that can
|
|
68
|
+
* handle DLT_LINUX_SLL captures will continue to handle them correctly
|
|
69
|
+
* without any change, and so that capture files with different headers
|
|
70
|
+
* can be told apart and programs that read them can dissect the
|
|
71
|
+
* packets in them.
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
#ifndef lib_pcap_sll_h
|
|
75
|
+
#define lib_pcap_sll_h
|
|
76
|
+
|
|
77
|
+
#include <pcap/pcap-inttypes.h>
|
|
78
|
+
|
|
79
|
+
/*
|
|
80
|
+
* A DLT_LINUX_SLL fake link-layer header.
|
|
81
|
+
*/
|
|
82
|
+
#define SLL_HDR_LEN 16 /* total header length */
|
|
83
|
+
#define SLL_ADDRLEN 8 /* length of address field */
|
|
84
|
+
|
|
85
|
+
struct sll_header {
|
|
86
|
+
uint16_t sll_pkttype; /* packet type */
|
|
87
|
+
uint16_t sll_hatype; /* link-layer address type */
|
|
88
|
+
uint16_t sll_halen; /* link-layer address length */
|
|
89
|
+
uint8_t sll_addr[SLL_ADDRLEN]; /* link-layer address */
|
|
90
|
+
uint16_t sll_protocol; /* protocol */
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/*
|
|
94
|
+
* A DLT_LINUX_SLL2 fake link-layer header.
|
|
95
|
+
*/
|
|
96
|
+
#define SLL2_HDR_LEN 20 /* total header length */
|
|
97
|
+
|
|
98
|
+
struct sll2_header {
|
|
99
|
+
uint16_t sll2_protocol; /* protocol */
|
|
100
|
+
uint16_t sll2_reserved_mbz; /* reserved - must be zero */
|
|
101
|
+
uint32_t sll2_if_index; /* 1-based interface index */
|
|
102
|
+
uint16_t sll2_hatype; /* link-layer address type */
|
|
103
|
+
uint8_t sll2_pkttype; /* packet type */
|
|
104
|
+
uint8_t sll2_halen; /* link-layer address length */
|
|
105
|
+
uint8_t sll2_addr[SLL_ADDRLEN]; /* link-layer address */
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/*
|
|
109
|
+
* The LINUX_SLL_ values for "sll_pkttype" and LINUX_SLL2_ values for
|
|
110
|
+
* "sll2_pkttype"; these correspond to the PACKET_ values on Linux,
|
|
111
|
+
* which are defined by a header under include/uapi in the current
|
|
112
|
+
* kernel source, and are thus not going to change on Linux. We
|
|
113
|
+
* define them here so that they're available even on systems other
|
|
114
|
+
* than Linux.
|
|
115
|
+
*/
|
|
116
|
+
#define LINUX_SLL_HOST 0
|
|
117
|
+
#define LINUX_SLL_BROADCAST 1
|
|
118
|
+
#define LINUX_SLL_MULTICAST 2
|
|
119
|
+
#define LINUX_SLL_OTHERHOST 3
|
|
120
|
+
#define LINUX_SLL_OUTGOING 4
|
|
121
|
+
|
|
122
|
+
/*
|
|
123
|
+
* The LINUX_SLL_ values for "sll_protocol" and LINUX_SLL2_ values for
|
|
124
|
+
* "sll2_protocol"; these correspond to the ETH_P_ values on Linux, but
|
|
125
|
+
* are defined here so that they're available even on systems other than
|
|
126
|
+
* Linux. We assume, for now, that the ETH_P_ values won't change in
|
|
127
|
+
* Linux; if they do, then:
|
|
128
|
+
*
|
|
129
|
+
* if we don't translate them in "pcap-linux.c", capture files
|
|
130
|
+
* won't necessarily be readable if captured on a system that
|
|
131
|
+
* defines ETH_P_ values that don't match these values;
|
|
132
|
+
*
|
|
133
|
+
* if we do translate them in "pcap-linux.c", that makes life
|
|
134
|
+
* unpleasant for the BPF code generator, as the values you test
|
|
135
|
+
* for in the kernel aren't the values that you test for when
|
|
136
|
+
* reading a capture file, so the fixup code run on BPF programs
|
|
137
|
+
* handed to the kernel ends up having to do more work.
|
|
138
|
+
*
|
|
139
|
+
* Add other values here as necessary, for handling packet types that
|
|
140
|
+
* might show up on non-Ethernet, non-802.x networks. (Not all the ones
|
|
141
|
+
* in the Linux "if_ether.h" will, I suspect, actually show up in
|
|
142
|
+
* captures.)
|
|
143
|
+
*/
|
|
144
|
+
#define LINUX_SLL_P_802_3 0x0001 /* Novell 802.3 frames without 802.2 LLC header */
|
|
145
|
+
#define LINUX_SLL_P_802_2 0x0004 /* 802.2 frames (not D/I/X Ethernet) */
|
|
146
|
+
#define LINUX_SLL_P_CAN 0x000C /* CAN frames, with SocketCAN pseudo-headers */
|
|
147
|
+
#define LINUX_SLL_P_CANFD 0x000D /* CAN FD frames, with SocketCAN pseudo-headers */
|
|
148
|
+
|
|
149
|
+
#endif
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 1993, 1994, 1995, 1996, 1997
|
|
4
|
+
* The Regents of the University of California. All rights reserved.
|
|
5
|
+
*
|
|
6
|
+
* Redistribution and use in source and binary forms, with or without
|
|
7
|
+
* modification, are permitted provided that the following conditions
|
|
8
|
+
* are met:
|
|
9
|
+
* 1. Redistributions of source code must retain the above copyright
|
|
10
|
+
* notice, this list of conditions and the following disclaimer.
|
|
11
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
|
12
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
13
|
+
* documentation and/or other materials provided with the distribution.
|
|
14
|
+
* 3. All advertising materials mentioning features or use of this software
|
|
15
|
+
* must display the following acknowledgement:
|
|
16
|
+
* This product includes software developed by the Computer Systems
|
|
17
|
+
* Engineering Group at Lawrence Berkeley Laboratory.
|
|
18
|
+
* 4. Neither the name of the University nor of the Laboratory may be used
|
|
19
|
+
* to endorse or promote products derived from this software without
|
|
20
|
+
* specific prior written permission.
|
|
21
|
+
*
|
|
22
|
+
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
23
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
24
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
25
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
26
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
27
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
28
|
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
29
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
30
|
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
31
|
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
32
|
+
* SUCH DAMAGE.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
#ifndef lib_pcap_socket_h
|
|
36
|
+
#define lib_pcap_socket_h
|
|
37
|
+
|
|
38
|
+
/*
|
|
39
|
+
* Some minor differences between sockets on various platforms.
|
|
40
|
+
* We include whatever sockets are needed for Internet-protocol
|
|
41
|
+
* socket access on UN*X and Windows.
|
|
42
|
+
*/
|
|
43
|
+
#ifdef _WIN32
|
|
44
|
+
/* Need windef.h for defines used in winsock2.h under MingW32 */
|
|
45
|
+
#ifdef __MINGW32__
|
|
46
|
+
#include <windef.h>
|
|
47
|
+
#endif
|
|
48
|
+
#include <winsock2.h>
|
|
49
|
+
#include <ws2tcpip.h>
|
|
50
|
+
|
|
51
|
+
/*
|
|
52
|
+
* Winsock doesn't have this POSIX type; it's used for the
|
|
53
|
+
* tv_usec value of struct timeval.
|
|
54
|
+
*/
|
|
55
|
+
typedef long suseconds_t;
|
|
56
|
+
#else /* _WIN32 */
|
|
57
|
+
#include <sys/types.h>
|
|
58
|
+
#include <sys/socket.h>
|
|
59
|
+
#include <netdb.h> /* for struct addrinfo/getaddrinfo() */
|
|
60
|
+
#include <netinet/in.h> /* for sockaddr_in, in BSD at least */
|
|
61
|
+
#include <arpa/inet.h>
|
|
62
|
+
|
|
63
|
+
/*!
|
|
64
|
+
* \brief In Winsock, a socket handle is of type SOCKET; in UN*X, it's
|
|
65
|
+
* a file descriptor, and therefore a signed integer.
|
|
66
|
+
* We define SOCKET to be a signed integer on UN*X, so that it can
|
|
67
|
+
* be used on both platforms.
|
|
68
|
+
*/
|
|
69
|
+
#ifndef SOCKET
|
|
70
|
+
#define SOCKET int
|
|
71
|
+
#endif
|
|
72
|
+
|
|
73
|
+
/*!
|
|
74
|
+
* \brief In Winsock, the error return if socket() fails is INVALID_SOCKET;
|
|
75
|
+
* in UN*X, it's -1.
|
|
76
|
+
* We define INVALID_SOCKET to be -1 on UN*X, so that it can be used on
|
|
77
|
+
* both platforms.
|
|
78
|
+
*/
|
|
79
|
+
#ifndef INVALID_SOCKET
|
|
80
|
+
#define INVALID_SOCKET -1
|
|
81
|
+
#endif
|
|
82
|
+
#endif /* _WIN32 */
|
|
83
|
+
|
|
84
|
+
#endif /* lib_pcap_socket_h */
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2006 Paolo Abeni (Italy)
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
|
6
|
+
* modification, are permitted provided that the following conditions
|
|
7
|
+
* are met:
|
|
8
|
+
*
|
|
9
|
+
* 1. Redistributions of source code must retain the above copyright
|
|
10
|
+
* notice, this list of conditions and the following disclaimer.
|
|
11
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
|
12
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
13
|
+
* documentation and/or other materials provided with the distribution.
|
|
14
|
+
* 3. The name of the author may not be used to endorse or promote
|
|
15
|
+
* products derived from this software without specific prior written
|
|
16
|
+
* permission.
|
|
17
|
+
*
|
|
18
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
19
|
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
20
|
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
21
|
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
22
|
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
23
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
24
|
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
25
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
26
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
27
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
29
|
+
*
|
|
30
|
+
* Basic USB data struct
|
|
31
|
+
* By Paolo Abeni <paolo.abeni@email.it>
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
#ifndef lib_pcap_usb_h
|
|
35
|
+
#define lib_pcap_usb_h
|
|
36
|
+
|
|
37
|
+
#include <pcap/pcap-inttypes.h>
|
|
38
|
+
|
|
39
|
+
/*
|
|
40
|
+
* possible transfer mode
|
|
41
|
+
*/
|
|
42
|
+
#define URB_TRANSFER_IN 0x80
|
|
43
|
+
#define URB_ISOCHRONOUS 0x0
|
|
44
|
+
#define URB_INTERRUPT 0x1
|
|
45
|
+
#define URB_CONTROL 0x2
|
|
46
|
+
#define URB_BULK 0x3
|
|
47
|
+
|
|
48
|
+
/*
|
|
49
|
+
* possible event type
|
|
50
|
+
*/
|
|
51
|
+
#define URB_SUBMIT 'S'
|
|
52
|
+
#define URB_COMPLETE 'C'
|
|
53
|
+
#define URB_ERROR 'E'
|
|
54
|
+
|
|
55
|
+
/*
|
|
56
|
+
* USB setup header as defined in USB specification.
|
|
57
|
+
* Appears at the front of each Control S-type packet in DLT_USB captures.
|
|
58
|
+
*/
|
|
59
|
+
typedef struct _usb_setup {
|
|
60
|
+
uint8_t bmRequestType;
|
|
61
|
+
uint8_t bRequest;
|
|
62
|
+
uint16_t wValue;
|
|
63
|
+
uint16_t wIndex;
|
|
64
|
+
uint16_t wLength;
|
|
65
|
+
} pcap_usb_setup;
|
|
66
|
+
|
|
67
|
+
/*
|
|
68
|
+
* Information from the URB for Isochronous transfers.
|
|
69
|
+
*/
|
|
70
|
+
typedef struct _iso_rec {
|
|
71
|
+
int32_t error_count;
|
|
72
|
+
int32_t numdesc;
|
|
73
|
+
} iso_rec;
|
|
74
|
+
|
|
75
|
+
/*
|
|
76
|
+
* Header prepended by linux kernel to each event.
|
|
77
|
+
* Appears at the front of each packet in DLT_USB_LINUX captures.
|
|
78
|
+
*/
|
|
79
|
+
typedef struct _usb_header {
|
|
80
|
+
uint64_t id;
|
|
81
|
+
uint8_t event_type;
|
|
82
|
+
uint8_t transfer_type;
|
|
83
|
+
uint8_t endpoint_number;
|
|
84
|
+
uint8_t device_address;
|
|
85
|
+
uint16_t bus_id;
|
|
86
|
+
char setup_flag;/*if !=0 the urb setup header is not present*/
|
|
87
|
+
char data_flag; /*if !=0 no urb data is present*/
|
|
88
|
+
int64_t ts_sec;
|
|
89
|
+
int32_t ts_usec;
|
|
90
|
+
int32_t status;
|
|
91
|
+
uint32_t urb_len;
|
|
92
|
+
uint32_t data_len; /* amount of urb data really present in this event*/
|
|
93
|
+
pcap_usb_setup setup;
|
|
94
|
+
} pcap_usb_header;
|
|
95
|
+
|
|
96
|
+
/*
|
|
97
|
+
* Header prepended by linux kernel to each event for the 2.6.31
|
|
98
|
+
* and later kernels; for the 2.6.21 through 2.6.30 kernels, the
|
|
99
|
+
* "iso_rec" information, and the fields starting with "interval"
|
|
100
|
+
* are zeroed-out padding fields.
|
|
101
|
+
*
|
|
102
|
+
* Appears at the front of each packet in DLT_USB_LINUX_MMAPPED captures.
|
|
103
|
+
*/
|
|
104
|
+
typedef struct _usb_header_mmapped {
|
|
105
|
+
uint64_t id;
|
|
106
|
+
uint8_t event_type;
|
|
107
|
+
uint8_t transfer_type;
|
|
108
|
+
uint8_t endpoint_number;
|
|
109
|
+
uint8_t device_address;
|
|
110
|
+
uint16_t bus_id;
|
|
111
|
+
char setup_flag;/*if !=0 the urb setup header is not present*/
|
|
112
|
+
char data_flag; /*if !=0 no urb data is present*/
|
|
113
|
+
int64_t ts_sec;
|
|
114
|
+
int32_t ts_usec;
|
|
115
|
+
int32_t status;
|
|
116
|
+
uint32_t urb_len;
|
|
117
|
+
uint32_t data_len; /* amount of urb data really present in this event*/
|
|
118
|
+
union {
|
|
119
|
+
pcap_usb_setup setup;
|
|
120
|
+
iso_rec iso;
|
|
121
|
+
} s;
|
|
122
|
+
int32_t interval; /* for Interrupt and Isochronous events */
|
|
123
|
+
int32_t start_frame; /* for Isochronous events */
|
|
124
|
+
uint32_t xfer_flags; /* copy of URB's transfer flags */
|
|
125
|
+
uint32_t ndesc; /* number of isochronous descriptors */
|
|
126
|
+
} pcap_usb_header_mmapped;
|
|
127
|
+
|
|
128
|
+
/*
|
|
129
|
+
* Isochronous descriptors; for isochronous transfers there might be
|
|
130
|
+
* one or more of these at the beginning of the packet data. The
|
|
131
|
+
* number of descriptors is given by the "ndesc" field in the header;
|
|
132
|
+
* as indicated, in older kernels that don't put the descriptors at
|
|
133
|
+
* the beginning of the packet, that field is zeroed out, so that field
|
|
134
|
+
* can be trusted even in captures from older kernels.
|
|
135
|
+
*/
|
|
136
|
+
typedef struct _usb_isodesc {
|
|
137
|
+
int32_t status;
|
|
138
|
+
uint32_t offset;
|
|
139
|
+
uint32_t len;
|
|
140
|
+
uint8_t pad[4];
|
|
141
|
+
} usb_isodesc;
|
|
142
|
+
|
|
143
|
+
#endif
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*-
|
|
2
|
+
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
|
3
|
+
* The Regents of the University of California. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
|
6
|
+
* modification, are permitted provided that the following conditions
|
|
7
|
+
* are met:
|
|
8
|
+
* 1. Redistributions of source code must retain the above copyright
|
|
9
|
+
* notice, this list of conditions and the following disclaimer.
|
|
10
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
|
13
|
+
* 3. All advertising materials mentioning features or use of this software
|
|
14
|
+
* must display the following acknowledgement:
|
|
15
|
+
* This product includes software developed by the University of
|
|
16
|
+
* California, Berkeley and its contributors.
|
|
17
|
+
* 4. Neither the name of the University nor the names of its contributors
|
|
18
|
+
* may be used to endorse or promote products derived from this software
|
|
19
|
+
* without specific prior written permission.
|
|
20
|
+
*
|
|
21
|
+
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
22
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
23
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
24
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
25
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
26
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
27
|
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
28
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
29
|
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
30
|
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
31
|
+
* SUCH DAMAGE.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
#ifndef lib_pcap_vlan_h
|
|
35
|
+
#define lib_pcap_vlan_h
|
|
36
|
+
|
|
37
|
+
#include <pcap/pcap-inttypes.h>
|
|
38
|
+
|
|
39
|
+
struct vlan_tag {
|
|
40
|
+
uint16_t vlan_tpid; /* ETH_P_8021Q */
|
|
41
|
+
uint16_t vlan_tci; /* VLAN TCI */
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
#define VLAN_TAG_LEN 4
|
|
45
|
+
|
|
46
|
+
#endif
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*-
|
|
2
|
+
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
|
3
|
+
* The Regents of the University of California. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This code is derived from the Stanford/CMU enet packet filter,
|
|
6
|
+
* (net/enet.c) distributed as part of 4.3BSD, and code contributed
|
|
7
|
+
* to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
|
|
8
|
+
* Berkeley Laboratory.
|
|
9
|
+
*
|
|
10
|
+
* Redistribution and use in source and binary forms, with or without
|
|
11
|
+
* modification, are permitted provided that the following conditions
|
|
12
|
+
* are met:
|
|
13
|
+
* 1. Redistributions of source code must retain the above copyright
|
|
14
|
+
* notice, this list of conditions and the following disclaimer.
|
|
15
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
|
16
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
17
|
+
* documentation and/or other materials provided with the distribution.
|
|
18
|
+
* 3. All advertising materials mentioning features or use of this software
|
|
19
|
+
* must display the following acknowledgement:
|
|
20
|
+
* This product includes software developed by the University of
|
|
21
|
+
* California, Berkeley and its contributors.
|
|
22
|
+
* 4. Neither the name of the University nor the names of its contributors
|
|
23
|
+
* may be used to endorse or promote products derived from this software
|
|
24
|
+
* without specific prior written permission.
|
|
25
|
+
*
|
|
26
|
+
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
27
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
28
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
29
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
30
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
31
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
32
|
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
33
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
34
|
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
35
|
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
36
|
+
* SUCH DAMAGE.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/*
|
|
40
|
+
* For backwards compatibility.
|
|
41
|
+
*
|
|
42
|
+
* Note to OS vendors: do NOT get rid of this file! Some applications
|
|
43
|
+
* might expect to be able to include <pcap-bpf.h>.
|
|
44
|
+
*/
|
|
45
|
+
#include <pcap/bpf.h>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 1994, 1996
|
|
3
|
+
* The Regents of the University of California. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
|
6
|
+
* modification, are permitted provided that the following conditions
|
|
7
|
+
* are met:
|
|
8
|
+
* 1. Redistributions of source code must retain the above copyright
|
|
9
|
+
* notice, this list of conditions and the following disclaimer.
|
|
10
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
|
13
|
+
* 3. All advertising materials mentioning features or use of this software
|
|
14
|
+
* must display the following acknowledgement:
|
|
15
|
+
* This product includes software developed by the Computer Systems
|
|
16
|
+
* Engineering Group at Lawrence Berkeley Laboratory.
|
|
17
|
+
* 4. Neither the name of the University nor of the Laboratory may be used
|
|
18
|
+
* to endorse or promote products derived from this software without
|
|
19
|
+
* specific prior written permission.
|
|
20
|
+
*
|
|
21
|
+
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
22
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
23
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
24
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
25
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
26
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
27
|
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
28
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
29
|
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
30
|
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
31
|
+
* SUCH DAMAGE.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/*
|
|
35
|
+
* For backwards compatibility.
|
|
36
|
+
*
|
|
37
|
+
* Note to OS vendors: do NOT get rid of this file! Some applications
|
|
38
|
+
* might expect to be able to include <pcap-namedb.h>.
|
|
39
|
+
*/
|
|
40
|
+
#include <pcap/namedb.h>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 1993, 1994, 1995, 1996, 1997
|
|
3
|
+
* The Regents of the University of California. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
|
6
|
+
* modification, are permitted provided that the following conditions
|
|
7
|
+
* are met:
|
|
8
|
+
* 1. Redistributions of source code must retain the above copyright
|
|
9
|
+
* notice, this list of conditions and the following disclaimer.
|
|
10
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
|
13
|
+
* 3. All advertising materials mentioning features or use of this software
|
|
14
|
+
* must display the following acknowledgement:
|
|
15
|
+
* This product includes software developed by the Computer Systems
|
|
16
|
+
* Engineering Group at Lawrence Berkeley Laboratory.
|
|
17
|
+
* 4. Neither the name of the University nor of the Laboratory may be used
|
|
18
|
+
* to endorse or promote products derived from this software without
|
|
19
|
+
* specific prior written permission.
|
|
20
|
+
*
|
|
21
|
+
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
22
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
23
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
24
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
25
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
26
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
27
|
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
28
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
29
|
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
30
|
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
31
|
+
* SUCH DAMAGE.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/*
|
|
35
|
+
* For backwards compatibility.
|
|
36
|
+
*
|
|
37
|
+
* Note to OS vendors: do NOT get rid of this file! Many applications
|
|
38
|
+
* expect to be able to include <pcap.h>, and at least some of them
|
|
39
|
+
* go through contortions in their configure scripts to try to detect
|
|
40
|
+
* OSes that have "helpfully" moved pcap.h to <pcap/pcap.h> without
|
|
41
|
+
* leaving behind a <pcap.h> file.
|
|
42
|
+
*/
|
|
43
|
+
#include <pcap/pcap.h>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
{
|
|
2
|
+
"targets": [
|
|
3
|
+
{
|
|
4
|
+
"target_name": "nodepcap",
|
|
5
|
+
"product_dir": "<(module_root_dir)/bindings/nodepcap",
|
|
6
|
+
"sources": [
|
|
7
|
+
"src/binding.cc",
|
|
8
|
+
"src/capture.cc",
|
|
9
|
+
"src/utils.cc"
|
|
10
|
+
],
|
|
11
|
+
"include_dirs": [
|
|
12
|
+
"<!@(node -p \"require('node-addon-api').include\")"
|
|
13
|
+
],
|
|
14
|
+
"dependencies": [
|
|
15
|
+
"<!(node -p \"require('node-addon-api').gyp\")"
|
|
16
|
+
],
|
|
17
|
+
"cflags!": [
|
|
18
|
+
"-fno-exceptions"
|
|
19
|
+
],
|
|
20
|
+
"cflags_cc!": [
|
|
21
|
+
"-fno-exceptions"
|
|
22
|
+
],
|
|
23
|
+
"conditions": [
|
|
24
|
+
[
|
|
25
|
+
"OS==\"win\"",
|
|
26
|
+
{
|
|
27
|
+
"sources": [],
|
|
28
|
+
"include_dirs": [
|
|
29
|
+
"deps/include"
|
|
30
|
+
],
|
|
31
|
+
"defines": [
|
|
32
|
+
"WPCAP"
|
|
33
|
+
],
|
|
34
|
+
"conditions": [
|
|
35
|
+
[
|
|
36
|
+
"target_arch==\"ia32\"",
|
|
37
|
+
{
|
|
38
|
+
"link_settings": {
|
|
39
|
+
"libraries": [
|
|
40
|
+
"ws2_32.lib",
|
|
41
|
+
"<(PRODUCT_DIR)/../../deps/lib/wpcap.lib"
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"link_settings": {
|
|
47
|
+
"libraries": [
|
|
48
|
+
"ws2_32.lib",
|
|
49
|
+
"<(PRODUCT_DIR)/../../deps/lib/x64/wpcap.lib"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
],
|
|
55
|
+
"msvs_settings": {
|
|
56
|
+
"VCCLCompilerTool": {
|
|
57
|
+
"ExceptionHandling": 1
|
|
58
|
+
},
|
|
59
|
+
"VCLinkerTool": {
|
|
60
|
+
"DelayLoadDLLs": [
|
|
61
|
+
"wpcap.dll"
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
[
|
|
68
|
+
"OS==\"mac\"",
|
|
69
|
+
{
|
|
70
|
+
"xcode_settings": {
|
|
71
|
+
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
|
|
72
|
+
"MACOSX_DEPLOYMENT_TARGET": "10.9",
|
|
73
|
+
"OTHER_CFLAGS": [
|
|
74
|
+
"-arch x86_64",
|
|
75
|
+
"-arch arm64"
|
|
76
|
+
],
|
|
77
|
+
"OTHER_LDFLAGS": [
|
|
78
|
+
"-framework CoreFoundation",
|
|
79
|
+
"-framework IOKit",
|
|
80
|
+
"-arch x86_64",
|
|
81
|
+
"-arch arm64"
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
"link_settings": {
|
|
85
|
+
"libraries": [
|
|
86
|
+
"-lpcap"
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
[
|
|
92
|
+
"OS!=\"win\"",
|
|
93
|
+
{
|
|
94
|
+
"link_settings": {
|
|
95
|
+
"libraries": [
|
|
96
|
+
"-lpcap"
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#include <napi.h>
|
|
2
|
+
#include "capture.h"
|
|
3
|
+
#include "utils.h"
|
|
4
|
+
|
|
5
|
+
Napi::Object Init(Napi::Env env, Napi::Object exports)
|
|
6
|
+
{
|
|
7
|
+
Napi::HandleScope scope(env);
|
|
8
|
+
Capture::Init(env, exports);
|
|
9
|
+
exports.Set("GetNetworkInterfaces", Napi::Function::New(env, GetNetworkInterfaces));
|
|
10
|
+
exports.Set("Prepare", Napi::Function::New(env, Prepare));
|
|
11
|
+
return exports;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
NODE_API_MODULE(nodepcap, Init);
|