NAME

Net::BEEP::Lite::MgmtProfile

SYNOPSIS

my $mgmt_profile
  = Net::BEEP::Lite::MgmtProfile->new(AllowMultipleChannels => 1)

my $greeting_msg = $mgmt_profile->greeting_message($session);

my $start_channel_msg
  = $mgmt_profile->start_channel_message($session,
        (URI        => "http://xml.resources.org/profiles/NULL/ECHO",
         ServerName => "localhost",
         StartData  => "echo this!"));

DESCRIPTION

This is a subclass of Net::BEEP::Lite::BaseProfile. It is the special profile that deals with the BEEP channel management messages that occur on channel zero. User code is not expected to instantate instances of this class on their own. In general, this is created and used solely by the Net::BEEP::Lite::Session class and its subclasses.

Both server and client sessions use this, as it handles both sides of the conversation.

This profile is designed to be shared between different sessions, just as part of the general design principle for profiles. However, within this framework (and Perl in general) this is unlikely to be actually true (due to forking, or even ithreads).

CONSTRUCTOR

new( ARGS )

This is the main constructor for this class. It takes named parameters as arguments. See the initialize method of this class and the superclass (Net::BEEP::Lite::BaseProfile) for valid argument names.

METHODS

initialize( ARGS )

Initialize the object. This takes the same arguments as the constructor (Indeed, the constructor is just calling this method). This method takes the following named parameters:

AllowMultipleChannels

if false, attempts to start more than one data channel by the peer will fail. This is set to false by default.

allow_multiple_channels([value])

If an argument is given, it is used as the boolean value for whether or not start channel requests should be allowed when there is already an existing open channel. It returns the current (possibly just set) value.

MSG($session, $message)

Handle MSG type messages. This method handles BEEP "<start>" and "<close>" messages. Returns $message.

RPY($session, $message)

This method handles RPY type BEEP messages. It handles "<greeting>", "<ok>", and "<profile>" responses. It returns $message.

ERR($session, $message)

This method handles ERR type messages. Currently, it doesn't really do anything with them. It returns $message.

greeting_message(@profile_uris)

This method returns a formatted Net::BEEP::Lite::Message containing a valid "<greeting>" message. It will advertise the profiles in @profile_uris..

send_greeting_message($session)

Format and send the greeting message to the peer. It uses the session to determine was profiles to advertise.

start_channel_message( ARGS )

This method will return a formatted "<start>" message. It accepts a named parameter list. The following named parameters are accepted:

Channel

The channel number to request. This is usually assigned by the session. It is required.

URI

The profile URI to request. Currently this only allows one URI. This is required.

ServerName

The "server name" to present to the server. Essentially this is the name the client thinks the server is. It is optional.

StartData

Data to piggyback with the start channel request. This is optional.

Encoding

Set this to true of the StartData value is base64 encoded.

send_start_channel_message($session, ARGS)

In addition to the session, the parameters are the same as the named parameters for the start_channel_message method. The 'Channel' parameter may (and usually is) omitted. This method returns the channel number requested, and the message itself

close_channel_message($channel_number, [$code, $content, $lang])

This method will return a formatted "<close>" message. $channel_number is required. $code will default to '200'. $content is optional. $lang is also optional, and is only meaningful if there is content.

send_close_channel_message($session, $channel_number, [$code, $content, $lang])

This method will format and send a "<close>" message. Except for the addition of the $session parameter, the parameters are the same as close_channel_message.

profile_message($uri, [$content, [$encoded]])

Generate a "<profile>" message content for $uri. If $content is provided, include it as text content contained within the <profile> element. If $encoded is set to true, set the 'encoding' attribute to 'base64'.

send_profile_message($session, $uri, [$content, [$encoded]])

Generate and send a "<profile>" message to the peer. Except for the $session paramter, the parameters are the same as for the profile_message method.

SEE ALSO

Net::BEEP::Lite::BaseProfile, Net::BEEP::Lite::Session, and Net::BEEP::Lite::Message