|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jnetpcap.PcapBpfProgram
public class PcapBpfProgram
Class peered with native bpf_program structure. Instance of a
compiled Berkley Packet Filter program. The program is an interpreted binary
byte program. Most modern unix and windows systems have a BPF interpreter
builtin and execute the code very efficiently, close to the source of the
capture and use the filter to permit or reject packets early.
Special note:
There also 2 private constructors which allow the object to be initialized in
Java space with a BPF program. The corresponding native C structures are
created and can be passed to Pcap.setFilter method. At this
time, the constructors are kept private for further testing. At some point
these private constructors will be made public and will allow outside filters
to be used with Pcap capture sessions.
| Constructor Summary | |
|---|---|
PcapBpfProgram()
Special constructor that allows creation of empty object ready for initialization. |
|
PcapBpfProgram(byte[] instructions)
Allocates a peering C structure and initializes it with data from the supplied buffer |
|
PcapBpfProgram(java.nio.ByteBuffer instructions)
Allocates a peering C structure and initializes it with data from the supplied buffer |
|
| Method Summary | |
|---|---|
protected void |
finalize()
Cleans up JNI resources and releases any unreleased BPF programs in native land. |
long |
getInstruction(int index)
Retrieves a single BPF instruction which is 8 bytes long and is encoded into the long interger returned. |
int |
getInstructionCount()
Gets the exact number of BPF instructions within this program. |
long[] |
toLongArray()
Retrieves a program as an array of longs. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PcapBpfProgram()
Pcap.compile(PcapBpfProgram, String, int, int),
Pcap.compileNoPcap(int, int, PcapBpfProgram, String, int, int)public PcapBpfProgram(byte[] instructions)
instructions - buffer containing BPF instructionspublic PcapBpfProgram(java.nio.ByteBuffer instructions)
instructions - buffer containing BPF instructions| Method Detail |
|---|
protected void finalize()
finalize in class java.lang.Objectpublic int getInstructionCount()
public long getInstruction(int index)
index - index of the instruction
public long[] toLongArray()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||