|
|||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | ||||||||
See:
Description
| Interface Summary | |
|---|---|
| MutablePrimitive | |
| NumberPrimitive | |
| Primitive | |
| PrimitiveDisplay | This interface deals with setting and getting properties that affect the display of the object. |
| PrimitiveFactory | |
| ProtocolPrimitive | Interface which defines methods for interacting with Primtive at Protocol level. |
| ProtocolPrimitiveFactory | |
| Exception Summary | |
|---|---|
| PrimitiveException | |
JNetStream primitive (datatypes) objects. These objects are used by the
codec and npl package to initialize datatypes in NPL and access contents
of Packet/Header/Field codec objects. As an example the following
primitives are very common and have been defined here:
Various accessor and getter methods are available to get at the data continained within the Primitive. Also various comparison and comparable interfaces are implemented to allow data manipulation and comparisons.
- LongPrimitive
- IntPrimitive
- ShortPrimitive
- BytePrimitive
- AddressPrimitive
- IpAddressPrimitive - supports both V4 and V6 addresses
- MacAddressPrimitive
- DNSAddressPrimitive - resolves compressed DNS addresses by following pointers.
- StringAddressPrimitive
- HexdumpPrimitive - a hexadecimal dump of any number of bytes with their ASCII encoding shown on the side.
- TextPrimitive - Similar to HexdumpPrimitive a hexadecimal dump of any number of bytes with their ASCII encoding shown on the side.
Packet packet = decoder.nextPacket();
Primitive primitive = packet.getHeader("IPv4").getField("src");
IpAddress address = null;
if(primitive != null)
address = (IpAddress)primitive.getValue();
IpNetwork network = new IpNetwork("132.145.167.0", 24);
if(network.isPartOf(address) == true) // Could also do: equals(), compareTo(), put in a sorted map or tree, etc...
System.out.println(address.toString() + " is part of " + network.toString());
else
System.out.println(address.toString() + " is NOT part of " + network.toString());
|
|||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | ||||||||