org.jnetstream.protocol
Class ProtocolRegistry
java.lang.Object
org.jnetstream.protocol.ProtocolRegistry
public final class ProtocolRegistry
- extends java.lang.Object
Main protocol registry. The registry contains the master list of all known
protocols and their bindings. You can iterate through each of the known
protocols or iterate through all of the protocol bindings.
Protocol bindings define how each protocol is linked or bound to another. For
example IP protocol is bound to Ethernet frame using etherenet's protocol
field when the value of that field is 0x800 in hex. Any number of bindings
can be specified for any given protocol. In our example above ip protocol is
the source protocol (the one linking to) and Ethernet is the sink
protocol (the one being linked to.)
IPv4 = link Ethernet 0x800 HTTP = link TCP sport == 80 || dport == 80
The registry also contains a list of all of the known protocols. You can
retrieve them using the getProtocols() method. Not all the protocols may be
loaded into the registry for efficiency. But all the protocols are discovered
and Protocol object is created to represent, in somecases a place holder, for
all of the known protocols. You can use the Protocol.isLoaded() method to
find out if a protocol is actually loaded. Before any packets are dissected
(parsed), none of the protocols may be loaded. Protocols may be loaded on
demand only when needed. They may also be loaded upfront, this behaviour is
release dependent and may be altered via global user accessible properties.
- Since:
- 0.2.4
- Author:
- Mark Bednarczyk, Sly Technologies, Inc.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_DATA_INDEX
public static final int DEFAULT_DATA_INDEX
- See Also:
- Constant Field Values
ProtocolRegistry
public ProtocolRegistry()
addProtocol
public static ProtocolEntry addProtocol(Protocol protocol)
- Parameters:
protocol -
- Returns:
addTranslation
public static void addTranslation(java.lang.Class<? extends FileCapture<? extends FilePacket>> c,
Protocol proto,
int value)
- Parameters:
class1 - proto - value -
getPacketFactory
public static <T extends PacketFactory<? extends Packet>> T getPacketFactory(java.lang.Class<T> c,
java.lang.String defaults)
- Type Parameters:
T - - Parameters:
c - defaults -
- Returns:
getProtocolEntry
public static DefaultProtocolEntry getProtocolEntry(Protocol protocol)
getScanner
public static Scanner getScanner(java.lang.String defaults)
- Packet buffer scanner for headers
- Returns:
init
public static void init()
- Uses factory loader to initialize protocols and protocol translators
loadProtocolBinding
public static ProtocolBinding loadProtocolBinding(ProtocolBinding binding)
- Parameters:
binding -
- Returns:
lookup
public static ProtocolEntry lookup(java.lang.Class<? extends Header> c)
- Parameters:
c -
- Returns:
lookup
public static ProtocolEntry lookup(Protocol protocol)
- Parameters:
protocol -
- Returns:
translate
public static Protocol translate(java.lang.Class<? extends FileCapture<? extends FilePacket>> c,
int raw)
- Parameters:
c - raw -
- Returns:
translate
public static int translate(java.lang.Class<? extends FileCapture<? extends FilePacket>> c,
Protocol p)
- Parameters:
c - p -
- Returns:
lookup
public static ProtocolEntry lookup(int index)
- Parameters:
index -
- Returns:
getDataIndex
public static int getDataIndex()
- Returns: