NAME

Agent::TCLI::Transport::Base - Base Class for transports

SYNOPSIS

Use as a base class for a Agent::TCLI::Transport

DESCRIPTION

GETTING STARTED

ATTRIBUTES

The following attributes may be accessed through a combined mutator. If the attribute is an array type, then additional array mutators are available and described below.

controls

A hash of the active controls controls will only accept hash objects.

alias

An alias that the session will be run under. Alias can't be changed after starting.

peers

An array of peers set_peers will only accept ARRAYREF type values.

control_options

A hash of options to pass to a new control object. These are passed straight through as is. See Agent::TCLI::Control for information about the options. control_options will only accept HASHREF type values.

Arrays

Attributes that are typed as arrays also support the following mutators for the lazy: shift_>field< - works the same as shift, returing the shifted member. unshift_>field<(list) - works the same as unshift. pop_>field< - works the same as pop, returing the popped member. push_>field<(list) - works the same as push. depth_>field< - returns the curent size of the array.

METHODS

These methods may be used as is, or subclasses may use them as starting point.

_start

Get things rolling.

_stop

Mostly just a placeholder.

_child

Just a placeholder.

_shutdown

Forcibly shutdown

PackRequest

This object method is used by transports to prepare a request for transmssion.

Currently the code is taking a lazy approach and using Perl's YAML and OIO->dump to safely freeze and thaw the request/responses for Internet transport. By standardizing these routines in the Base class, more elegant methods may be transparently enabled in the future.

PackResponse

This object method is used by transports to prepare a reseponse for transmssion. See PackRequest for more details.

UnpackRequest

This object method is used by transports to unpack a request from transmssion. See PackRequest for more details.

UnpackResponse

This object method is used by transports to unpack a reseponse from transmssion. See PackRequest for more details.

authorized ( { parameters (see usage) } )

Checks to see if a id is authorized to use us.

Usage

$self->authorized ( user@example.com, qr(master|writer), # optional regex for auth qr(xmpp), # optional regex for protocol );

GetControl( <control_id>, <user>, <user_protocol>, [ <user_auth> ] )

GetControl returns a control object for a control_id / user combination. It will return either an existing control or create a new one. All requests for a control are authenticated. Thus when a Transport recieves a new request, user priviledges are rechecked against the latest database if GetControl is used to obtain the Control.

The control_id is a unique ID for the transport to use to identify the control. This is useful in situations where a user may have more than one control active at a time. The user must be a Agent::TCLI::User object. The protocol should be one that the Transport supports and will be matched for authentication. A transport may optionally override the user_auth level. This would be best used to drop to a read only transport, but currently the direction is not enforced.

DeleteControl ( <control_id> )

DeleteControl will remove a reference to Control from the transport. This does not shutdown the Control's POE session, but will allow it to stop if there are no other existing references.

Set

This POE event handler is may be used by a Transport to enable a Package to set attributes in the Transport. It currently is not filtering out anything, so if something should not be accessible, either the Transport needs to implement its own Set, or the Package should apply necessary filters.

Set takes a hash of attribute => value pairs, and the Request object as arguments.

Show

This POE event handler is may be used by a Transport to enable a Package to show current settings in the Transport. It currently is not filtering out anything, so if something should not be shown, either the Transport needs to implement its own Show, or the Package should apply necessary filters.

Show takes the attribute to show and the Request object as arguments.

_default

This POE event handler is used to catch wayard calls to unavailable states. If verbose is on, it makes it rather obvious in the logs that an event was not handled.

AUTHOR

Eric Hacker hacker can be emailed at cpan.org

BUGS

SHOULDS and MUSTS are currently not enforced.

New commands could clobber old ones under certain circumstances.

Test scripts not thorough enough.

Probably many others.

LICENSE

Copyright (c) 2007, Alcatel Lucent, All rights resevred.

This package is free software; you may redistribute it and/or modify it under the same terms as Perl itself.