public final class PcapHandle extends Object
Modifier and Type | Class and Description |
---|---|
static class |
PcapHandle.BlockingMode |
static class |
PcapHandle.Builder |
static class |
PcapHandle.SwappedType |
Modifier and Type | Method and Description |
---|---|
void |
breakLoop()
Breaks a loop which this handle is working on.
|
void |
close()
Closes this PcapHandle.
|
BpfProgram |
compileFilter(String bpfExpression,
BpfProgram.BpfCompileMode mode,
Inet4Address netmask) |
int |
dispatch(int packetCount,
PacketListener listener) |
int |
dispatch(int packetCount,
PacketListener listener,
Executor executor) |
PcapDumper |
dumpOpen(String filePath) |
PcapHandle.BlockingMode |
getBlockingMode() |
DataLinkType |
getDlt() |
String |
getError() |
String |
getFilteringExpression() |
int |
getMajorVersion() |
int |
getMinorVersion() |
Packet |
getNextPacket() |
Packet |
getNextPacketEx() |
int |
getSnapshot() |
PcapStat |
getStat() |
Long |
getTimestampInts() |
Integer |
getTimestampMicros() |
boolean |
isOpen() |
PcapHandle.SwappedType |
isSwapped() |
List<DataLinkType> |
listDatalinks() |
void |
loop(int packetCount,
PacketListener listener)
A wrapper method for "int pcap_loop(pcap_t *, int, pcap_handler, u_char *)".
|
void |
loop(int packetCount,
PacketListener listener,
Executor executor)
A wrapper method for "int pcap_loop(pcap_t *, int, pcap_handler, u_char *)".
|
void |
loop(int packetCount,
PcapDumper dumper) |
void |
sendPacket(Packet packet) |
void |
setBlockingMode(PcapHandle.BlockingMode mode) |
void |
setDlt(DataLinkType dlt) |
void |
setFilter(BpfProgram prog) |
void |
setFilter(String bpfExpression,
BpfProgram.BpfCompileMode mode) |
void |
setFilter(String bpfExpression,
BpfProgram.BpfCompileMode mode,
Inet4Address netmask) |
String |
toString() |
public DataLinkType getDlt()
public void setDlt(DataLinkType dlt) throws PcapNativeException, NotOpenException
dlt
- a DataLinkType
object to setPcapNativeException
NotOpenException
public boolean isOpen()
close()
);
false otherwise.public String getFilteringExpression()
public Long getTimestampInts()
public Integer getTimestampMicros()
public int getSnapshot() throws NotOpenException
NotOpenException
public PcapHandle.SwappedType isSwapped() throws NotOpenException
SwappedType
object.NotOpenException
public int getMajorVersion() throws NotOpenException
NotOpenException
public int getMinorVersion() throws NotOpenException
NotOpenException
public BpfProgram compileFilter(String bpfExpression, BpfProgram.BpfCompileMode mode, Inet4Address netmask) throws PcapNativeException, NotOpenException
bpfExpression
- mode
- netmask
- BpfProgram
object.PcapNativeException
NotOpenException
public void setFilter(String bpfExpression, BpfProgram.BpfCompileMode mode, Inet4Address netmask) throws PcapNativeException, NotOpenException
bpfExpression
- mode
- netmask
- PcapNativeException
NotOpenException
NullPointerException
public void setFilter(String bpfExpression, BpfProgram.BpfCompileMode mode) throws PcapNativeException, NotOpenException
bpfExpression
- mode
- PcapNativeException
NotOpenException
NullPointerException
public void setFilter(BpfProgram prog) throws PcapNativeException, NotOpenException
prog
- PcapNativeException
NotOpenException
public void setBlockingMode(PcapHandle.BlockingMode mode) throws PcapNativeException, NotOpenException
mode
- PcapNativeException
NotOpenException
public PcapHandle.BlockingMode getBlockingMode() throws PcapNativeException, NotOpenException
PcapNativeException
NotOpenException
public Packet getNextPacket() throws NotOpenException
NotOpenException
public Packet getNextPacketEx() throws PcapNativeException, EOFException, TimeoutException, NotOpenException
PcapNativeException
EOFException
TimeoutException
NotOpenException
public void loop(int packetCount, PacketListener listener) throws PcapNativeException, InterruptedException, NotOpenException
packetCount
- listener
- PcapNativeException
InterruptedException
NotOpenException
public void loop(int packetCount, PacketListener listener, Executor executor) throws PcapNativeException, InterruptedException, NotOpenException
packetCount
- listener
- executor
- PcapNativeException
InterruptedException
NotOpenException
public int dispatch(int packetCount, PacketListener listener) throws PcapNativeException, InterruptedException, NotOpenException
packetCount
- listener
- PcapNativeException
InterruptedException
NotOpenException
public int dispatch(int packetCount, PacketListener listener, Executor executor) throws PcapNativeException, InterruptedException, NotOpenException
packetCount
- listener
- executor
- PcapNativeException
InterruptedException
NotOpenException
public PcapDumper dumpOpen(String filePath) throws PcapNativeException
filePath
- "-" means stdout.
The dlt of the PcapHandle which captured the packets you want to dump
must be the same as this dlt.PcapNativeException
public void loop(int packetCount, PcapDumper dumper) throws PcapNativeException, InterruptedException, NotOpenException
packetCount
- dumper
- PcapNativeException
InterruptedException
NotOpenException
public void breakLoop()
public void sendPacket(Packet packet) throws PcapNativeException, NotOpenException
packet
- PcapNativeException
NotOpenException
NullPointerException
public void close()
public PcapStat getStat() throws PcapNativeException, NotOpenException
PcapStat
object.PcapNativeException
NotOpenException
public List<DataLinkType> listDatalinks() throws PcapNativeException, NotOpenException
DataLinkType
PcapNativeException
NotOpenException
public String getError()
Copyright © 2014. All Rights Reserved.