Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

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:

  1. LongPrimitive
  2. IntPrimitive
  3. ShortPrimitive
  4. BytePrimitive
  5. AddressPrimitive
  6. IpAddressPrimitive - supports both V4 and V6 addresses
  7. MacAddressPrimitive
  8. DNSAddressPrimitive - resolves compressed DNS addresses by following pointers.
  9. StringAddressPrimitive
  10. HexdumpPrimitive - a hexadecimal dump of any number of bytes with their ASCII encoding shown on the side.
  11. TextPrimitive - Similar to HexdumpPrimitive a hexadecimal dump of any number of bytes with their ASCII encoding shown on the side.
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.

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());