Merge branch 'maint-0.4.5' into maint-0.4.6
[tor.git] / src / trunnel / circpad_negotiation.trunnel
blob68fed6a013f6a7b4c1d81d8e00a05260b4af8ed9
1 /* These are the padding negotiation commands */
2 const CIRCPAD_COMMAND_STOP = 1;
3 const CIRCPAD_COMMAND_START = 2;
5 /* Responses to commands */
6 const CIRCPAD_RESPONSE_OK = 1;
7 const CIRCPAD_RESPONSE_ERR = 2;
9 /* Built-in machine types */
11 /* 1) Machine that obscures circuit setup */
12 const CIRCPAD_MACHINE_CIRC_SETUP = 1;
14 /**
15  * This command tells the relay to alter its min and max netflow
16  * timeout range values, and send padding at that rate (resuming
17  * if stopped). */
18 struct circpad_negotiate {
19   u8 version IN [0];
20   u8 command IN [CIRCPAD_COMMAND_START, CIRCPAD_COMMAND_STOP];
22   /** Machine type is left unbounded because we can specify
23    * new machines in the consensus */
24   u8 machine_type;
26   /** If true, send a relay_drop reply.. */
27   // FIXME-MP-AP: Maybe we just say to transition to the first state
28   // here instead.. Also what about delay before responding?
29   u8 echo_request IN [0,1];
31   // This field is used for shutdown synchronization. It is OK if
32   // it wraps, because all we need to do is make sure the STOP
33   // command is actually for the currently active machine.
34   // For backward-compatibility, though, 0 has special meaning
35   // (it means match any machine).
36   u32 machine_ctr;
39 /**
40  * This command tells the relay to alter its min and max netflow
41  * timeout range values, and send padding at that rate (resuming
42  * if stopped). */
43 struct circpad_negotiated {
44   u8 version IN [0];
45   u8 command IN [CIRCPAD_COMMAND_START, CIRCPAD_COMMAND_STOP];
46   u8 response IN [CIRCPAD_RESPONSE_OK, CIRCPAD_RESPONSE_ERR];
48   /** Machine type is left unbounded because we can specify
49    * new machines in the consensus */
50   u8 machine_type;
52   /**
53    * This field is used for shutdown synchronization. It is OK if
54    * it wraps, because all we need to do is make sure the STOP
55    * command is actually for the currently active machine.
56    * For backward-compatibility, though, 0 has special meaning
57    * (it means match any machine).
58    */
59   u32 machine_ctr;