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

[or-cvs] work on versioning; new log_fn function



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

Modified Files:
	directory.c main.c or.h routers.c 
Log Message:
work on versioning; new log_fn function

Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/src/or/directory.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- directory.c	9 May 2003 02:20:16 -0000	1.13
+++ directory.c	9 May 2003 02:25:37 -0000	1.14
@@ -157,7 +157,7 @@
       log(LOG_DEBUG,"connection_dir_process_inbuf(): and got a %s directory; updated routers.", 
           conn->pkey ? "authenticated" : "unauthenticated");
     }
-    
+
     if(options.ORPort) { /* connect to them all */
       router_retry_connections();
     }

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- main.c	9 May 2003 02:20:16 -0000	1.63
+++ main.c	9 May 2003 02:25:37 -0000	1.64
@@ -708,8 +708,7 @@
   eos = s+maxlen;
   strncpy(s, 
           "signed-directory\n"
-          "client-software x y z\n" /* XXX make this real */
-          "server-software a b c\n\n" /* XXX make this real */
+          "recommended-software 0.0.2pre4,0.0.2pre5,0.0.2pre6\n" /* XXX make this real */
           , maxlen);
   
   i = strlen(s);

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- or.h	9 May 2003 02:12:52 -0000	1.83
+++ or.h	9 May 2003 02:25:37 -0000	1.84
@@ -330,6 +330,7 @@
 typedef struct {
   routerinfo_t **routers;
   int n_routers;
+  char *software_versions;
 } directory_t;
 
 struct crypt_path_t { 

Index: routers.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routers.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- routers.c	9 May 2003 02:20:16 -0000	1.31
+++ routers.c	9 May 2003 02:25:37 -0000	1.32
@@ -44,20 +44,20 @@
 
   /* obtain local host information */
   if(gethostname(localhostname,512) < 0) {
-    log(LOG_ERR,"Error obtaining local hostname.");
+    log_fn(LOG_ERR,"Error obtaining local hostname.");
     return -1;
   }
-  log(LOG_DEBUG,"learn_my_address(): localhostname is '%s'.",localhostname);
+  log_fn(LOG_DEBUG,"localhostname is '%s'.",localhostname);
   localhost = gethostbyname(localhostname);
   if (!localhost) {
-    log(LOG_ERR,"Error obtaining local host info.");
+    log_fn(LOG_ERR,"Error obtaining local host info.");
     return -1;
   }
   memset(me,0,sizeof(struct sockaddr_in));
   me->sin_family = AF_INET;
   memcpy((void *)&me->sin_addr,(void *)localhost->h_addr,sizeof(struct in_addr));
   me->sin_port = htons(options.ORPort);
-  log(LOG_DEBUG,"learn_my_address(): chose address as '%s'.",inet_ntoa(me->sin_addr));
+  log_fn(LOG_DEBUG,"chose address as '%s'.",inet_ntoa(me->sin_addr));
 
   return 0;
 }
@@ -69,7 +69,7 @@
   for (i=0;i<directory->n_routers;i++) {
     router = directory->routers[i];
     if(!connection_exact_get_by_addr_port(router->addr,router->or_port)) { /* not in the list */
-      log(LOG_DEBUG,"retry_all_connections(): connecting to OR %s:%u.",router->address,router->or_port);
+      log_fn(LOG_DEBUG,"connecting to OR %s:%u.",router->address,router->or_port);
       connection_or_connect_as_or(router);
     }
   }
@@ -199,19 +199,19 @@
   assert(routerfile);
   
   if (strcspn(routerfile,CONFIG_LEGAL_FILENAME_CHARACTERS) != 0) {
-    log(LOG_ERR,"router_get_list_from_file(): Filename %s contains illegal characters.",routerfile);
+    log_fn(LOG_ERR,"Filename %s contains illegal characters.",routerfile);
     return -1;
   }
   
   if(stat(routerfile, &statbuf) < 0) {
-    log(LOG_ERR,"router_get_list_from_file(): Could not stat %s.",routerfile);
+    log_fn(LOG_ERR,"Could not stat %s.",routerfile);
     return -1;
   }
 
   /* open the router list */
   fd = open(routerfile,O_RDONLY,0);
   if (fd<0) {
-    log(LOG_ERR,"router_get_list_from_file(): Could not open %s.",routerfile);
+    log_fn(LOG_ERR,"Could not open %s.",routerfile);
     return -1;
   }
 
@@ -244,11 +244,10 @@
 
 typedef enum {
   K_ACCEPT,
-  K_CLIENT_SOFTWARE, 
   K_DIRECTORY_SIGNATURE,
+  K_RECOMMENDED_SOFTWARE,
   K_REJECT, 
   K_ROUTER, 
-  K_SERVER_SOFTWARE,
   K_SIGNED_DIRECTORY,
   K_SIGNING_KEY,
   _SIGNATURE, 
@@ -261,11 +260,10 @@
 
 static struct token_table_ent token_table[] = {
   { "accept", K_ACCEPT },
-  { "client-software", K_CLIENT_SOFTWARE },
   { "directory-signature", K_DIRECTORY_SIGNATURE },
   { "reject", K_REJECT },
   { "router", K_ROUTER },
-  { "server-software", K_SERVER_SOFTWARE },
+  { "recommended-software", K_RECOMMENDED_SOFTWARE },
   { "signed-directory", K_SIGNED_DIRECTORY },
   { "signing-key", K_SIGNING_KEY },
   { NULL, -1 }
@@ -395,11 +393,10 @@
       puts("EOF");
       return;
     case K_ACCEPT: printf("Accept"); break;
-    case K_CLIENT_SOFTWARE: printf("Client-Software"); break;
     case K_DIRECTORY_SIGNATURE: printf("Directory-Signature"); break;
     case K_REJECT: printf("Reject"); break;
+    case K_RECOMMENDED_SOFTWARE: printf("Server-Software"); break;
     case K_ROUTER: printf("Router"); break;
-    case K_SERVER_SOFTWARE: printf("Server-Software"); break;
     case K_SIGNED_DIRECTORY: printf("Signed-Directory"); break;
     case K_SIGNING_KEY: printf("Signing-Key"); break;
     default:
@@ -518,6 +515,7 @@
     log(LOG_ERR, "Error resolving directory");
     return -1;
   }
+  /* XXXX Check version number */
   return 0;
 }
 
@@ -528,6 +526,7 @@
   char digest[20];
   char signed_digest[128];
   directory_t *new_dir = NULL;
+  char *versions;
   
 #define NEXT_TOK()                                                      \
   do {                                                                  \
@@ -551,16 +550,19 @@
   TOK_IS(K_SIGNED_DIRECTORY, "signed-directory");
 
   NEXT_TOK();
-  TOK_IS(K_CLIENT_SOFTWARE, "client-software");
-
-  NEXT_TOK();
-  TOK_IS(K_SERVER_SOFTWARE, "server-software");
+  TOK_IS(K_RECOMMENDED_SOFTWARE, "recommended-software");
+  if (tok.val.cmd.n_args != 1) {
+    log(LOG_ERR, "Invalid recommded-software line");
+    return -1;
+  }
+  versions = strdup(tok.val.cmd.args[0]);
   
   NEXT_TOK();
   if (router_get_list_from_string_tok(&s, &new_dir, &tok)) {
     log(LOG_ERR, "Error reading routers from directory");
     return -1;
   }
+  new_dir->software_versions = versions;
   
   TOK_IS(K_DIRECTORY_SIGNATURE, "directory-signature");
   NEXT_TOK();