Net::SAP::Packet - A SAP Packet
use Net::SAP::Packet; my $packet = new Net::SAP::Packet(); $packet->type( 'advertisement' ); $packet->compressed( 0 ); $packet->payload( $sdp_data );
The Net::SAP::Packet class represents a single SAP Packet. It provides methods for getting and setting the properties of the packet.
Net::SAP::Packet
Creates a new Net::SAP::Packet object with default values for all the properties. Takes an optional parameter which is passed straight to parse() if given.
parse()
Parses a binary packet (as received from the network) and stores its data in the object. Returns non-zero if the binary data is invalid.
Generates a binary packet from the properties stored in the perl object. Returned undefined if there is a problem creating the packet. This method also calculates the message id hash field for the packet and compresses it if the compressed() field is set.
compressed()
Get or Set the family of the origin address (either ipv4 or ipv6).
Example:
$type = $packet->origin_address_type(); $packet->origin_address_type( 'ipv6' );
Get or Set the origin address (IPv4 or IPv6 address of the host sending the packet). Be sure to also set the address type using origin_address_type().
origin_address_type()
$origin = $packet->origin_address(); $packet->origin_address( '152.78.104.83' );
Get or Set wether the packet was, or should be compressed. Note that the payload of the SAP packet should be no more than 1024 bytes. So compression should be used is the raw data is more than that.
$compressed = $packet->compressed(); $packet->compressed( 1 );
Get or Set the packet type - advertisement or deletion. A delete packet is used to instruct clients that a previously advertised session is now no longer valid.
$type = $packet->type(); $packet->type( 'advertisement' ); $packet->type( 'deletion' );
Get the SAP version number of a received packet. Usually 1 or 0. See the end of RFC2974 for a description of the difference between packet versions. All packets created using Net::SAP are version 1.
Net::SAP
Get the Message ID Hash for the packet. The hash for a new packet is calculated when calling generate(). The hash is a 16-bit unsigned integer (0 to 65535).
generate()
Gets whether a packet is encrypted or not. Note that Net::SAP can't currently encrypt or de-crypt packets.
Gets the length of the packet's encryption key. Note that Net::SAP can't currently encrypt or decrypt packets.
Gets the encryption key for a packet. Returns undefined value if there is no encryption key for the packet. Note that Net::SAP can't currently encrypt or de-crypt packets.
Get or Set the packet's payload type. This field should be a MIME type. The default MIME type for packets is 'application/sdp'.
$mime = $packet->payload_type(); $packet->payload_type( 'application/sdp' );
Get or Set the packet's payload.
$payload = $packet->payload(); $packet->payload( $sdp_data );
Net::SAP, Net::SDP, perl(1)
http://www.ietf.org/rfc/rfc2974.txt
Please report any bugs or feature requests to bug-net-sap@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you will automatically be notified of progress on your bug as I make changes.
bug-net-sap@rt.cpan.org
Nicholas Humfrey, njh@ecs.soton.ac.uk
Copyright (C) 2004-2006 University of Southampton
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.005 or, at your option, any later version of Perl 5 you may have available.
To install Net::SAP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::SAP
CPAN shell
perl -MCPAN -e shell install Net::SAP
For more information on module installation, please visit the detailed CPAN module installation guide.