[tor-commits] [torspec/master] Switching ConnType to be an enum

nickm at torproject.org nickm at torproject.org
Thu Feb 28 16:24:36 UTC 2013


commit bdfd9f4818ce6ea754f1a5f7230ba91b7f7dcdaf
Author: Damian Johnson <atagar at torproject.org>
Date:   Mon Feb 11 08:18:03 2013 -0800

    Switching ConnType to be an enum
    
    I'm still not really sure why Karsten wants to use a string field for this.
    This has all the hallmarks of being an enumeration and it's trivially easy to
    add new connection types as they arise.
    
    Using a string for this field is not just unusual, but makes things a bit
    harder for both controller users and anyone trying to build an alternative tor
    implementation.
    
    I'm also swapping the enums to be uppercase since that's the present convention
    in the control-spec.
---
 proposals/218-usage-controller-events.txt |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/proposals/218-usage-controller-events.txt b/proposals/218-usage-controller-events.txt
index b835b69..6a456eb 100644
--- a/proposals/218-usage-controller-events.txt
+++ b/proposals/218-usage-controller-events.txt
@@ -70,12 +70,11 @@ Target: 0.2.5.x
      "650" SP "CONN_BW" [ SP "ID=" ConnID ] [ SP "TYPE=" ConnType ]
               [ SP "READ=" BytesRead ] [ SP "WRITTEN=" BytesWritten ]
               CRLF
-     ConnType = 1*( "a" - "z" / "0" - "9" / "_" )
+     ConnType = "OR" / "DIR" / "EXIT"
      BytesRead = 1*DIGIT
      BytesWritten = 1*DIGIT
 
-  ConnType is the lower-case connection type name, which can be "or",
-  "dir", "exit", or something else.
+  Controllers MUST tolerate unrecognized connection types.
 
   BytesWritten and BytesRead are the number of bytes written and read
   by Tor since the last CONN_BW event on this connection.
@@ -127,17 +126,18 @@ Target: 0.2.5.x
               [ SP "WRITTEN=" WriteBucketEmpty ]
               [ SP "LAST=" LastRefill ] CRLF
 
-     BucketName = "global" / "relay" / "orconn"
+     BucketName = "GLOBAL" / "RELAY" / "ORCONN"
      ReadBucketEmpty = 1*DIGIT
      WriteBucketEmpty = 1*DIGIT
      LastRefill = 1*DIGIT
 
   This event is generated when refilling a previously empty token
-  bucket.  BucketNames "global" and "relay" keywords are used for the
-  global or relay token buckets, BucketName "orconn" is used for the
-  token buckets of an OR connection.
+  bucket.  BucketNames "GLOBAL" and "RELAY" keywords are used for the
+  global or relay token buckets, BucketName "ORCONN" is used for the
+  token buckets of an OR connection. Controllers MUST tolerate unrecognized
+  bucket names.
 
-  ConnID is only included if the BucketName is "orconn".
+  ConnID is only included if the BucketName is "ORCONN".
 
   If both global and relay buckets and/or the buckets of one or more OR
   connections run out of tokens at the same time, multiple separate





More information about the tor-commits mailing list