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

[or-cvs] rename hidserv_xx



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

Modified Files:
	directory.c main.c or.h rendcommon.c 
Log Message:
rename hidserv_xx

Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/src/or/directory.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- directory.c	31 Mar 2004 03:42:56 -0000	1.73
+++ directory.c	31 Mar 2004 04:10:09 -0000	1.74
@@ -329,7 +329,7 @@
     const char *descp;
     int desc_len;
 
-    switch(hidserv_lookup(url+9, &descp, &desc_len)) {
+    switch(rend_cache_lookup(url+9, &descp, &desc_len)) {
       case 1: /* valid */
         connection_write_to_buf(answer200, strlen(answer200), conn);
         connection_write_to_buf(descp, desc_len, conn); /* XXXX Contains NULs*/
@@ -384,7 +384,7 @@
   }
 
   if(!strncmp(url,"/hidserv/",9)) { /* hidserv descriptor post */
-    if(hidserv_store(body, body_len) < 0)
+    if(rend_cache_store(body, body_len) < 0)
       connection_write_to_buf(answer400, strlen(answer400), conn);
     else
       connection_write_to_buf(answer200, strlen(answer200), conn);

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.213
retrieving revision 1.214
diff -u -d -r1.213 -r1.214
--- main.c	31 Mar 2004 03:42:56 -0000	1.213
+++ main.c	31 Mar 2004 04:10:09 -0000	1.214
@@ -334,7 +334,7 @@
       /* We're a directory; dump any old descriptors. */
       dirserv_remove_old_servers();
     }
-    hidserv_cache_clean(); /* should this go elsewhere? */
+    rend_cache_clean(); /* should this go elsewhere? */
     time_to_fetch_directory = now + options.DirFetchPostPeriod;
   }
 
@@ -549,7 +549,7 @@
   /* Initialize the history structures. */
   rep_hist_init();
   /* Intialize the service cache. */
-  hidserv_cache_init();
+  rend_cache_init();
 
   /* load the private keys, if we're supposed to have them, and set up the
    * TLS context. */

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.264
retrieving revision 1.265
diff -u -d -r1.264 -r1.265
--- or.h	31 Mar 2004 03:42:56 -0000	1.264
+++ or.h	31 Mar 2004 04:10:09 -0000	1.265
@@ -987,10 +987,10 @@
 rend_service_descriptor_t *rend_parse_service_descriptor(const char *str, int len);
 int rend_get_service_id(crypto_pk_env_t *pk, char *out);
 
-void hidserv_cache_init(void);
-void hidserv_cache_clean(void);
-int hidserv_lookup(char *query, const char **desc, int *desc_len);
-int hidserv_store(char *desc, int desc_len);
+void rend_cache_init(void);
+void rend_cache_clean(void);
+int rend_cache_lookup(char *query, const char **desc, int *desc_len);
+int rend_cache_store(char *desc, int desc_len);
 
 #endif
 

Index: rendcommon.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendcommon.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- rendcommon.c	31 Mar 2004 03:42:56 -0000	1.2
+++ rendcommon.c	31 Mar 2004 04:10:10 -0000	1.3
@@ -138,52 +138,52 @@
   return 0;
 }
 
-/* ==== Hidden service descriptor cache. */
-#define HIDSERV_MAX_AGE 24*60*60
-#define HIDSERV_MAX_SKEW 60*60
+/* ==== Rendezvous service descriptor cache. */
+#define REND_CACHE_MAX_AGE 24*60*60
+#define REND_CACHE_MAX_SKEW 60*60
 
-typedef struct hidserv_cache_entry_t {
+typedef struct rend_cache_entry_t {
   int len;
   char *desc;
   rend_service_descriptor_t *parsed;
-} hidserv_cache_entry_t;
+} rend_cache_entry_t;
 
-static strmap_t *hidserv_cache = NULL;
+static strmap_t *rend_cache = NULL;
 
-void hidserv_cache_init(void)
+void rend_cache_init(void)
 {
-  hidserv_cache = strmap_new();
+  rend_cache = strmap_new();
 }
 
-void hidserv_cache_clean(void)
+void rend_cache_clean(void)
 {
   strmap_iter_t *iter;
   const char *key;
   void *val;
-  hidserv_cache_entry_t *ent;
+  rend_cache_entry_t *ent;
   time_t cutoff;
-  cutoff = time(NULL) - HIDSERV_MAX_AGE;
-  for (iter = strmap_iter_init(hidserv_cache); !strmap_iter_done(iter); ) {
+  cutoff = time(NULL) - REND_CACHE_MAX_AGE;
+  for (iter = strmap_iter_init(rend_cache); !strmap_iter_done(iter); ) {
     strmap_iter_get(iter, &key, &val);
-    ent = (hidserv_cache_entry_t*)val;
+    ent = (rend_cache_entry_t*)val;
     if (ent->parsed->timestamp < cutoff) {
-      iter = strmap_iter_next_rmv(hidserv_cache, iter);
+      iter = strmap_iter_next_rmv(rend_cache, iter);
       rend_service_descriptor_free(ent->parsed);
       tor_free(ent->desc);
       tor_free(ent);
     } else {
-      iter = strmap_iter_next(hidserv_cache, iter);
+      iter = strmap_iter_next(rend_cache, iter);
     }
   }
 }
 
-int hidserv_lookup(char *query, const char **desc, int *desc_len)
+int rend_cache_lookup(char *query, const char **desc, int *desc_len)
 {
-  hidserv_cache_entry_t *e;
-  assert(hidserv_cache);
+  rend_cache_entry_t *e;
+  assert(rend_cache);
   if (strlen(query) != REND_SERVICE_ID_LEN)
     return -1; /* XXXX also check for bad chars. */
-  e = (hidserv_cache_entry_t*) strmap_get_lc(hidserv_cache, query);
+  e = (rend_cache_entry_t*) strmap_get_lc(rend_cache, query);
   if (!e)
     return 0;
   *desc = e->desc;
@@ -191,13 +191,13 @@
   return 1;
 }
 
-int hidserv_store(char *desc, int desc_len)
+int rend_cache_store(char *desc, int desc_len)
 {
-  hidserv_cache_entry_t *e;
+  rend_cache_entry_t *e;
   rend_service_descriptor_t *parsed;
   char query[REND_SERVICE_ID_LEN+1];
   time_t now;
-  assert(hidserv_cache);
+  assert(rend_cache);
   parsed = rend_parse_service_descriptor(desc,desc_len);
   if (!parsed) {
     log_fn(LOG_WARN,"Couldn't parse service descriptor");
@@ -209,17 +209,17 @@
     return -1;
   }
   now = time(NULL);
-  if (parsed->timestamp < now-HIDSERV_MAX_AGE) {
+  if (parsed->timestamp < now-REND_CACHE_MAX_AGE) {
     log_fn(LOG_WARN,"Service descriptor is too old");
     rend_service_descriptor_free(parsed);
     return -1;
   }
-  if (parsed->timestamp > now+HIDSERV_MAX_SKEW) {
+  if (parsed->timestamp > now+REND_CACHE_MAX_SKEW) {
     log_fn(LOG_WARN,"Service descriptor is too far in the future");
     rend_service_descriptor_free(parsed);
     return -1;
   }
-  e = (hidserv_cache_entry_t*) strmap_get_lc(hidserv_cache, query);
+  e = (rend_cache_entry_t*) strmap_get_lc(rend_cache, query);
   if (e && e->parsed->timestamp > parsed->timestamp) {
     log_fn(LOG_WARN,"We already have a newer service descriptor with the same ID");
     rend_service_descriptor_free(parsed);
@@ -231,8 +231,8 @@
     return -1;
   }
   if (!e) {
-    e = tor_malloc_zero(sizeof(hidserv_cache_entry_t));
-    strmap_set_lc(hidserv_cache, query, e);
+    e = tor_malloc_zero(sizeof(rend_cache_entry_t));
+    strmap_set_lc(rend_cache, query, e);
   } else {
     rend_service_descriptor_free(e->parsed);
     tor_free(e->desc);