vmsplib (version 1.6, $Date: 2001/04/28 01:23:54 $)
index
vmsplib.py

VMSP client class.
 
This should follow my VMSP internet draft.
Example:
 
   >>> import vmsplib
   >>> s=vmsplib.VMSP('localhost')
   >>> s.putcmd("help", "auth")
   >>> s.getreply()
   (214, 'AUTH <authentication-type>
Authorise yourself.
   May not be implemented.
End of HELP info')
   >>> s.quit()
   
 
Heavily based on smtplib.py by dragondm, esr and others.
Implemented for ease of debugging and auth commands.
 
Notes: 
 
This test class, as well as the server, do not currently
implement a safe file-based shared secret regime, and for that
reason both the shared secret and the username are hard-coded;
they are NOT production, but proof-of-concept!
 
Copyright (C) Sean Dwyer 2001 under GPL.

 
Modules
            
Crypto.Hash.HMAC
Crypto.Hash.MD5
base64
re
socket
string

 
Classes
            
exceptions.Exception
VException
VDisconn
VErrException
VAuthError
VAuthFail
VConnectErr
VGetFail
VHeloErr
VListFail
VMSP

 
class VAuthError(VErrException)
      server refused our AUTH
 
  
__getitem__(...) from exceptions.Exception
__init__(self, code, msg) from VErrException
__str__(...) from exceptions.Exception

 
class VAuthFail(VErrException)
      we failed authentication
 
  
__getitem__(...) from exceptions.Exception
__init__(self, code, msg) from VErrException
__str__(...) from exceptions.Exception

 
class VConnectErr(VErrException)
      couldnt connect
 
  
__getitem__(...) from exceptions.Exception
__init__(self, code, msg) from VErrException
__str__(...) from exceptions.Exception

 
class VDisconn(VException)
      got disconnected
 
  
__getitem__(...) from exceptions.Exception
__init__(...) from exceptions.Exception
__str__(...) from exceptions.Exception

 
class VErrException(VException)
       exceptions with error codes
 
  
__getitem__(...) from exceptions.Exception
__init__(self, code, msg)
__str__(...) from exceptions.Exception

 
class VException(exceptions.Exception)
      base exception class
 
  
__getitem__(...) from exceptions.Exception
__init__(...) from exceptions.Exception
__str__(...) from exceptions.Exception

 
class VGetFail(VErrException)
      we failed to get an item
 
  
__getitem__(...) from exceptions.Exception
__init__(self, code, msg) from VErrException
__str__(...) from exceptions.Exception

 
class VHeloErr(VErrException)
      server refused our HELO
 
  
__getitem__(...) from exceptions.Exception
__init__(self, code, msg) from VErrException
__str__(...) from exceptions.Exception

 
class VListFail(VErrException)
      we failed a list request
 
  
__getitem__(...) from exceptions.Exception
__init__(self, code, msg) from VErrException
__str__(...) from exceptions.Exception

 
class VMSP
       manages a connection to a VMSP server
 
  
__init__(self, host='', port=0)
new instance.
 
host if specified, is the host we connect to. port, if
specified is an alternate port to the default vmsplib.VPORT.
auth(self)
send an auth request to the server.
if successful, we can then send a response to the
generated challenge.
challresp(self, schall)
 respond to an authentication challenge.
 
ideally, the shared secret should not be within the client
or server, but on an accessible file, preferably protected.
The user should also be gotten from somewhere safe, preferably
the same place.
close(self)
Close server connection.
connect(self, host='localhost', port=0)
Connect to a host on a given port.
 
If we have a host:port, and no port specified, the :port
will be used.
Automatically called by __init__ if we specify a host.
docmd(self, cmd, args='')
Send a command, and return its response code.
ehlo(self, name='')
VMSP 'ehlo' command.
Hostname to send for this command defaults to the
FQDN of the local host.
get(self, item)
send a GET request to the server.
if successful, we get the item, or an
error message.
getreply(self)
Get a reply from the server.
has_extn(self, opt)
Does the server support a given VMSP service extension?
helo(self, name='')
VMSP 'helo' command.
Hostname to send for this command defaults to the 
FQDN of the local host.
help(self, args='')
VMSP 'help' command.
Returns help text from server.
list(self)
send a list request to the server.
if successful, get a list back, with detail
depending on our authentication status
noop(self)
putcmd(self, cmd, args='')
Send a command to the server.
quit(self)
Terminate VMSP session.
send(self, str)
Send `str' to the server.
set_debuglevel(self, debuglevel)
Set the debug output level.
 
If true, output everything.
testserver(self)
Test out the server/client operation

 
Data
             NL = '\015\012'
StringType = <type 'string'>
VMSP_PORT = 3200
__author__ = 'Sean Dwyer <ewe2@can.org.au>'
__credits__ = 'The Dragon De Monsyne <dragondm@integral.org> for smtplib.py'
__date__ = '$Date: 2001/04/28 01:23:54 $'
__file__ = './vmsplib.py'
__name__ = 'vmsplib'
__version__ = '$Revision: 1.12 $'

 
Author
             Sean Dwyer <ewe2@can.org.au>

 
Credits
             The Dragon De Monsyne <dragondm@integral.org> for smtplib.py