jnetpcap.filter.bpf
Class BPFInstruction
java.lang.Object
jnetpcap.filter.bpf.BPFInstruction
public class BPFInstruction
- extends java.lang.Object
A single instruction of a BPF binary program. This is the equivelement
to an assembly instruction. The representation here is more java friendly.
- Author:
- Mark Bednarczyk, Sly Technologies, Inc.
Constructor Summary |
BPFInstruction(byte[] buf,
int offset,
java.nio.ByteOrder encoding)
Initializes the instruction from raw buffer data. |
BPFInstruction(java.nio.ByteBuffer buf,
int offset)
Initializes the instruction from raw buffer data. |
BPFInstruction(int code,
int jt,
int jf,
int k)
|
BPFInstruction(int code,
int jt,
int jf,
long k)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
symbol
public final BPFInstruction.Symbol symbol
code
public final int code
jt
public final int jt
jf
public final int jf
k
public final long k
BPFInstruction
public BPFInstruction(byte[] buf,
int offset,
java.nio.ByteOrder encoding)
throws IllegalInstruction
- Initializes the instruction from raw buffer data. Each instruction is
64-bits wide and has the following structure:
struct bpf_insn { u_short code; u_char jt; u_char jf; bpf_int32 k; };
- Parameters:
buf
- buffer to extract the structure fromoffset
- offset within the buffer to read the structure
- Throws:
IllegalInstruction
BPFInstruction
public BPFInstruction(int code,
int jt,
int jf,
int k)
throws IllegalInstruction
- Throws:
IllegalInstruction
BPFInstruction
public BPFInstruction(java.nio.ByteBuffer buf,
int offset)
- Initializes the instruction from raw buffer data. Each instruction is
64-bits wide and has the following structure:
struct bpf_insn { u_short code; u_char jt; u_char jf; bpf_int32 k; };
- Parameters:
buf
- buffer to extract the structure fromoffset
- offset within the buffer to read the structure
BPFInstruction
public BPFInstruction(int code,
int jt,
int jf,
long k)
- Parameters:
code
- BPF op codejt
- jump addressjf
- jump addressk
- base offset
getK
public final long getK()
- Returns:
- Returns the k.
getCode
public final int getCode()
- Returns:
- Returns the code.
getJf
public final int getJf()
- Returns:
- Returns the jf.
getJt
public final int getJt()
- Returns:
- Returns the jt.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object