Jxnet { public static native int PcapSetTStampType(Pcap pcap, int type) throws PcapCloseException, PlatformNotSupportedException; private  Jxnet(); static native int PcapFindAllDevs(List<PcapIf> alldevsp, StringBuilder errbuf); static native Pcap PcapOpenLive(String source, int snaplen, int promisc, int toMs, StringBuilder errbuf); static native int PcapLoop(Pcap pcap, int cnt, PcapHandler<T> callback, T user); @Incubating static native int PcapLoop0(Pcap pcap, int cnt, RawPcapHandler<T> callback, T user); static native int PcapDispatch(Pcap pcap, int cnt, PcapHandler<T> callback, T user); @Incubating static native int PcapDispatch0(Pcap pcap, int cnt, RawPcapHandler<T> callback, T user); static native PcapDumper PcapDumpOpen(Pcap pcap, String fname); static native void PcapDump(PcapDumper pcapDumper, PcapPktHdr h, ByteBuffer sp); static native Pcap PcapOpenOffline(String fname, StringBuilder errbuf); static native int PcapCompile(Pcap pcap, BpfProgram fp, String str, int optimize, int netmask); static native int PcapSetFilter(Pcap pcap, BpfProgram fp); static native int PcapSendPacket(Pcap pcap, ByteBuffer buf, int size); static native ByteBuffer PcapNext(Pcap pcap, PcapPktHdr h); static native int PcapNextEx(Pcap pcap, PcapPktHdr pktHeader, ByteBuffer pktData); static native void PcapClose(Pcap pcap); static native int PcapDumpFlush(PcapDumper pcapDumper); static native void PcapDumpClose(PcapDumper pcapDumper); static native int PcapDataLink(Pcap pcap); static native int PcapSetDataLink(Pcap pcap, int dtl); static native void PcapBreakLoop(Pcap pcap); @Deprecated static native String PcapLookupDev(StringBuilder errbuf); static native String PcapGetErr(Pcap pcap); static native String PcapLibVersion(); static native int PcapIsSwapped(Pcap pcap); static native int PcapSnapshot(Pcap pcap); static native String PcapStrError(int error); static native int PcapMajorVersion(Pcap pcap); static native int PcapMinorVersion(Pcap pcap); static native String PcapDataLinkValToName(int dtl); static native String PcapDataLinkValToDescription(int dtl); static native int PcapDataLinkNameToVal(String name); static native int PcapSetNonBlock(Pcap pcap, int nonblock, StringBuilder errbuf); static native int PcapGetNonBlock(Pcap pcap, StringBuilder errbuf); static native Pcap PcapOpenDead(int linktype, int snaplen); static native long PcapDumpFTell(PcapDumper pcapDumper); static native void PcapFreeCode(BpfProgram bpfProgram); static native int PcapStats(Pcap pcap, PcapStat pcapStat); static native int PcapCompileNoPcap(int snaplenArg, int linktypeArg, BpfProgram program, String buf, int optimize, int mask); static native void PcapPError(Pcap pcap, String prefix); static native Pcap PcapCreate(String source, StringBuilder errbuf); static native int PcapSetSnaplen(Pcap pcap, int snaplen); static native int PcapSetPromisc(Pcap pcap, int promisc); static native int PcapSetTimeout(Pcap pcap, int timeout); static native int PcapSetBufferSize(Pcap pcap, int bufferSize); static native int PcapCanSetRfMon(Pcap pcap); static native int PcapSetRfMon(Pcap pcap, int rfmon); static native int PcapSetImmediateMode(Pcap pcap, int immediateMode); static native int PcapActivate(Pcap pcap); static native int PcapSetDirection(Pcap pcap, PcapDirection direction); static native int PcapSetTStampPrecision(Pcap pcap, int tstampPrecision); static native int PcapSetTStampType(Pcap pcap, int type); static native int PcapGetTStampPrecision(Pcap pcap); static native int PcapListDataLinks(Pcap pcap, List<Integer> dtlBuffer); static native int PcapListTStampTypes(Pcap pcap, List<Integer> tstampTypesp); static native int PcapTStampTypeNameToVal(String name); static native String PcapTStampTypeValToName(int tstampType); static native String PcapTStampTypeValToDescription(int tstampType); static native String PcapStatusToStr(int errnum); static native Pcap PcapOpenDeadWithTStampPrecision(int linktype, int snaplen, int precision); static native int PcapOfflineFilter(BpfProgram fp, PcapPktHdr h, ByteBuffer pkt); static native Pcap PcapOpenOfflineWithTStampPrecision(String fname, int tstampPrecision, StringBuilder errbuf); static native int PcapInject(Pcap pcap, ByteBuffer buf, int size); static native int PcapCheckActivated(Pcap pcap); static native byte[] FindHardwareAddress(String source); static final int OK; static final int PCAP_ERRBUF_SIZE; }
@Test public void Test28_PcapSetTStampType() { try { if ((resultCode = PcapSetTStampType(pcap, 1)) != OK) { logger.warning("Timestamp type not supported by operation system."); } } catch (PlatformNotSupportedException e) { logger.warning(e.getMessage()); } }