ARCv2

 view release on metacpan or  search on metacpan

lib/Arc/Connection/Client.pod  view on Meta::CPAN

B<Default value>: 7

=back 

=over 2

=back 

=head3 PROTECTED MEMBERS

=over 2

=item _authenticated I<inherited from Arc::Connection>

B<Description>: Are we authenticated

=item _cmdclientsock I<inherited from Arc::Connection>

B<Description>: IO::Socket for the command connection (encrypted)

B<Default value>: undef

=item _cmdparameter I<inherited from Arc::Connection>

B<Description>: parameter after the command

B<Default value>: undef

=item _connected I<inherited from Arc::Connection>

B<Description>: are we connected

=item _connection I<inherited from Arc::Connection>

B<Description>: IO::Socket for the ARCv2 Connection

B<Default value>: undef

=item _expectedcmds I<inherited from Arc::Connection>

B<Description>: array, which ARCv2 protocol commands are allowed to come next

B<Default value>: undef

=item _select I<inherited from Arc::Connection>

B<Description>: IO::Select for the ARCv2 Connection

B<Default value>: undef

=item _username I<inherited from Arc::Connection>

B<Description>: username extracted from SASL

B<Default value>: "anonymous"

=back 

=over 2

=item _error I<inherited from Arc>

B<Description>: contains the error message

B<Default value>: undef

=item _syslog I<inherited from Arc>

B<Description>: log to syslog or to STDERR

B<Default value>: 1

=back 

=over 2

=back 

=head3 PRIVATE MEMBERS

=head1 Class METHODS

=head3 PUBLIC METHODS

=over 2

=item CommandEnd (  ) 

B<Description>: end the command on the server side.
Closes the command connection and ends the command.


B<Returns:> true if successful, false if not. (IsError is set appropriatly)


B<Example:>

$arc->CommandEnd();


=item CommandEOF (  ) 

B<Description>: close the write part of the netsock.
This function closes the write-part of the command connection.


B<Returns:> true if successful, false if not. (IsError is set appropriatly)


B<Example:>

last unless $arc->CommandEOF();


=item CommandRead (  ) 

B<Description>: read data from the Command connection.


B<Returns:> if successful the received data is returned, otherwise false.


B<Example:>

lib/Arc/Connection/Client.pod  view on Meta::CPAN


B<Description>: ends the connection.
Tells the server that we want to end the conversation. (Userlevel)
Protocol command: QUIT\r\n


B<Returns:> always true


B<Example:>

$arc->Quit();


=item StartSession (  ) 

B<Description>: start an ARCv2 session.
This function which will change the status of the connection into a
authenticated status. Users have to call this function
to be able to run ARCv2 commands afterwards.


B<Returns:> true if authentication was successful, otherwise false.


B<Example:>

if ($arc->StartSession()) { .. }


=back 

=over 2

=item clean (  ) I<inherited from Arc::Connection>

=item IsConnected (  ) I<inherited from Arc::Connection>

B<Description>: are we connected?


B<Returns:> true, if the ARCv2 control connection is connected, otherwise false


B<Example:>

last unless $arc->IsConnected;


=back 

=over 2

=item DESTROY (  ) I<inherited from Arc>

B<Description>: Destructor


=item IsError (  ) I<inherited from Arc>

B<Description>: User function to get the error msg.


B<Returns:> the error message if any otherwise undef


B<Example:>

unless (my $err = $arc->IsError()) { .. } else { print STDERR $err; }


=item Log ( $facility, ... (message) ) I<inherited from Arc>

B<Description>: Log function.
Logs messages to 'logdestination' if 'loglevel' is is set appropriatly.
loglevel behaviour has changed in the 1.0 release of ARCv2, the "Arc"-class can export
LOG_AUTH (authentication information), LOG_USER (connection information), LOG_ERR (errors), 
LOG_CMD (ARCv2 addition internal command information), LOG_SIDE (verbose client/server-specific
information), LOG_DEBUG (verbose debug information). It possible to combine the 
levels with or (resp. +) to allow a message to appear when not all loglevels are 
requested by the user.
Commonly used for logging errors from application level.


B<Returns:> always false


B<Example:>

return $arc->Log(LOG_ERR,"Message");


=item new ( %hash, key => val, ... ) I<inherited from Arc>

B<Description>: Constructor. 
Initializes the object and returns it blessed.
For all sub classes, please override C<_Init> to check the 
parameter which are passed to the C<new> function. This
is necessary because you are not able to call the the new method of a
parent class, when having a class name (new $class::SUPER::new, does not work.).


B<Returns:> blessed object of the class


B<Example:>

my $this = new Arc::Class ( key => value, key2 => value2 );


=back 

=over 2

=back 

=head3 PROTECTED METHODS

=over 2

=item _Authenticate (  ) 

B<Description>: initiate the authentication.
Tells the server which authtype we want to use.
Protocol command: AUTHENTICATE [<authtype>]\r\n


B<Returns:> true when succesful, otherwise false


B<Example:>

$this->_Authenticate();


=item _Cmd ( ... (cmd and parameter) ) 

B<Description>: send an ARCv2 command request
Protocol command: CMD <cmd> <cmdparameter>\r\n


B<Returns:> true when succesful, otherwise false


B<Example:>

$this->_Cmd ("whoami");


=item _Connect (  ) 

B<Description>: connects to the server


B<Returns:> true when succesful, otherwise false


B<Example:>

$this->_Connect();


=item _Init (  ) I<reimplemented from Arc::Connection>

=item _InitARC2 (  ) 

B<Description>: initialize the protocol.
Sends the initial protocol message ARC/2.0


B<Returns:> true when succesful, otherwise false


B<Example:>

$this->_InitARC2();


=item _RAUTH (  ) 

B<Description>: parses the AUTH <list of SASL mech>\r\n, sent by the server


=item _RAUTHTYPE (  ) 

B<Description>: parses the AUTHTYPE <SASL mech>\r\n, sent by the server.
Which SASL mech the server will use.


=item _RCMDERR (  ) 

B<Description>: parses the CMDERR <msg>\r\n, sent by the server.
Command specific error, which reports an error during the command


=item _RCMDPASV (  ) 

B<Description>: parses CMDPASV <host:port>\r\n, sent by the server.
Establish the encrypted command connection.


=item _RDONE (  ) 

B<Description>: parses DONE\r\n, sent by the server.
This is received when a command is done.


=item _RERR (  ) 

B<Description>: parses the ERR <msg>\r\n, sent by the server.
Server command, which reports an server-side error


=item _RSASL (  ) 

B<Description>: parses the SASL <base64 encoded SASL string>\r\n, sent by the server.
Sasl response from the server


=item _StartAuthentication (  ) 

B<Description>: initiate the authentication (sasl)
Creates the sasl object (client_new).
Client begins always and sends the first SASL challenge
Protocol command: SASL <base64 encoded SASL output>\r\n


B<Returns:> true when succesful, otherwise false


B<Example:>

$this->_StartAuthentication();


=item _StepAuthentication ( $first_step ) 

B<Description>: another SASL step.
Response of a SASL command from the server.
Protocol command: SASL <base64 encoded SASL outout>\r\n


B<Returns:> true when succesful, otherwise false


B<Example:>

return $this->_StepAuthentication(1);


=back 

=over 2

=item _CommandConnection (  ) I<inherited from Arc::Connection>

B<Description>: initializes command connection. (protocol)
Starts listen on the Command socket and sends the B<CMDPASV> command.


B<Returns:> true if everything went like expected, otherwise false.


B<Example:>

$this->_CommandConnection();


=item _PrepareAuthentication (  ) I<inherited from Arc::Connection>

B<Description>: initialize sasl.

lib/Arc/Connection/Client.pod  view on Meta::CPAN

it to the other side


B<Returns:> true if successful, otherwise false


B<Example:>

$this->_Sasl($sasl->client_start());


=item _SendCommand ( $cmd, $parameter ) I<inherited from Arc::Connection>

B<Description>: send a command. (protocol)  
Send a command to the ARCv2 socket.


B<Returns:> true if successful, otherwise false


B<Example:>

$this->_SendCommand("CMDPASV",$consock->sockhost.':'.$consock->sockport);


=item _SendLine ( ... (line) ) I<inherited from Arc::Connection>

B<Description>: send a line. (protocol)
This function sends a command line to the ARCv2 socket.


B<Returns:> true if writing has succeeded, otherwise false.


B<Example:>

$this->_SendLine($cmd,"test"); 


=back 

=over 2

=item _Debug ( ... (message) ) I<inherited from Arc>

B<Description>: Debug function.
Logs messages with "DEBUG" 


B<Returns:> always false


B<Example:>

$this->_Debug("hello","world"); # message will be "hello world"


=item _SetError ( ... (message)  ) I<inherited from Arc>

B<Description>: SetError function.
This function prepends the error message (@_) to an existing error message (if any) and
logs the message with LOG_ERR facility.
Use this function for setting an error from class level. Users should use IsError 
to get the message if a function failed.


B<Returns:> always false


B<Example:>

return $this->_SetError("User is not allowed to do this."); # breaks when an error occured


=back 

=over 2

=back 

=head3 PRIVATE METHODS

=head1 SEE ALSO

L<Arc>, L<Arc::Command>, L<Arc::Connection>, 
L<Arc::Connection::Server>, L<Arc::Connection::Client>,
L<arcx>, L<arcxd>, L<Authen::SASL>, L<Authen::SASL::Cyrus>
L<Net::Server::PreFork>

=head1 AUTHOR

 Patrick Boettcher <patrick.boettcher@desy.de>

=head1 COPYRIGHT AND LICENSE

Copyright (c) 2003-5 Patrick Boettcher <patrick.boettcher@desy.de> and others.
All rights reserved.
Zeuthen, Germany, (old) Europe

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

 Special thanks go to:
DESY Zeuthen, in particular:

- Wolfgang Friebel for bleeding edge testing and heavy bug reporting (and the idea of reimplementing ARC).

- Waltraut Niepraschk and Andreas Haupt for their help and support during the development. 

=cut



( run in 0.977 second using v1.01-cache-2.11-cpan-c966e8aa7e8 )