DESCRIPTIONThis is the base class for all other layer modules. It provides those layers with inheritable attributes, methods, constants and useful subroutines.
- Stores the raw layer (as captured from the network, or packed to send to network).
- Stores what is not part of the layer, that is the encapsulated part to be decoded by upper layers.
- User definable next layer. It may be used to define custom protocols.
- new (hash)
- Object constructor.
- Returns the string describing the layer (example: 'IPv4' for a Net::Frame::Layer::IPv4 object).
Generally, when a layer is built, some attributes are not yet known until all layers that will be assembled are known. Those methods computes various lengths and checksums attributes found in a specific layer. Return 1 on success, undef otherwise. The usage depends from layer to layer, so see related documentation.
Also note that in most cases, you will need to call computeLength before computeChecksums, because checksums may depend upon lengths.
- Packs all attributes into a raw format, in order to inject to network. Returns the raw packed string on success, undef otherwise. Result is stored into raw attribute.
- Unpacks raw data from network and stores attributes into the object. Returns $self on success, undef otherwise.
- Returns the next layer type (parsed from payload). This is the same string as returned by layer method.
- Returns the layer length in bytes.
- Returns the length of layer's payload in bytes.
- Just returns a string in a human readable format describing attributes found in the layer.
- Just returns a string in hexadecimal format which is how the layer appears on the network.
USEFUL SUBROUTINESLoad them: use Net::Frame::Layer qw(:subs);
- getHostIpv4Addr (hostname)
- Resolves IPv4 address of specified hostname.
- getHostIpv4Addrs (hostname)
- Same as above, but returns an array of IPv4 addresses.
- getHostIpv6Addr (hostname)
- Resolves IPv6 address of specified hostname.
- inet6Aton (IPv6 address)
- Takes IPv6 address and returns the network form.
- inet6Ntoa (IPv6 network form)
- Takes IPv6 address in network format, and returns the IPv6 human form.
- inetAton (IPv4 address)
- inetNtoa (IPv4 network form)
- Same as for IPv6, but for IPv4 addresses.
- convertMac (MAC network form)
- Takes a MAC address from network form, and returns the human form.
- Returns respectively a random 16 bits integer, and a random 32 bits integer.
- Returns a random high port (> 1024).
- inetChecksum (pseudo header format)
- Will take a frame in pseudo header format, and compute the INET checksum.
CONSTANTSLoad them: use Net::Frame::Layer qw(:consts);
AUTHORPatrice <GomoR> Auffret
COPYRIGHT AND LICENSECopyright (c) 2006-2015, Patrice <GomoR> Auffret
You may distribute this module under the terms of the Artistic license. See LICENSE.Artistic file in the source distribution archive.