NAME

Net::SAP - Session Announcement Protocol (rfc2974) packet parser

SYNOPSIS

use Net::SAP;

my $sap = Net::SAP->new();

my $packet = $sap->receive();

$sap->close();

DESCRIPTION

Net::SAP currently provides basic functionality for receiving and parsing SAP (RFC2974) multicast packets.

CONSTRUCTORS

$sap = Net::SAP->new()

The new() method is the constructor for the Net::SAP class. When you create a Net::SAP object, it automatically joins the SAP multicast group, ready to start receiving packets.

METHODS

$packet = $sap->receive()

This method blocks until a valid SAP packet has been received. The packet is parsed, decompressed and returned as a hashref:

{
   'a' => 0,	# 0 is origin address is IPv4
   		# 1 if the address IPv6
   'c' => 0,	# 1 if packet was compressed
   'e' => 0,	# 1 if packet was encrypted
   't' => 0,	# 0 if this is an advertizement
   		# 1 for session deletion
   'v' => 1,	# SAP Packet format version number

   # Message ID Hash as 16bit hex number
   'msg_id_hash' => 0x1287,

   # Length of the authentication data
   'auth_len' => 0,	

   # The authentication data as binary
   'auth_data' => '',

   # IP the announcement originated from
   'origin_ip' => '152.78.104.83',	

   # MIME type of the payload
   'payload_type' => 'application/sdp',

   # The payload - usually an SDP file
   'payload' => '',

};
$sap->close()

Leave the SAP multicast group and close the socket.

TODO

Add IPv6 support
Packet decryption and validation
Add support for creating and sending packets.
Add test script as part of build process
Return perl object (Net::SAP::Packet ?) instead of hash ?
Better documentation ?

SEE ALSO

perl(1), IO::Socket::Multicast(3)

http://www.ietf.org/rfc/rfc2974.txt

AUTHOR

Nicholas Humfrey, njh@ecs.soton.ac.uk

COPYRIGHT AND LICENSE

Copyright (C) 2004 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.