Acme-RFC4824

 view release on metacpan or  search on metacpan

lib/Acme/RFC4824.pm  view on Meta::CPAN

    my $sfss = Acme::RFC4824->new();
    
    # get IP datagram from somewhere (for example Net::Pcap)
    # print a representation of the SFS frame
    print $sfss->encode({
        TYPE   => 'ASCII art',
        PACKET => $datagram, 
    });

    # get an ASCII representation of the SFS frame
    my $sfs_frame = $sfss->encode({
        TYPE   => 'ASCII',
        PACKET => $datagram,
    });

    # get an SFS frame from somewhere
    # (for example from someone signaling you)
    # get an IP datagram from the frame
    my $datagram = $sfss->decode({
        FRAME => $frame,
    });

=head1 EXPORT

As this module is supposed to be used in an object oriented fashion, it
does not export anything.

=head1 FUNCTIONS

=head2 BUILD

see new()

=head2 new

Constructs a new object for you. Takes the following named parameters:

=over 1

=item * DEFAULT_FRAMESIZE (optional)

The framesize in bytes that is used whenever the FRAMESIZE paramter is
not given for encode. Defaults to 255 bytes (the maximum SFS frame size).

=back

=head2 encode

Encodes an IP datagram into one or more SFS frames. Currently, fragmenting
is not (yet) supported, so it will always encode into one frame (or
complain that the IP packet is too large to encode into one frame).

Takes the following named parameters:

=over 4

=item * TYPE

Determines the output format. Can either be 'ASCII' or 'ASCII art'.
In the first case, a string representation of the SFS frame is returned.
In the second case, an ASCII art representation is returned - as an
array of ASCII art strings in list context or as the concatenation in
scalar context.

=item * PACKET

The IP packet that you want to convert

=item * CHECKSUM (optional)

The checksum algorithm. Only 0 (no checksum) is implemented at the moment.

=item * FRAMESIZE (optional)

The optional maximal frame size of the SFS frame. Will later be used
to fragment, currently only limits the size of the packet you can encode.

=item * GZIP (optional)

Not implemented yet, meant to support the gzipped frame variant of RFC 4824.

=back

=head2 decode

Decodes one or more SFS frame into an IP datagram.

Takes the following named parameters:

=over 4

=item * FRAME

An ASCII representation of the SFS frame which you would like to decode
into an IP datagram.

=back

=head2 ascii2art_map

Read-only accessor for the attribute with the same name.
Returns a hash reference that maps SFS ASCII characters to an ASCII art
representation of the given character. There is probably no need to use
this from the outside.

=head2 default_framesize

Read-only accessor for the attribute with the same name.
Returns the default SFS framesize. There is probably no need to use this
from the outside.

=head2 meta

From Moose.pm: This is a method which provides access to the current class's
meta-class. Only used internally.

=head1 AUTHOR

Alexander Klink, C<< <alech at cpan.org> >>

=head1 BUGS



( run in 1.770 second using v1.01-cache-2.11-cpan-d7f47b0818f )