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!"));
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).
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.
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:
if false, attempts to start more than one data channel by the peer will fail. This is set to false by default.
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.
Handle MSG type messages. This method handles BEEP "<start>" and "<close>" messages. Returns $message.
This method handles RPY type BEEP messages. It handles "<greeting>", "<ok>", and "<profile>" responses. It returns $message.
This method handles ERR type messages. Currently, it doesn't really do anything with them. It returns $message.
This method returns a formatted
Net::BEEP::Lite::Message containing a valid "<greeting>" message. It will advertise the profiles in @profile_uris..
Format and send the greeting message to the peer. It uses the session to determine was profiles to advertise.
This method will return a formatted "<start>" message. It accepts a named parameter list. The following named parameters are accepted:
The channel number to request. This is usually assigned by the session. It is required.
The profile URI to request. Currently this only allows one URI. This is required.
The "server name" to present to the server. Essentially this is the name the client thinks the server is. It is optional.
Data to piggyback with the start channel request. This is optional.
Set this to true of the StartData value is base64 encoded.
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
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.
This method will format and send a "<close>" message. Except for the addition of the $session parameter, the parameters are the same as
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'.
Generate and send a "<profile>" message to the peer. Except for the $session paramter, the parameters are the same as for the