aboutsummaryrefslogtreecommitdiff
path: root/src/trunnel/circpad_negotiation.trunnel
blob: 68fed6a013f6a7b4c1d81d8e00a05260b4af8ed9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* These are the padding negotiation commands */
const CIRCPAD_COMMAND_STOP = 1;
const CIRCPAD_COMMAND_START = 2;

/* Responses to commands */
const CIRCPAD_RESPONSE_OK = 1;
const CIRCPAD_RESPONSE_ERR = 2;

/* Built-in machine types */

/* 1) Machine that obscures circuit setup */
const CIRCPAD_MACHINE_CIRC_SETUP = 1;

/**
 * This command tells the relay to alter its min and max netflow
 * timeout range values, and send padding at that rate (resuming
 * if stopped). */
struct circpad_negotiate {
  u8 version IN [0];
  u8 command IN [CIRCPAD_COMMAND_START, CIRCPAD_COMMAND_STOP];

  /** Machine type is left unbounded because we can specify
   * new machines in the consensus */
  u8 machine_type;

  /** If true, send a relay_drop reply.. */
  // FIXME-MP-AP: Maybe we just say to transition to the first state
  // here instead.. Also what about delay before responding?
  u8 echo_request IN [0,1];

  // This field is used for shutdown synchronization. It is OK if
  // it wraps, because all we need to do is make sure the STOP
  // command is actually for the currently active machine.
  // For backward-compatibility, though, 0 has special meaning
  // (it means match any machine).
  u32 machine_ctr;
};

/**
 * This command tells the relay to alter its min and max netflow
 * timeout range values, and send padding at that rate (resuming
 * if stopped). */
struct circpad_negotiated {
  u8 version IN [0];
  u8 command IN [CIRCPAD_COMMAND_START, CIRCPAD_COMMAND_STOP];
  u8 response IN [CIRCPAD_RESPONSE_OK, CIRCPAD_RESPONSE_ERR];

  /** Machine type is left unbounded because we can specify
   * new machines in the consensus */
  u8 machine_type;

  /**
   * This field is used for shutdown synchronization. It is OK if
   * it wraps, because all we need to do is make sure the STOP
   * command is actually for the currently active machine.
   * For backward-compatibility, though, 0 has special meaning
   * (it means match any machine).
   */
  u32 machine_ctr;

};