|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jnetpcap.packet.JRegistry
public final class JRegistry
A registry of protocols, their classes, runtime IDs and bindings. This is a global registry that all of jnetpcap's packet framework accesses. The registry matains tables of bindings, header scanners and numerical IDs for each header. The registry also performs various lookup and cross reference infomatation such as mapping a header class to a numerical ID.
| Field Summary | |
|---|---|
static int |
CORE_ID_COUNT
Number of core protocols defined by jNetPcap |
static int |
FLAG_OVERRIDE_BINDING
A flag that allows tells that a java scanner's process bindings method has been overriden |
static int |
FLAG_OVERRIDE_LENGTH
A flag that allows tells that a java scanner's get length method has been overriden |
static int |
MAX_ID_COUNT
Maximum number of protocol header entries allowed by this implementation of JRegistry |
static int |
NO_DLT_MAPPING
A constant if returned from #mapDltToId or mapIdToDLT(int) that
no mapping exists. |
| Method Summary | ||
|---|---|---|
static
|
addAnalyzer(T analyzer)
|
|
static void |
addBindings(java.lang.Class<?> container)
Adds bindings found in the container class. |
|
static void |
addBindings(JBinding... bindings)
Adds additional bindings to a particular protocol |
|
static void |
addBindings(java.lang.Object bindingContainer)
Adds all of the bindings found in the bindinsContainer object supplied. |
|
static void |
clearErrors()
Clears any existing registery errors |
|
static void |
clearFlags(int id,
int flags)
Clears the supplied bits within the flag's bitmap |
|
static void |
clearScanners(java.lang.Class<? extends JHeader>... classes)
Clears java scanners for supplied list of headers |
|
static void |
clearScanners(int... ids)
Clears java scanners for supplied list of headers |
|
static void |
clearScanners(java.lang.Object container)
Removes previously registered scanners that are defined in the supplied object container. |
|
static
|
getAnalyzer(java.lang.Class<T> c)
|
|
static JBinding[] |
getBindings(int id)
Retrieves all current bindings bound to a protocol |
|
static HeaderDefinitionError[] |
getErrors()
Retrieves the recent errors that were generated by registry operations |
|
static int |
getFlags(int id)
Gets the current flags for a specified protocol |
|
static JHeaderScanner[] |
getHeaderScanners()
Retrieves the entire list of scanners for all registered protocols |
|
static Resolver |
getResolver(java.lang.Object customType)
Retrieves a registered instance of any resolver. |
|
static Resolver |
getResolver(Resolver.ResolverType type)
Retrieves a registered instance of a resolver. |
|
static boolean |
hasDltMapping(int dlt)
Checks if a mapping for libpcap dlt value is defined |
|
static boolean |
hasErrors()
Checks if there are any registry errors that were recently generated |
|
static boolean |
hasResolver(java.lang.Object type)
Checks if resolver of specific type is currently registered |
|
static boolean |
hasResolver(Resolver.ResolverType type)
Checks if resolver of specific type is currently registered |
|
static AnnotatedHeader |
inspect(java.lang.Class<? extends JHeader> c,
java.util.List<HeaderDefinitionError> errors)
|
|
static java.lang.Object[] |
listResolvers()
Returns a complete list of currently active resolvers types. |
|
static AnnotatedHeader |
lookupAnnotatedHeader(java.lang.Class<? extends JHeader> c)
|
|
static AnnotatedHeader |
lookupAnnotatedHeader(int id)
|
|
static AnnotatedHeader |
lookupAnnotatedHeader(JProtocol protocol)
|
|
static java.lang.Class<? extends JHeader> |
lookupClass(int id)
Looks up the class of a header based on its ID. |
|
static int |
lookupId(java.lang.Class<? extends JHeader> c)
Look's up the protocol header ID using a class name |
|
static int |
lookupId(JProtocol p)
Look's up the protocol header ID using a protocol constant. |
|
static JHeaderScanner |
lookupScanner(int id)
Looks up a header scanner. |
|
static int |
mapDLTToId(int dlt)
|
|
static int |
mapIdToDLT(int id)
|
|
static PcapDLT |
mapIdToPcapDLT(int id)
|
|
static int |
register(java.lang.Class<? extends JHeader> c)
|
|
static int |
register(java.lang.Class<? extends JHeader> c,
java.util.List<HeaderDefinitionError> errors)
Registeres a new protocol header. |
|
static void |
registerDLT(int dlt,
int id)
|
|
static void |
registerDLT(PcapDLT dlt,
int id)
|
|
static void |
registerResolver(java.lang.Object customType,
Resolver custom)
Registers a new resolver of any type, replacing the previous resolver. |
|
static void |
registerResolver(Resolver.ResolverType type,
Resolver custom)
Registers a new resolver of specific type, replacing the previous resolver. |
|
static void |
resetBindings(int id)
Clears any existing java bindings for the specified protocol |
|
static void |
setFlags(int id,
int flags)
Sets the current flag for a specified protocol |
|
static void |
setScanners(AnnotatedScannerMethod... scanners)
|
|
static void |
setScanners(java.lang.Class<?> c)
|
|
static void |
setScanners(java.lang.Object container)
|
|
static void |
shutdown()
Prepares the registry for shutdown. |
|
static java.lang.String |
toDebugString()
Dumps various tables JRegistry maintains as debug information. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int CORE_ID_COUNT
public static final int FLAG_OVERRIDE_BINDING
public static final int FLAG_OVERRIDE_LENGTH
public static final int MAX_ID_COUNT
public static final int NO_DLT_MAPPING
#mapDltToId or mapIdToDLT(int) that
no mapping exists.
| Method Detail |
|---|
public static void addBindings(java.lang.Class<?> container)
Bind annotation defined will be extracted and wrapped as
JBinding interface objects, suitable to be registered with
for a target header. Bindings contained in any class that does not extend
JHeader is required to provide both "to" and "from"
parameters to Bind annotation.
container - container that has static bind methodspublic static void addBindings(JBinding... bindings)
id - bindings - public static void addBindings(java.lang.Object bindingContainer)
Bind annotation, will be extracted and
converted to JBinding objects that will call on those methods as a binding.
The "this" pointer in the instance methods will be set to null, therefore
do not rely on any super methods and "this" operator. The bind annotation
inspector check and ensure that only "Object" class is extended for the
container class.
bindingContainer - container object that contains binding instance methodspublic static void clearErrors()
public static void clearFlags(int id,
int flags)
id - protocol IDflags - flags to clearpublic static void clearScanners(java.lang.Class<? extends JHeader>... classes)
classes - classes of all the headers that java scanner will be cleared if
previously registeredpublic static void clearScanners(int... ids)
ids - ids of all the headers that java scanner will be cleared if
previously registeredpublic static void clearScanners(java.lang.Object container)
container - container object containing scanner methods which target headers
that will be cleared of java scannerspublic static JBinding[] getBindings(int id)
id - protocol id
public static HeaderDefinitionError[] getErrors()
public static int getFlags(int id)
id - numerical id of the protocol header
public static JHeaderScanner[] getHeaderScanners()
public static Resolver getResolver(java.lang.Object customType)
customType - resolver type
public static <T extends JAnalyzer> T getAnalyzer(java.lang.Class<T> c)
public static <T extends JAnalyzer> void addAnalyzer(T analyzer)
public static Resolver getResolver(Resolver.ResolverType type)
type - resolver type
public static boolean hasDltMapping(int dlt)
dlt - value to check for
public static boolean hasErrors()
public static boolean hasResolver(java.lang.Object type)
type - type of resolver to check for
public static boolean hasResolver(Resolver.ResolverType type)
type - type of resolver to check for
public static AnnotatedHeader inspect(java.lang.Class<? extends JHeader> c,
java.util.List<HeaderDefinitionError> errors)
public static java.lang.Object[] listResolvers()
public static AnnotatedHeader lookupAnnotatedHeader(java.lang.Class<? extends JHeader> c)
throws UnregisteredHeaderException
UnregisteredHeaderException
public static AnnotatedHeader lookupAnnotatedHeader(int id)
throws UnregisteredHeaderException
UnregisteredHeaderExceptionpublic static AnnotatedHeader lookupAnnotatedHeader(JProtocol protocol)
protocol -
public static java.lang.Class<? extends JHeader> lookupClass(int id)
throws UnregisteredHeaderException
id - protocol id
UnregisteredHeaderException
UnregisteredHeaderException - thrown if protocol not found, invalid IDpublic static int lookupId(java.lang.Class<? extends JHeader> c)
c - class of the header
UnregisteredHeaderException - if header class is not registeredpublic static int lookupId(JProtocol p)
p - protocol constant
public static JHeaderScanner lookupScanner(int id)
id - id of the scanner to lookup
public static int mapDLTToId(int dlt)
public static int mapIdToDLT(int id)
public static PcapDLT mapIdToPcapDLT(int id)
public static int register(java.lang.Class<? extends JHeader> c)
throws RegistryHeaderErrors
RegistryHeaderErrors
public static int register(java.lang.Class<? extends JHeader> c,
java.util.List<HeaderDefinitionError> errors)
T - header class typec - class of the headerscan - header scanner that will perform header scans and check bindingsbindings - protocol to protocol bindings for this protocol
RegistryHeaderErrors
public static void registerDLT(int dlt,
int id)
public static void registerDLT(PcapDLT dlt,
int id)
public static void registerResolver(java.lang.Object customType,
Resolver custom)
customType - type of resolver to replacecustom - new resolver to register
public static void registerResolver(Resolver.ResolverType type,
Resolver custom)
type - type of resolver to replacecustom - new resolver to registerpublic static void resetBindings(int id)
id - numerical id of the protocol header
public static void setFlags(int id,
int flags)
id - numerical id of the protocol headerflags - flags to set (bitwise OR) with the existing flagspublic static void setScanners(AnnotatedScannerMethod... scanners)
public static void setScanners(java.lang.Class<?> c)
public static void setScanners(java.lang.Object container)
container -
public static void shutdown()
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String toDebugString()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||