public class SllFramer extends Object implements Framer<PCapPacket,MACPacket>
| Constructor and Description |
|---|
SllFramer() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(Buffer buffer)
(taken from pcap/sll.sh)
For captures on Linux cooked sockets, we construct a fake header that
includes:
a 2-byte "packet type" which is one of:
LINUX_SLL_HOST packet was sent to us LINUX_SLL_BROADCAST packet was
broadcast LINUX_SLL_MULTICAST packet was multicast LINUX_SLL_OTHERHOST
packet was sent to somebody else LINUX_SLL_OUTGOING packet was sent *by*
us;
a 2-byte Ethernet protocol field;
a 2-byte link-layer type;
a 2-byte link-layer address length;
an 8-byte source link-layer address, whose actual length is specified by
the previous value.
|
MACPacket |
frame(PCapPacket parent,
Buffer buffer)
Ask the framer to frame the buffer into a packet.
|
Protocol |
getProtocol() |
public Protocol getProtocol()
getProtocol in interface Framer<PCapPacket,MACPacket>public MACPacket frame(PCapPacket parent, Buffer buffer) throws IOException
Packet has not been parsed, just framed.frame in interface Framer<PCapPacket,MACPacket>parent - the parent frame or null if the frame doesn't have one.buffer - the buffer containing all the raw dataIOException - in case something goes wrong when reading data from the
bufferpublic boolean accept(Buffer buffer) throws IOException
Framer will read a few bytes in an effort to
figure out if the incoming data may be something it recognizes. E.g., a
HTTP Framer could check if the first bytes match "GET", "POST",
"PUT" and "DELETE" if if so assume that the payload indeed is HTTP and
therefore return true. Of course, you may never really know until you
actually have parsed the entire body but this method should return quick
and if turns out that the data isn't what it thought, throw an exception
and the framework will take care of it.accept in interface Framer<PCapPacket,MACPacket>buffer - the data to check whether it could be a frame of this typeIOExceptionCopyright © 2021. All Rights Reserved.