ARCv2

 view release on metacpan or  search on metacpan

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

=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:>

while (my $data = $arc->CommandRead()) { ... }


=item CommandStart ( ... (command and its parameters) ) 

B<Description>: start an ARCv2 command
This function starts the given ARCv2 Command and enables the Command* functions.


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


B<Example:>

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


=item CommandWrite ( ... (data) ) 

B<Description>: write something to the command.
Write something to the standard input of the command started by C<CommandStart>.


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


B<Example:>

last unless $this->CommandWrite();


=item ProcessCommand ( ... (command and its parameters) ) 

B<Description>: process a command.
This function runs a command with STDIN and STDOUT as clients 
in- and output control.


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


B<Example:>

$arc->ProcessCommand("whoami");


=item Quit (  ) 

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 

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



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.
This function initializes the C<__sasl> member with an object
of C<Authen::SASL>.


B<Returns:> true if successful, otherwise false


B<Example:>

$this->_PrepareAuthentication() || return;


=item _ProcessLine ( $cmd ) I<inherited from Arc::Connection>

B<Description>: process an ARCv2 command. (protocol)
Process a command by evaling $this->_R$cmd. Also checks if 
this command was expected now (looks into the $this->{_expectedcmds} array). 
Used by client and server.


B<Returns:> true, if ARCv2 command has been in place, otherwise false


B<Example:>

while (my $cmd = $this->_RecvCommand() && $this->_ProcessLine($cmd)) {}


=item _ReadWriteBinary ( *locfdin, *locfdout ) I<inherited from Arc::Connection>

B<Description>: function for reading and writing on the command connection.
This function is always used by the C<Arc::Connection::Server> to handle 
command data. When calling the C<ProcessCommand> from C<Arc::Connection::Client> 
this function is also used.
Data is read from the local socket resp. pipe and is written encrypted 
to the network socket. The other side reads the data from network socket, 
decrypts it and writes it to its local socket. This function behaves differently on 
client and server sides, when the local or network socket is closed.


B<Returns:> always true


B<Example:>

$this->ReadWriteBinary(*STDIN,*STDOUT);


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

B<Description>: receives an ARCv2 Command. (protocol)
This function gets a line from C<_RecvLine> and extracts the ARCv2 command and
the optional command parameter C<_cmdparameter>.


B<Returns:> ARCv2 command and true if everything works fine, otherwise false


B<Example:>

while (my $cmd = $this->_RecvCommand()) { ... }


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

B<Description>: receive a line (command). (protocol)
This function receives data from the ARCv2 connection and
fills the internal C<__linequeue> and C<__partial>. It returns 
a line from the internal buffer if there is any. It also handles
timeouts and "connection closed by foreign host"'s.


B<Returns:> true (and the line) if everything worked fine, otherwise false (undef)


B<Example:>

if (my $line = $this->_RecvLine()) { ... }


=item _Sasl ( $saslstr ) I<inherited from Arc::Connection>

B<Description>: send the ARCv2 SASL command. (protocol)
This function encodes the output from sasl_*_start and sasl_*_step with Base-64 and sends
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



( run in 0.499 second using v1.01-cache-2.11-cpan-39bf76dae61 )