Skip to content

Commit

Permalink
Added several static methods to PcapHeader for accessing raw header
Browse files Browse the repository at this point in the history
fields
Small updates to the junit tests
  • Loading branch information
SecureNetWizard committed Apr 4, 2023
1 parent 57ac323 commit a84eb89
Show file tree
Hide file tree
Showing 8 changed files with 448 additions and 162 deletions.
13 changes: 10 additions & 3 deletions src/main/java/org/jnetpcap/Pcap0_4.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,15 @@
public sealed class Pcap0_4 extends Pcap permits Pcap0_5 {

protected interface PcapSupplier<T extends Pcap> {
// <T extends Pcap> T openLive(BiFunction<MemoryAddress, String, T>

/**
* Supplier of specific versioned Pcap subclasses and instantiations.
*
* @param handle the pcap handle
* @param name the device name name
* @param abi the native header abi
* @return the instance of specific Pcap subclass
*/
T newPcap(MemoryAddress handle, String name, PcapHeaderABI abi);

}
Expand Down Expand Up @@ -582,7 +589,7 @@ public <U> int dispatch(int count, OfMemorySegment<U> handler, U user) throws Pc
@SuppressWarnings("unchecked")
U usr = (aUser == NULL) ? user : (U) u;

handler.handleSegment(usr, mPkt, mHdr);
handler.handleSegment(usr, mHdr, mPkt);
}
}, aUser);
}
Expand Down Expand Up @@ -771,7 +778,7 @@ public <U> int loop(int count, PcapHandler.OfMemorySegment<U> handler, U user) {
@SuppressWarnings("unchecked")
U usr = (aUser == NULL) ? user : (U) u;

handler.handleSegment(usr, mPkt, mHdr);
handler.handleSegment(usr, mHdr, mPkt);
}
}, aUser);
}
Expand Down
Loading

0 comments on commit a84eb89

Please sign in to comment.