|
|||||||||
| Home >> All >> com >> voytechs >> jnetstream >> primitive >> [ address overview ] | PREV PACKAGE NEXT PACKAGE | ||||||||
Package com.voytechs.jnetstream.primitive.address
JNetStream primitive (datatypes) objects.
See:
Description
| Class Summary | |
| Address | A Class for storing IP Addresses Currently is only designed to utilize IPv4 (32bit) addresses. |
| IpAddress | A Class for storing IP Addresses Currently is only designed to utilize IPv4 (32bit) addresses. |
| IpNetmask | |
| IpNetwork | This class manipulates a IP address as a network address it requires 2 values, address and netmask. |
| IpNumber | A Class for storing IP Addresses Currently is only designed to utilize IPv4 (32bit) byteArrayAddresses. |
| MacAddress | A Class for storing MAC Addresses |
Package com.voytechs.jnetstream.primitive.address Description
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());
|
|||||||||
| Home >> All >> com >> voytechs >> jnetstream >> primitive >> [ address overview ] | PREV PACKAGE NEXT PACKAGE | ||||||||