blob: 37719cb2253b9d1263f5d2c18b2b8759764387ae [file] [log] [blame]
Guido van Rossum6c150461995-04-28 22:28:39 +00001Filesystem, RCS and CVS client and server classes
2=================================================
3
Guido van Rossum6ea3f921995-06-21 02:19:55 +00004*** See the security warning at the end of this file! ***
5
Guido van Rossum5f07b841995-04-26 22:57:11 +00006This directory contains various modules and classes that support
Guido van Rossum6c150461995-04-28 22:28:39 +00007remote file system operations.
8
9rrcs.py Remote RCS client command line interface
10rrcs Script to put in your bin directory
11
12rcvs.py Remote CVS client command line interface
13rcvs Script to put in your bin directory
14
15sumtree.py Old demo for FSProxy
16cmptree.py First FSProxy client (used to sync from the Mac)
17
18cvslib.py CVS admin files classes (used by rrcs)
19rcsclient.py Return an RCSProxyClient instance
20 (has reasonable default server/port/directory)
21
22FSProxy.py Filesystem interface classes
23RCSProxy.py RCS interface classes
24
25client.py Client class
26server.py Server class
27
Guido van Rossum6ea3f921995-06-21 02:19:55 +000028security.py Security mix-in class (not very secure I think)
29
Guido van Rossum6c150461995-04-28 22:28:39 +000030cmdfw.py CommandFrameWork class
31 (used by rcvs, should be used by rrcs as well)
32
33
34Client/Server operation
35-----------------------
36
37The Client and Server classes implement a simple-minded RPC protocol,
38using Python's pickle module to transfer arguments, return values and
39exceptions with the most generality. The Server class is instantiated
40with a port number on which it should listen for requests; the Client
41class is instantiated with a host name and a port number where it
42should connect to. Once a client is connected, a TCP connection is
43maintained between client and server.
44
45The Server class currently handles only one connection at a time;
46however it could be rewritten to allow various modes of operations,
47using multiple threads or processes or the select() system call as
48desired to serve multiple clients simultaneously (when using select(),
49still handling one request at a time). This would not require
50rewriting of the Client class. It may also be possible to adapt the
51code to use UDP instead of TCP, but then both classes will have to be
52rewritten (and unless extensive acknowlegements and request serial
53numbers are used, the server should handle duplicate requests, so its
54semantics should be idempotent -- shrudder).
55
56Even though the FSProxy and RCSProxy modules define client classes,
57the client class is fully generic -- what methods it supports is
58determined entirely by the server. The server class, however, must be
59derived from. This is generally done as follows:
60
61 from server import Server
62 from client import Client
63
64 # Define a class that performs the operations locally
65 class MyClassLocal:
66 def __init__(self): ...
67 def _close(self): ...
68
69 # Derive a server class using multiple inheritance
70 class MyClassServer(MyClassLocal, Server):
71 def __init__(self, address):
72 # Must initialize MyClassLocal as well as Server
73 MyClassLocal.__init__(self)
74 Server.__init__(self, address)
75 def _close(self):
76 Server._close()
77 MyClassLocal._close()
78
79 # A dummy client class
80 class MyClassClient(Client): pass
81
82Note that because MyClassLocal isn't used in the definition of
83MyClassClient, it would actually be better to place it in a separate
84module so the definition of MyClassLocal isn't executed when we only
85instantiate a client.
86
87The modules client and server should probably be renamed to Client and
88Server in order to match the class names.
Guido van Rossum6ea3f921995-06-21 02:19:55 +000089
90
91*** Security warning: this version requires that you have a file
92$HOME/.python_keyfile at the server and client side containing two comma-
93separated numbers. The security system at the moment makes no guarantees
94of actuallng being secure -- however it requires that the key file
95exists and contains the same numbers at both ends for this to work.
96(You can specify an alternative keyfile in $PYTHON_KEYFILE).
97Have a look at the Security class in security.py for details;
98basically, if the key file contains (x, y), then the security server
99class chooses a random number z (the challenge) in the range 10..100000
100and the client must be able to produce pow(z, x, y) (i.e. z**x mod y).