POE::Component::Lightspeed::Authentication - Protect your local kernel!
use POE; use POE::Component::Lightspeed::Authentication qw( auth_register auth_unregister ); # Spawn your client/server session here and connect to the network # Register a callback for incoming POST messages heading towards session 'MyPrivateSession' auth_register( 'post', \&MyAuthRoutine, 'MyPrivateSession' ); # Register a callback for incoming CALL messages for any session auth_register( 'call', \&MyCallRoutine, '*' ); # Remove our post callback auth_unregister( 'post', 'MyPrivateSession' );
This module presents an easy API to insert Authentication hooks into Lightspeed
All you need to do is import the 2 subroutines provided.
Hooks into incoming post() calls from remote sessions. The hook subroutine will be given these arguments:
- 'post' - Destination session - Destination state - The remote session ( extract information from it via $session->remote_kernel/session/state/file/line )
Hooks into incoming call() calls from remote sessions. The hook subroutine will be given these arguments:
- 'call' - Destination session - Destination state - The RSVP in the format [ KERNEL, SESSION, STATE ] - The remote session ( extract information from it via $session->remote_kernel/session/state/file/line )
Hooks into incoming post() calls from remote sessions replying to a call(). The hook subroutine will be given these arguments:
- 'callreply' - Destination session - Destination state - The remote session ( extract information from it via $session->remote_kernel/session/state/file/line )
Hooks into incoming introspection requests. The hook subroutine will be given these arguments:
- 'introspection' - 'session' or 'state' # The session introspection request will only get 2 more argument: - The RSVP in the format [ KERNEL, SESSION, STATE ] - The remote session ( extract information from it via $session->remote_kernel/session/state/file/line ) # The state introspection request will get 3 more arguments: - The Destination session - The RSVP in the format [ KERNEL, SESSION, STATE ] - The remote session ( extract information from it via $session->remote_kernel/session/state/file/line )
Hooks into incoming monitor requests. The hook subroutine will be given these arguments:
- 'monitor_register' - The various monitor types - The argument for the monitor - The RSVP for the monitor - The remote session ( extract information from it via $session->remote_kernel/session/state/file/line )
- 'monitor_unregister' - The various monitor types - The argument for the monitor - The RSVP for the monitor - The remote session ( extract information from it via $session->remote_kernel/session/state/file/line )
Requires a minimum of 2 arguments - The hook type ( post/call/callreply/introspection ) - The hook subroutine reference The extra argument is the session or the introspection type, defaults to '*' if none was supplied Returns true on success, undef on failure
Requires a minimum of 1 argument - The hook type ( post/call/callreply/introspection ) The extra argument is the session or the introspection type, defaults to '*' if none was supplied Returns true on success, undef on failure
Exports the 2 subs in EXPORT_OK
- It will not run the specific auth hook and the generic auth hook ( '*' ), it picks only one to run! - Certain types of incoming results can have a RSVP going to our own kernel, those messages are not run through the Authentication system, as it doesn't make sense to have the remote information point to ourself... - Yes, the monitor hooks won't work as the Lightspeed::Monitor module is still in the works =]
POE::Component::Lightspeed
Apocalypse <apocal@cpan.org>
Copyright 2005 by Apocalypse
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install POE::Component::Lightspeed, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POE::Component::Lightspeed
CPAN shell
perl -MCPAN -e shell install POE::Component::Lightspeed
For more information on module installation, please visit the detailed CPAN module installation guide.