| Modifier | Constructor and Description |
|---|---|
protected |
ApplicationContext(java.lang.String applicationName,
java.lang.String applicationDisplayName,
java.lang.String applicationVersion,
com.ardikars.common.util.Builder<com.ardikars.jxnet.Pcap,java.lang.Void> builder) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getApplicationDisplayName() |
java.lang.String |
getApplicationName() |
java.lang.String |
getApplicationVersion() |
Context |
newInstance(com.ardikars.common.util.Builder<com.ardikars.jxnet.Pcap,java.lang.Void> builder) |
void |
pcapBreakLoop()
Set a flag that will force PcapDispatch() or PcapLoop() to return rather than looping.
|
com.ardikars.jxnet.PcapCode |
pcapCanSetRfMon()
Checks whether monitor mode could be set on a capture handle when the handle is activated.
|
void |
pcapClose()
Close the files associated with pcap and deallocates resources.
|
com.ardikars.jxnet.PcapCode |
pcapCompile(java.lang.String str,
com.ardikars.jxnet.BpfProgram.BpfCompileMode optimize,
int netmask)
Compile a packet filter, converting an high level filtering expression
(see Filtering expression syntax) in a program that can be interpreted
by the kernel-level filtering engine.
|
com.ardikars.jxnet.PcapCode |
pcapCompileNoPcap(int snaplen,
com.ardikars.jxnet.DataLinkType dataLinkType,
java.lang.String filter,
com.ardikars.jxnet.BpfProgram.BpfCompileMode optimize,
com.ardikars.common.net.Inet4Address mask)
Compile a packet filter without the need of opening an adapter.
|
com.ardikars.jxnet.DataLinkType |
pcapDataLink()
Return the link layer of an adapter on success.
|
<T> com.ardikars.jxnet.PcapCode |
pcapDispatch(int cnt,
com.ardikars.jxnet.PcapHandler<T> callback,
T user)
Collect a group of packets.
|
<T> com.ardikars.jxnet.PcapCode |
pcapDispatch(int cnt,
com.ardikars.jxnet.PcapHandler<T> callback,
T user,
java.util.concurrent.Executor executor)
Collect a group of packets.
|
void |
pcapDump(com.ardikars.jxnet.PcapPktHdr h,
java.nio.ByteBuffer sp)
Save a packet to disk.
|
void |
pcapDumpClose(com.ardikars.jxnet.PcapDumper pcapDumper)
Closes a savefile.
|
com.ardikars.jxnet.PcapCode |
pcapDumpFlush()
Flushes the output buffer to the savefile, so that any packets written
with PcapDump() but not yet written to the savefile will be written.
|
long |
pcapDumpFTell()
Return the file position for a savefile.
|
com.ardikars.jxnet.PcapCode |
pcapDumpOpen(java.lang.String fname)
Open a file to write packets.
|
void |
pcapFreeCode()
Free a filter.
|
java.lang.String |
pcapGetErr()
Return the error text pertaining to the last pcap library error.
|
com.ardikars.jxnet.PcapCode |
pcapGetNonBlock(java.lang.StringBuilder errbuf)
Get the "non-blocking" state of an interface.
|
com.ardikars.jxnet.PcapTimestampPrecision |
pcapGetTStampPrecision()
Get the timestamp precision returned in captures.
|
com.ardikars.jxnet.PcapCode |
pcapInject(java.nio.ByteBuffer buf,
int size)
Sends a raw packet through the network interface; buf points to the data of the packet,
including the link-layer header, and size is the number of bytes in the packet.
|
com.ardikars.jxnet.PcapCode |
pcapIsSwapped()
Returns true (1) if the current savefile uses a different byte order than the current system.
|
com.ardikars.jxnet.PcapCode |
pcapListDataLinks(java.util.List<com.ardikars.jxnet.DataLinkType> dtlBuffer)
Get list of datalinks.
|
com.ardikars.jxnet.PcapCode |
pcapListTStampTypes(java.util.List<com.ardikars.jxnet.PcapTimestampType> tstampTypesp)
Get link of time stamp types.
|
<T> com.ardikars.jxnet.PcapCode |
pcapLoop(int cnt,
com.ardikars.jxnet.PcapHandler<T> callback,
T user)
Collect a group of packets.
|
<T> com.ardikars.jxnet.PcapCode |
pcapLoop(int cnt,
com.ardikars.jxnet.PcapHandler<T> callback,
T user,
java.util.concurrent.Executor executor)
Collect a group of packets.
|
int |
pcapMajorVersion()
Return the major version number of the pcap library used to write the savefile.
|
int |
pcapMinorVersion()
Return the minor version number of the pcap library used to write the savefile.
|
java.nio.ByteBuffer |
pcapNext(com.ardikars.jxnet.PcapPktHdr h)
Return the next available packet.
|
com.ardikars.jxnet.PcapCode |
pcapNextEx(com.ardikars.jxnet.PcapPktHdr pktHeader,
java.nio.ByteBuffer pktData)
Read a packet from an interface or from an offline capture.
|
com.ardikars.jxnet.PcapCode |
pcapOfflineFilter(com.ardikars.jxnet.BpfProgram fp,
com.ardikars.jxnet.PcapPktHdr h,
java.nio.ByteBuffer pkt)
Given a BPF program, a PcapPktHdr structure for a packet, and the raw
data for the packet, check whether the packet passes the filter.
|
void |
pcapPError(java.lang.String prefix)
Print the text of the last pcap library error on stderr, prefixed by prefix.
|
com.ardikars.jxnet.PcapCode |
pcapSendPacket(java.nio.ByteBuffer buf,
int size)
Send a raw packet.
|
com.ardikars.jxnet.PcapCode |
pcapSetDataLink(com.ardikars.jxnet.DataLinkType dataLinkType)
Set the current data link type of the pcap descriptor to the type
specified by dlt.
|
com.ardikars.jxnet.PcapCode |
pcapSetDirection(com.ardikars.jxnet.PcapDirection direction)
used to specify a direction that packets will be
captured.
|
com.ardikars.jxnet.PcapCode |
pcapSetFilter()
Associate a filter to a capture.
|
com.ardikars.jxnet.PcapCode |
pcapSetNonBlock(boolean nonblock,
java.lang.StringBuilder errbuf)
Switch between blocking and nonblocking mode.
|
int |
pcapSnapshot()
Return the dimension of the packet portion (in bytes) that is delivered to the application.
|
com.ardikars.jxnet.PcapCode |
pcapStats(com.ardikars.jxnet.PcapStat pcapStat)
Return statistics on current capture.
|
protected ApplicationContext(java.lang.String applicationName,
java.lang.String applicationDisplayName,
java.lang.String applicationVersion,
com.ardikars.common.util.Builder<com.ardikars.jxnet.Pcap,java.lang.Void> builder)
public java.lang.String getApplicationName()
getApplicationName in interface Contextpublic java.lang.String getApplicationDisplayName()
getApplicationDisplayName in interface Contextpublic java.lang.String getApplicationVersion()
getApplicationVersion in interface Contextpublic Context newInstance(com.ardikars.common.util.Builder<com.ardikars.jxnet.Pcap,java.lang.Void> builder)
newInstance in interface com.ardikars.common.util.Factory<Context,com.ardikars.common.util.Builder<com.ardikars.jxnet.Pcap,java.lang.Void>>public <T> com.ardikars.jxnet.PcapCode pcapLoop(int cnt,
com.ardikars.jxnet.PcapHandler<T> callback,
T user)
throws com.ardikars.jxnet.exception.PcapCloseException
ContextpcapLoop in interface ContextT - args type.cnt - maximum iteration, -1 is infinite iteration.callback - callback funtion.user - argscom.ardikars.jxnet.exception.PcapCloseException - pcap close exception.public <T> com.ardikars.jxnet.PcapCode pcapLoop(int cnt,
com.ardikars.jxnet.PcapHandler<T> callback,
T user,
java.util.concurrent.Executor executor)
throws com.ardikars.jxnet.exception.PcapCloseException
ContextpcapLoop in interface ContextT - args type.cnt - maximum iteration, -1 is infinite iteration.callback - callback funtion.user - argsexecutor - executor service.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.public <T> com.ardikars.jxnet.PcapCode pcapDispatch(int cnt,
com.ardikars.jxnet.PcapHandler<T> callback,
T user)
throws com.ardikars.jxnet.exception.PcapCloseException
ContextpcapDispatch in interface ContextT - args type.cnt - maximum iteration, -1 to infinite.callback - callback function.user - arg.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.public <T> com.ardikars.jxnet.PcapCode pcapDispatch(int cnt,
com.ardikars.jxnet.PcapHandler<T> callback,
T user,
java.util.concurrent.Executor executor)
throws com.ardikars.jxnet.exception.PcapCloseException
ContextpcapDispatch in interface ContextT - args type.cnt - maximum iteration, -1 to infinite.callback - callback function.user - arg.executor - executor.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.public com.ardikars.jxnet.PcapCode pcapDumpOpen(java.lang.String fname)
throws com.ardikars.jxnet.exception.PcapCloseException
ContextpcapDumpOpen in interface Contextfname - fname specifies the name of the file to open. The file will have the same format
as those used by tcpdump(1) and tcpslice(1). The name "-" is a synonym for stdout.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.public void pcapDump(com.ardikars.jxnet.PcapPktHdr h,
java.nio.ByteBuffer sp)
throws com.ardikars.jxnet.exception.PcapDumperCloseException
Contextpublic com.ardikars.jxnet.PcapCode pcapCompile(java.lang.String str,
com.ardikars.jxnet.BpfProgram.BpfCompileMode optimize,
int netmask)
throws com.ardikars.jxnet.exception.PcapCloseException,
com.ardikars.jxnet.exception.BpfProgramCloseException
ContextpcapCompile in interface Contextstr - filter expression.optimize - optimize (0/1).netmask - netmask.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.com.ardikars.jxnet.exception.BpfProgramCloseException - bpf program close exception.public com.ardikars.jxnet.PcapCode pcapSetFilter()
throws com.ardikars.jxnet.exception.PcapCloseException,
com.ardikars.jxnet.exception.BpfProgramCloseException
ContextpcapSetFilter in interface Contextcom.ardikars.jxnet.exception.PcapCloseException - pcap close exception.com.ardikars.jxnet.exception.BpfProgramCloseException - bpf program close exception.public com.ardikars.jxnet.PcapCode pcapSendPacket(java.nio.ByteBuffer buf,
int size)
throws com.ardikars.jxnet.exception.PcapCloseException
ContextpcapSendPacket in interface Contextbuf - packet buffer.size - size of packet buffer.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.public java.nio.ByteBuffer pcapNext(com.ardikars.jxnet.PcapPktHdr h)
throws com.ardikars.jxnet.exception.PcapCloseException
Contextpublic com.ardikars.jxnet.PcapCode pcapNextEx(com.ardikars.jxnet.PcapPktHdr pktHeader,
java.nio.ByteBuffer pktData)
throws com.ardikars.jxnet.exception.PcapCloseException
ContextpcapNextEx in interface ContextpktHeader - packet header.pktData - packet buffer.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.public void pcapClose()
throws com.ardikars.jxnet.exception.PcapCloseException
Contextpublic com.ardikars.jxnet.PcapCode pcapDumpFlush()
throws com.ardikars.jxnet.exception.PcapDumperCloseException
ContextpcapDumpFlush in interface Contextcom.ardikars.jxnet.exception.PcapDumperCloseException - pcap dumper close exception.public void pcapDumpClose(com.ardikars.jxnet.PcapDumper pcapDumper)
throws com.ardikars.jxnet.exception.PcapDumperCloseException
ContextpcapDumpClose in interface ContextpcapDumper - pcap dumper object.com.ardikars.jxnet.exception.PcapDumperCloseException - pcap dumper close exception.public com.ardikars.jxnet.DataLinkType pcapDataLink()
throws com.ardikars.jxnet.exception.PcapCloseException
ContextpcapDataLink in interface Contextcom.ardikars.jxnet.exception.PcapCloseException - pcap close exception.public com.ardikars.jxnet.PcapCode pcapSetDataLink(com.ardikars.jxnet.DataLinkType dataLinkType)
throws com.ardikars.jxnet.exception.PcapCloseException
ContextpcapSetDataLink in interface ContextdataLinkType - data link type.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.public void pcapBreakLoop()
throws com.ardikars.jxnet.exception.PcapCloseException
ContextpcapBreakLoop in interface Contextcom.ardikars.jxnet.exception.PcapCloseException - pcap close exception.public java.lang.String pcapGetErr()
throws com.ardikars.jxnet.exception.PcapCloseException
ContextpcapGetErr in interface Contextcom.ardikars.jxnet.exception.PcapCloseException - pcap close exception.public com.ardikars.jxnet.PcapCode pcapIsSwapped()
throws com.ardikars.jxnet.exception.PcapCloseException
ContextpcapIsSwapped in interface Contextcom.ardikars.jxnet.exception.PcapCloseException - pcap close exception.public int pcapSnapshot()
throws com.ardikars.jxnet.exception.PcapCloseException
ContextpcapSnapshot in interface Contextcom.ardikars.jxnet.exception.PcapCloseException - pcap close exception.public int pcapMajorVersion()
throws com.ardikars.jxnet.exception.PcapCloseException
ContextpcapMajorVersion in interface Contextcom.ardikars.jxnet.exception.PcapCloseException - pcap close exception.public int pcapMinorVersion()
throws com.ardikars.jxnet.exception.PcapCloseException
ContextpcapMinorVersion in interface Contextcom.ardikars.jxnet.exception.PcapCloseException - pcap close exception.public com.ardikars.jxnet.PcapCode pcapSetNonBlock(boolean nonblock,
java.lang.StringBuilder errbuf)
throws com.ardikars.jxnet.exception.PcapCloseException
ContextpcapSetNonBlock in interface Contextnonblock - 1 to set non block.errbuf - error buffer.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.public com.ardikars.jxnet.PcapCode pcapGetNonBlock(java.lang.StringBuilder errbuf)
throws com.ardikars.jxnet.exception.PcapCloseException
ContextpcapGetNonBlock in interface Contexterrbuf - error buffer.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.public long pcapDumpFTell()
throws com.ardikars.jxnet.exception.PcapDumperCloseException
ContextpcapDumpFTell in interface Contextcom.ardikars.jxnet.exception.PcapDumperCloseException - pcap dumper close exception.public void pcapFreeCode()
throws com.ardikars.jxnet.exception.BpfProgramCloseException
ContextpcapFreeCode in interface Contextcom.ardikars.jxnet.exception.BpfProgramCloseException - bpf program close exception.public com.ardikars.jxnet.PcapCode pcapStats(com.ardikars.jxnet.PcapStat pcapStat)
throws com.ardikars.jxnet.exception.PcapCloseException
Contextpublic com.ardikars.jxnet.PcapCode pcapCompileNoPcap(int snaplen,
com.ardikars.jxnet.DataLinkType dataLinkType,
java.lang.String filter,
com.ardikars.jxnet.BpfProgram.BpfCompileMode optimize,
com.ardikars.common.net.Inet4Address mask)
throws com.ardikars.jxnet.exception.BpfProgramCloseException
ContextpcapCompileNoPcap in interface Contextsnaplen - snapshot length.dataLinkType - link type.filter - str.optimize - optiomize.mask - netmask.com.ardikars.jxnet.exception.BpfProgramCloseException - bpf program close exception.public void pcapPError(java.lang.String prefix)
throws com.ardikars.jxnet.exception.PcapCloseException
ContextpcapPError in interface Contextprefix - prefix.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.public com.ardikars.jxnet.PcapCode pcapCanSetRfMon()
throws com.ardikars.jxnet.exception.PcapCloseException
ContextpcapCanSetRfMon in interface Contextcom.ardikars.jxnet.exception.PcapCloseException - pcap close exception.public com.ardikars.jxnet.PcapCode pcapSetDirection(com.ardikars.jxnet.PcapDirection direction)
throws com.ardikars.jxnet.exception.PcapCloseException,
com.ardikars.jxnet.exception.PlatformNotSupportedException
ContextPcapSetdirection() isn't necessarily fully supported on all platforms; some platforms might return an error for all values, and some other platforms might not support PCAP_D_OUT.
This operation is not supported if a savefile is being read.
pcapSetDirection in interface Contextdirection - direction.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.com.ardikars.jxnet.exception.PlatformNotSupportedException - platform not supported exception.public com.ardikars.jxnet.PcapTimestampPrecision pcapGetTStampPrecision()
throws com.ardikars.jxnet.exception.PcapCloseException,
com.ardikars.jxnet.exception.PlatformNotSupportedException
ContextpcapGetTStampPrecision in interface Contextcom.ardikars.jxnet.exception.PcapCloseException - pcap close exception.com.ardikars.jxnet.exception.PlatformNotSupportedException - platform not supported exception.public com.ardikars.jxnet.PcapCode pcapListDataLinks(java.util.List<com.ardikars.jxnet.DataLinkType> dtlBuffer)
throws com.ardikars.jxnet.exception.PcapCloseException,
com.ardikars.jxnet.exception.PlatformNotSupportedException
ContextpcapListDataLinks in interface ContextdtlBuffer - datalinks.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.com.ardikars.jxnet.exception.PlatformNotSupportedException - platform not supported exception.public com.ardikars.jxnet.PcapCode pcapListTStampTypes(java.util.List<com.ardikars.jxnet.PcapTimestampType> tstampTypesp)
throws com.ardikars.jxnet.exception.PcapCloseException,
com.ardikars.jxnet.exception.PlatformNotSupportedException
ContextpcapListTStampTypes in interface ContexttstampTypesp - timestamp types.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.com.ardikars.jxnet.exception.PlatformNotSupportedException - platform not supported exception.public com.ardikars.jxnet.PcapCode pcapOfflineFilter(com.ardikars.jxnet.BpfProgram fp,
com.ardikars.jxnet.PcapPktHdr h,
java.nio.ByteBuffer pkt)
ContextpcapOfflineFilter in interface Contextfp - bpfProgramh - pktHdrpkt - buffer.public com.ardikars.jxnet.PcapCode pcapInject(java.nio.ByteBuffer buf,
int size)
throws com.ardikars.jxnet.exception.PcapCloseException,
com.ardikars.jxnet.exception.PlatformNotSupportedException
ContextpcapInject in interface Contextbuf - packet buffer.size - packet size.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.com.ardikars.jxnet.exception.PlatformNotSupportedException - platform not supported exception.Copyright © 2015 - 2018 ardikars.com. All rights reserved.