--- loncom/LondTransaction.pm 2003/05/15 02:21:45 1.4 +++ loncom/LondTransaction.pm 2005/06/16 22:59:05 1.9 @@ -1,7 +1,7 @@ # This module defines and implements a class that represents # a connection to a lond daemon. # -# $Id: LondTransaction.pm,v 1.4 2003/05/15 02:21:45 foxr Exp $ +# $Id: LondTransaction.pm,v 1.9 2005/06/16 22:59:05 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -35,9 +35,12 @@ =cut +use strict; + package LondTransaction; =pod + =head1 Description LondTransaction objects hold the state required to manage a @@ -92,15 +95,17 @@ Creates a new transaction object. =cut sub new { - my $class = shift; - my $Transaction = shift; + + my ($class, $Transaction) = @_; my $self = {request => $Transaction, active => 0, deferred => 0}; bless($self, $class); + return $self; } + =pod =item Activate @@ -120,9 +125,12 @@ will be carried. =back =cut + sub Activate { - my $self = shift; - my $Connection = shift; # Reference to a lond connection. + + + my ($self, $Connection) = @_; + $self->{londSocket} = $Connection; # Store the connection object and $self->{active} = 1; # Indicate it's active. @@ -139,6 +147,7 @@ transaction is deferred, the deferred fi Otherwise this is a noop. =cut + sub Retire { my $self = shift; @@ -172,12 +181,14 @@ Name of the file that holds the deferred =back =cut + sub SetDeferred { - my $self = shift; - my $File = shift; + + + my ($self, $File) = @_; $self->{deferred} = 1; - $self->{DeferrredFile} = $File; + $self->{DeferredFile} = $File; } =pod @@ -198,9 +209,10 @@ Parameters: =back =cut + sub SetClient { - my $self = shift; - my $Client = shift; + + my ($self, $Client) = @_; $self->{deferred} = 0; $self->{clientSocket} = $Client; @@ -216,6 +228,7 @@ sub SetClient { Returns the state of the deferred member. =cut + sub isDeferred { my $self = shift; return $self->{deferred}; @@ -228,6 +241,7 @@ sub isDeferred { Returns the value of the active member. =cut + sub isActive { my $self = shift; return $self->{active}; @@ -240,6 +254,7 @@ sub isActive { If not deferred returns the client socket, else returns undef. =cut + sub getClient { my $self = shift; if($self->{deferred}) { @@ -258,6 +273,7 @@ If deferred, returns the name of the def returns undef. =cut + sub getFile { my $self = shift; if($self->{deferred}) { @@ -275,6 +291,7 @@ sub getFile { If active returns the lond server socket else undef. =cut + sub getServer { my $self = shift; @@ -292,9 +309,28 @@ sub getServer { Returns the remaining request text. =cut + sub getRequest { my $self = shift; return $self->{request}; } +=pod + +=item getLoggableRequest + + Use this top get what the request is when you don't want to spew + sensitive data into logs + +=cut + +sub getLoggableRequest { + my $self = shift; + my ($cmd,$subcmd)=split(':',$self->{request}); + if ($cmd eq 'encrypt') { + return "$cmd:$subcmd"; + } + return $cmd; +} +1;