initial commit
[jrx.git] / src / edu / berkeley / cs / jrx / RxConnection.java
1 // http://openafs.sinenomine.net/~mmeffie/rfc/draft-zeldovich-rx-spec-00.txt
2 // prounounced "jerks"
3
4 // typo: "contees" => "contents"
5
6 /*
7   Ambiguities:
8     - so, unlimited channels per connection, one call per channel, but only
9       four calls per connection?
10     - who picks the epoch, client or server?
11  */
12
13 public class RxConnection {
14
15     // I think this is per-host
16     private static final int epoch;
17
18     /*
19       An Rx connection between two
20       hosts is identified by:
21
22        { Epoch, Connection ID, Peer IP, Peer Port },
23            if the high bit of the epoch (+) is not set
24        { Epoch, Connection ID },
25            if the high bit of the epoch (+) is set
26
27 if the high epoch bit is set, the recipient of a
28    packet should accept packets for this Rx connection from any IP
29    address and port number
30      */
31
32     InetAddress host;
33     int port;
34     short serviceid;
35
36     public RxConnection(InetAddress host, int port, short serviceid) {
37         this.host = host;
38         this.port = port;
39         this.serviceId = serviceId;
40     }
41
42
43     // one outstanding call per channel at a time
44     // I think there can only be four active calls per connection
45     public class RxChannel {
46         private int connectionId; // chosen by the client that establishes the
47    connection The last two bits of the same 32-bit field are used by
48    Rx to multiplex between 4 parallel calls on the same connection.
49        Each one of them is called an Rx channel, and therefore the field is
50        denoted "Channel ID". (?!?!)
51
52         public class RxCall {
53             private int callNumber;  // initial call number must be nonzero
54             // chosen by the peer that initiates the call
55
56             private int sequenceNumber;  // counts packets not bytes, starts at 1
57             private int serialNumber;  // starts at one, inc with each transmission
58
59             public class RxPacket {
60                 public final int sequenceNumber;
61                 // zero checksum means it is not being computed
62                 // status field is optional
63             }
64
65         }
66     }
67
68
69 }