Unix extension to jNetPcap

I've been working on a new package org.jnetpcap.unix that adds a UNIX system call extension to jNetPcap. I'm needing to retrieve the MAC address of a network interface and instead of doing everything behind the scenes, I'm using the low-level programing philosophy with a low level unix API package.

Here is a jUnit test case that retrieves a MAC address from my Linux test box:

	public void testIoctlGETHWADDR() throws IOException {

A bug? and a new feature.

I've been asked to add a new function to acquire the hardware MAC address of an interface, which you can't get directly from libpcap.

Also looks like there may be a memory leak in in the PcapHandler native method. ByteBuffer is not deallocated and thus a memory leak Sad

The memory leak is easy to fix. The new MAC function is a little more complex, but is a vital feature for anyone using jNetPcap and building an application. There is no way to acquire MAC address using any of the released JREs so its a must.

Everything tested and compiled

Things are looking really good. I'm compiling multi JRE version jar files, packaging it, generating multiple javadocs and upload to webserver. Tests are passing. The documentation has been updated to reflect the various differences between JRE versions of the API.

Here is a console output of a build on WinXP platform.

Buildfile: C:\jnetstream\jnetpcap\build.xml
clean:
   [delete] Deleting directory C:\jnetstream\jnetpcap\build
   [delete] Deleting directory C:\jnetstream\jnetpcap\dist
prep-dist:
    [mkdir] Created dir: C:\jnetstream\jnetpcap\dist
prep-checks:
prep-build:
    [mkdir] Created dir: C:\jnetstream\jnetpcap\build
prep-jni:
    [mkdir] Created dir: C:\jnetstream\jnetpcap\build\obj
prep-lib:
    [mkdir] Created dir: C:\jnetstream\jnetpcap\build\lib
prep-javah:
    [mkdir] Created dir: C:\jnetstream\jnetpcap\build\include
release-settings:
comp-java:
prep-build:
prep-java:
    [mkdir] Created dir: C:\jnetstream\jnetpcap\build\classes1.4
comp-java-jre:
    [javac] Compiling 21 source files to C:\jnetstream\jnetpcap\build\classes1.4
prep-build:
prep-java:
    [mkdir] Created dir: C:\jnetstream\jnetpcap\build\classes1.5
comp-java-jre:
    [javac] Compiling 21 source files to C:\jnetstream\jnetpcap\build\classes1.5
comp-javah:
     [echo] Generating: ./build/include/org_jnetpcap_Pcap.h
     [echo] Generating: ./build/include/org_jnetpcap_PcapBpfProgram.h
     [echo] Generating: ./build/include/org_jnetpcap_PcapDumper.h
     [echo] Generating: ./build/include/org_jnetpcap_PcapPktHdr.h
     [echo] Generating: ./build/include/org_jnetpcap_PcapPktBuffer.h
     [echo] Generating: ./build/include/org_jnetpcap_PcapStat.h
     [echo] Generating: ./build/include/org_jnetpcap_PcapIf.h
     [echo] Generating: ./build/include/org_jnetpcap_PcapAddr.h
     [echo] Generating: ./build/include/org_jnetpcap_PcapSockAddr.h
     [echo] Generating: ./build/include/org_jnetpcap_winpcap_WinPcap.h

Version 1.2 API changes

The new release I'm almost finished with has some slight additions and interesting twists to the API.

New release in the works - version 1.2

I've been fixing a few things in the 1.1 as well as adding new features. Nothing major. The biggest is 1.2 will be a dual library providing support for both Java 1.4 and Java 5 runtimes. I've duplicated the sources code under src/java1.4 and src/java1.5 directories and utilized syntax for appropriate java syntax compatibility level. The functionality is exactly the same in both versions but the 1.4 does not utilize any of the new Java 5 syntax or java 5 binary classfile format.

Syndicate content