public interface Context extends com.ardikars.common.util.Factory<Context,com.ardikars.common.util.Builder<com.ardikars.jxnet.Pcap,java.lang.Void>>
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getApplicationDisplayName() |
java.lang.String |
getApplicationName() |
java.lang.String |
getApplicationVersion() |
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.
|
java.lang.String getApplicationName()
java.lang.String getApplicationDisplayName()
java.lang.String getApplicationVersion()
<T> com.ardikars.jxnet.PcapCode pcapLoop(int cnt,
com.ardikars.jxnet.PcapHandler<T> callback,
T user)
throws com.ardikars.jxnet.exception.PcapCloseException
T - args type.cnt - maximum iteration, -1 is infinite iteration.callback - callback funtion.user - argscom.ardikars.jxnet.exception.PcapCloseException - pcap close exception.<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
T - args type.cnt - maximum iteration, -1 is infinite iteration.callback - callback funtion.user - argsexecutor - executor service.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.<T> com.ardikars.jxnet.PcapCode pcapDispatch(int cnt,
com.ardikars.jxnet.PcapHandler<T> callback,
T user)
throws com.ardikars.jxnet.exception.PcapCloseException
T - args type.cnt - maximum iteration, -1 to infinite.callback - callback function.user - arg.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.<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
T - args type.cnt - maximum iteration, -1 to infinite.callback - callback function.user - arg.executor - executor.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.com.ardikars.jxnet.PcapCode pcapDumpOpen(java.lang.String fname)
throws com.ardikars.jxnet.exception.PcapCloseException
fname - 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.void pcapDump(com.ardikars.jxnet.PcapPktHdr h,
java.nio.ByteBuffer sp)
throws com.ardikars.jxnet.exception.PcapDumperCloseException
h - pcap packet header.sp - packet buffer.com.ardikars.jxnet.exception.PcapDumperCloseException - pcap dumper close exception.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
str - 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.com.ardikars.jxnet.PcapCode pcapSetFilter()
throws com.ardikars.jxnet.exception.PcapCloseException,
com.ardikars.jxnet.exception.BpfProgramCloseException
com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.com.ardikars.jxnet.exception.BpfProgramCloseException - bpf program close exception.com.ardikars.jxnet.PcapCode pcapSendPacket(java.nio.ByteBuffer buf,
int size)
throws com.ardikars.jxnet.exception.PcapCloseException
buf - packet buffer.size - size of packet buffer.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.java.nio.ByteBuffer pcapNext(com.ardikars.jxnet.PcapPktHdr h)
throws com.ardikars.jxnet.exception.PcapCloseException
h - packet header.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.com.ardikars.jxnet.PcapCode pcapNextEx(com.ardikars.jxnet.PcapPktHdr pktHeader,
java.nio.ByteBuffer pktData)
throws com.ardikars.jxnet.exception.PcapCloseException
pktHeader - packet header.pktData - packet buffer.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.void pcapClose()
throws com.ardikars.jxnet.exception.PcapCloseException
com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.com.ardikars.jxnet.PcapCode pcapDumpFlush()
throws com.ardikars.jxnet.exception.PcapDumperCloseException
com.ardikars.jxnet.exception.PcapDumperCloseException - pcap dumper close exception.void pcapDumpClose(com.ardikars.jxnet.PcapDumper pcapDumper)
throws com.ardikars.jxnet.exception.PcapDumperCloseException
pcapDumper - pcap dumper object.com.ardikars.jxnet.exception.PcapDumperCloseException - pcap dumper close exception.com.ardikars.jxnet.DataLinkType pcapDataLink()
throws com.ardikars.jxnet.exception.PcapCloseException
com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.com.ardikars.jxnet.PcapCode pcapSetDataLink(com.ardikars.jxnet.DataLinkType dataLinkType)
throws com.ardikars.jxnet.exception.PcapCloseException
dataLinkType - data link type.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.void pcapBreakLoop()
throws com.ardikars.jxnet.exception.PcapCloseException
com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.java.lang.String pcapGetErr()
throws com.ardikars.jxnet.exception.PcapCloseException
com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.com.ardikars.jxnet.PcapCode pcapIsSwapped()
throws com.ardikars.jxnet.exception.PcapCloseException
com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.int pcapSnapshot()
throws com.ardikars.jxnet.exception.PcapCloseException
com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.int pcapMajorVersion()
throws com.ardikars.jxnet.exception.PcapCloseException
com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.int pcapMinorVersion()
throws com.ardikars.jxnet.exception.PcapCloseException
com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.com.ardikars.jxnet.PcapCode pcapSetNonBlock(boolean nonblock,
java.lang.StringBuilder errbuf)
throws com.ardikars.jxnet.exception.PcapCloseException
nonblock - 1 to set non block.errbuf - error buffer.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.com.ardikars.jxnet.PcapCode pcapGetNonBlock(java.lang.StringBuilder errbuf)
throws com.ardikars.jxnet.exception.PcapCloseException
errbuf - error buffer.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.long pcapDumpFTell()
throws com.ardikars.jxnet.exception.PcapDumperCloseException
com.ardikars.jxnet.exception.PcapDumperCloseException - pcap dumper close exception.void pcapFreeCode()
throws com.ardikars.jxnet.exception.BpfProgramCloseException
com.ardikars.jxnet.exception.BpfProgramCloseException - bpf program close exception.com.ardikars.jxnet.PcapCode pcapStats(com.ardikars.jxnet.PcapStat pcapStat)
throws com.ardikars.jxnet.exception.PcapCloseException
pcapStat - pcap stat object.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.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
snaplen - snapshot length.dataLinkType - link type.filter - str.optimize - optiomize.mask - netmask.com.ardikars.jxnet.exception.BpfProgramCloseException - bpf program close exception.void pcapPError(java.lang.String prefix)
throws com.ardikars.jxnet.exception.PcapCloseException
prefix - prefix.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.com.ardikars.jxnet.PcapCode pcapCanSetRfMon()
throws com.ardikars.jxnet.exception.PcapCloseException
com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.com.ardikars.jxnet.PcapCode pcapSetDirection(com.ardikars.jxnet.PcapDirection direction)
throws com.ardikars.jxnet.exception.PcapCloseException,
com.ardikars.jxnet.exception.PlatformNotSupportedException
PcapSetdirection() 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.
direction - direction.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.com.ardikars.jxnet.exception.PlatformNotSupportedException - platform not supported exception.com.ardikars.jxnet.PcapTimestampPrecision pcapGetTStampPrecision()
throws com.ardikars.jxnet.exception.PcapCloseException,
com.ardikars.jxnet.exception.PlatformNotSupportedException
com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.com.ardikars.jxnet.exception.PlatformNotSupportedException - platform not supported exception.com.ardikars.jxnet.PcapCode pcapListDataLinks(java.util.List<com.ardikars.jxnet.DataLinkType> dtlBuffer)
throws com.ardikars.jxnet.exception.PcapCloseException,
com.ardikars.jxnet.exception.PlatformNotSupportedException
dtlBuffer - datalinks.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.com.ardikars.jxnet.exception.PlatformNotSupportedException - platform not supported exception.com.ardikars.jxnet.PcapCode pcapListTStampTypes(java.util.List<com.ardikars.jxnet.PcapTimestampType> tstampTypesp)
throws com.ardikars.jxnet.exception.PcapCloseException,
com.ardikars.jxnet.exception.PlatformNotSupportedException
tstampTypesp - timestamp types.com.ardikars.jxnet.exception.PcapCloseException - pcap close exception.com.ardikars.jxnet.exception.PlatformNotSupportedException - platform not supported exception.com.ardikars.jxnet.PcapCode pcapOfflineFilter(com.ardikars.jxnet.BpfProgram fp,
com.ardikars.jxnet.PcapPktHdr h,
java.nio.ByteBuffer pkt)
fp - bpfProgramh - pktHdrpkt - buffer.com.ardikars.jxnet.PcapCode pcapInject(java.nio.ByteBuffer buf,
int size)
throws com.ardikars.jxnet.exception.PcapCloseException,
com.ardikars.jxnet.exception.PlatformNotSupportedException
buf - 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.