Skip to content

Commit

Permalink
testing ci
Browse files Browse the repository at this point in the history
  • Loading branch information
vaguue committed Aug 13, 2024
1 parent 96a8502 commit b771705
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 10 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,24 @@ jobs:
- name: Submodule update
run: git submodule update --init --recursive
shell: bash
- name: Build and Text

- name: Build and Test (Windows)
if: matrix.os == 'windows-latest'
run: npm i && PCAP_ROOT="$(pwd)/build/Release/npcap" npm run build && npm run test
shell: bash

- name: Build and Test
if: matrix.os != 'windows-latest'
run: npm i && npm run build && npm run test
shell: bash

- name: Prebuild (Windows)
if: matrix.os == 'windows-latest'
run: PCAP_ROOT="$(pwd)/build/Release/npcap" npm run precompile && ls prebuilds && zip -r prebuilds-${{ matrix.os }}.zip prebuilds
shell: bash

- name: Prebuild
if: matrix.os != 'windows-latest'
run: npm run precompile && ls prebuilds && zip -r prebuilds-${{ matrix.os }}.zip prebuilds
shell: bash
- name: ls
Expand Down
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ add_library(${PROJECT_NAME} SHARED ${CMAKE_JS_SRC})
target_include_directories(${PROJECT_NAME} PRIVATE "${NODE_ADDON_API_DIR}")
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/cxx")

if(DEFINED ENV{PCAP_ROOT})
set(PCAP_ROOT $ENV{PCAP_ROOT})
message("PCAP_ROOT: ${PCAP_ROOT}")
add_definitions(-DPCAP_ROOT="${PCAP_ROOT}")
else()
message(WARNING "PCAP_ROOT is not set in the environment. Default paths will be used.")
endif()

if(PCAP_ROOT)
target_include_directories(${PROJECT_NAME} PRIVATE "${PCAP_ROOT}/Include")
target_link_libraries(${PROJECT_NAME} PRIVATE "${PCAP_ROOT}/Lib/Packet.lib" "${PCAP_ROOT}/Lib/wpcap.lib")
endif()

# PcapPlusPlus
add_subdirectory(cxx_modules/PcapPlusPlus)
add_dependencies(${PROJECT_NAME} Pcap++)
Expand Down
2 changes: 0 additions & 2 deletions cxx/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
* and JS <=> C++ specific functions.
*/

#define DEBUG

#ifdef DEBUG
#define DEBUG_OUTPUT(x) std::cout << "[over-the-wire::cxx] " << (x) << std::endl;
#else
Expand Down
2 changes: 1 addition & 1 deletion lib/layers/ARP.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ARP extends ARPHeader {
* @param {Buffer|Object} data - Input buffer or object with protocol fields.
* @param {LayerOptions} opts - Options for the layer.
*/
constructor(data, opts = {}) {
constructor(data = {}, opts = {}) {
super(data);
mixins.ctor(this, data, opts);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/layers/Ethernet.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Ethernet extends EthernetHeader {
* @param {Buffer|Object} data - Input buffer or object with protocol fields.
* @param {Object} opts - Options for the layer.
*/
constructor(data, opts = {}) {
constructor(data = {}, opts = {}) {
super(data);
mixins.ctor(this, data, opts);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/layers/IPv4.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class IPv4 extends IPv4Header {
* @param {Buffer|Object} data - Input buffer or object with protocol fields.
* @param {Object} opts - Options for the layer.
*/
constructor(data, opts = {}) {
constructor(data = {}, opts = {}) {
super(data);
mixins.ctor(this, data, opts);

Expand Down
2 changes: 1 addition & 1 deletion lib/layers/Payload.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { OsiModelLayers } = require('./osi');
class Payload {
name = 'Payload';

constructor(data, { prev = null, allocated = null } = {}) {
constructor(data = {}, { prev = null, allocated = null } = {}) {
this.prev = prev;
this.next = null;

Expand Down
2 changes: 1 addition & 1 deletion lib/layers/TCP.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const flagKeys = flagNames.map(e => e + 'Flag');
class TCP extends TCPHeader {
name = 'TCP';

constructor(data, opts = {}) {
constructor(data = {}, opts = {}) {
super(data);
mixins.ctor(this, data, opts);

Expand Down
2 changes: 1 addition & 1 deletion lib/layers/TLV.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const { TLVRecord_8, TLVPadding_8 } = compile(`
`);

class TLV_8 extends TLVRecord_8 {
constructor(data, opts = {}) {
constructor(data = {}, opts = {}) {
super(data);
if (!Buffer.isBuffer(data) && typeof data == 'object' && data?.value) {
this.value = data.value;
Expand Down
2 changes: 1 addition & 1 deletion lib/layers/exampleLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Layer {
* @param {Buffer|Object} data - Input buffer or object with protocol fields.
* @param {Object} opts - Options for the layer.
*/
constructor(data, opts = {}) {
constructor(data = {}, opts = {}) {
/**
* Underlying buffer synced with the properties.
* @type {Buffer}
Expand Down

0 comments on commit b771705

Please sign in to comment.