[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Stub functions for new control-spec logic.



Update of /home/or/cvsroot/tor/src/or
In directory moria.mit.edu:/tmp/cvs-serv3670/src/or

Modified Files:
	control.c 
Log Message:
Stub functions for new control-spec logic.

Index: control.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/control.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- control.c	5 Jan 2005 06:48:39 -0000	1.41
+++ control.c	25 Feb 2005 06:16:28 -0000	1.42
@@ -40,7 +40,13 @@
 #define CONTROL_CMD_AUTHENTICATE 0x0007
 #define CONTROL_CMD_SAVECONF     0x0008
 #define CONTROL_CMD_SIGNAL       0x0009
-#define _CONTROL_CMD_MAX_RECOGNIZED 0x0009
+#define CONTROL_CMD_MAPADDRESS   0x000A
+#define CONTROL_CMD_GETINFO      0x000B
+#define CONTROL_CMD_INFOVALUE    0x000C
+#define CONTROL_CMD_EXTENDCIRCUIT  0x000D
+#define CONTROL_CMD_ATTACHSTREAM   0x000E
+#define CONTROL_CMD_POSTDESCRIPTOR 0x000F
+#define _CONTROL_CMD_MAX_RECOGNIZED 0x000F
 
 /* Recognized error codes. */
 #define ERR_UNSPECIFIED             0x0000
@@ -52,6 +58,7 @@
 #define ERR_UNRECOGNIZED_EVENT_CODE 0x0006
 #define ERR_UNAUTHORIZED            0x0007
 #define ERR_REJECTED_AUTHENTICATION 0x0008
+#define ERR_RESOURCE_EXHAUSETED     0x0009
 
 /* Recognized asynchronous event types. */
 #define _EVENT_MIN            0x0001
@@ -60,11 +67,12 @@
 #define EVENT_OR_CONN_STATUS  0x0003
 #define EVENT_BANDWIDTH_USED  0x0004
 #define EVENT_WARNING         0x0005
-#define _EVENT_MAX            0x0005
+#define EVENT_NEW_DESC        0x0006
+#define _EVENT_MAX            0x0006
 
 /** Array mapping from message type codes to human-readable message
  * type names.  */
-static const char * CONTROL_COMMANDS[] = {
+static const char * CONTROL_COMMANDS[_CONTROL_CMD_MAX_RECOGNIZED+1] = {
   "error",
   "done",
   "setconf",
@@ -74,6 +82,13 @@
   "events",
   "authenticate",
   "saveconf",
+  "signal",
+  "mapaddress",
+  "getinfo",
+  "infovalue",
+  "extendcircuit",
+  "attachstream",
+  "postdescriptor"
 };
 
 /** Bitfield: The bit 1&lt;&lt;e is set if <b>any</b> open control
@@ -116,6 +131,16 @@
                                    const char *body);
 static int handle_control_signal(connection_t *conn, uint16_t len,
                                  const char *body);
+static int handle_control_mapaddress(connection_t *conn, uint16_t len,
+                                     const char *body);
+static int handle_control_getinfo(connection_t *conn, uint16_t len,
+                                  const char *body);
+static int handle_control_extendcircuit(connection_t *conn, uint16_t len,
+                                        const char *body);
+static int handle_control_attachstream(connection_t *conn, uint16_t len,
+                                        const char *body);
+static int handle_control_postdescriptor(connection_t *conn, uint16_t len,
+                                         const char *body);
 
 /** Given a possibly invalid message type code <b>cmd</b>, return a
  * human-readable string equivalent. */
@@ -416,6 +441,39 @@
   return 0;
 }
 
+static int
+handle_control_mapaddress(connection_t *conn, uint16_t len, const char *body)
+{
+  send_control_error(conn,ERR_UNRECOGNIZED_TYPE,"not yet implemented");
+  return 0;
+}
+static int
+handle_control_getinfo(connection_t *conn, uint16_t len, const char *body)
+{
+  send_control_error(conn,ERR_UNRECOGNIZED_TYPE,"not yet implemented");
+  return 0;
+}
+static int
+handle_control_extendcircuit(connection_t *conn, uint16_t len,
+                             const char *body)
+{
+  send_control_error(conn,ERR_UNRECOGNIZED_TYPE,"not yet implemented");
+  return 0;
+}
+static int handle_control_attachstream(connection_t *conn, uint16_t len,
+                                        const char *body)
+{
+  send_control_error(conn,ERR_UNRECOGNIZED_TYPE,"not yet implemented");
+  return 0;
+}
+static int
+handle_control_postdescriptor(connection_t *conn, uint16_t len,
+                              const char *body)
+{
+  send_control_error(conn,ERR_UNRECOGNIZED_TYPE,"not yet implemented");
+  return 0;
+}
+
 /** Called when <b>conn</b> has no more bytes left on its outbuf. */
 int
 connection_control_finished_flushing(connection_t *conn) {
@@ -499,10 +557,31 @@
       if (handle_control_signal(conn, body_len, body))
         return -1;
       break;
+    case CONTROL_CMD_MAPADDRESS:
+      if (handle_control_mapaddress(conn, body_len, body))
+        return -1;
+      break;
+    case CONTROL_CMD_GETINFO:
+      if (handle_control_getinfo(conn, body_len, body))
+        return -1;
+      break;
+    case CONTROL_CMD_EXTENDCIRCUIT:
+      if (handle_control_extendcircuit(conn, body_len, body))
+        return -1;
+      break;
+    case CONTROL_CMD_ATTACHSTREAM:
+      if (handle_control_attachstream(conn, body_len, body))
+        return -1;
+      break;
+    case CONTROL_CMD_POSTDESCRIPTOR:
+      if (handle_control_postdescriptor(conn, body_len, body))
+        return -1;
+      break;
     case CONTROL_CMD_ERROR:
     case CONTROL_CMD_DONE:
     case CONTROL_CMD_CONFVALUE:
     case CONTROL_CMD_EVENT:
+    case CONTROL_CMD_INFOVALUE:
       log_fn(LOG_WARN, "Received client-only '%s' command; ignoring.",
              control_cmd_to_string(command_type));
       send_control_error(conn, ERR_UNRECOGNIZED_TYPE,