Просмотр исходного кода

Extract tor_version_t into its own header.

Nick Mathewson 6 лет назад
Родитель
Сommit
7d2d131afa
6 измененных файлов с 39 добавлено и 23 удалено
  1. 1 0
      src/or/dirserv.c
  2. 2 1
      src/or/include.am
  3. 1 22
      src/or/or.h
  4. 2 0
      src/or/routerparse.c
  5. 32 0
      src/or/tor_version_st.h
  6. 1 0
      src/test/test_dir.c

+ 1 - 0
src/or/dirserv.c

@@ -37,6 +37,7 @@
 #include "dirauth/dirvote.h"
 
 #include "dir_connection_st.h"
+#include "tor_version_st.h"
 
 /**
  * \file dirserv.c

+ 2 - 1
src/or/include.am

@@ -260,7 +260,7 @@ ORHEADERS = \
 	src/or/or_handshake_state_st.h			\
 	src/or/origin_circuit_st.h			\
 	src/or/transports.h				\
-	src/or/parsecommon.h			\
+	src/or/parsecommon.h				\
 	src/or/periodic.h				\
 	src/or/port_cfg_st.h				\
 	src/or/policies.h				\
@@ -294,6 +294,7 @@ ORHEADERS = \
 	src/or/status.h					\
 	src/or/torcert.h				\
 	src/or/tor_api_internal.h			\
+	src/or/tor_version_st.h				\
 	src/or/voting_schedule.h
 
 # We add the headers of the modules even though they are disabled so we can

+ 1 - 22
src/or/or.h

@@ -4261,28 +4261,7 @@ typedef enum was_router_added_t {
   ROUTER_CERTS_EXPIRED = -8
 } was_router_added_t;
 
-/********************************* routerparse.c ************************/
-
-#define MAX_STATUS_TAG_LEN 32
-/** Structure to hold parsed Tor versions.  This is a little messier
- * than we would like it to be, because we changed version schemes with 0.1.0.
- *
- * See version-spec.txt for the whole business.
- */
-typedef struct tor_version_t {
-  int major;
-  int minor;
-  int micro;
-  /** Release status.  For version in the post-0.1 format, this is always
-   * VER_RELEASE. */
-  enum { VER_PRE=0, VER_RC=1, VER_RELEASE=2, } status;
-  int patchlevel;
-  char status_tag[MAX_STATUS_TAG_LEN];
-  int svn_revision;
-
-  int git_tag_len;
-  char git_tag[DIGEST_LEN];
-} tor_version_t;
+typedef struct tor_version_t tor_version_t;
 
 #endif /* !defined(TOR_OR_H) */
 

+ 2 - 0
src/or/routerparse.c

@@ -84,6 +84,8 @@
 
 #include "dirauth/dirvote.h"
 
+#include "tor_version_st.h"
+
 /****************************************************************************/
 
 /** List of tokens recognized in router descriptors */

+ 32 - 0
src/or/tor_version_st.h

@@ -0,0 +1,32 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef TOR_VERSION_ST_H
+#define TOR_VERSION_ST_H
+
+#define MAX_STATUS_TAG_LEN 32
+/** Structure to hold parsed Tor versions.  This is a little messier
+ * than we would like it to be, because we changed version schemes with 0.1.0.
+ *
+ * See version-spec.txt for the whole business.
+ */
+struct tor_version_t {
+  int major;
+  int minor;
+  int micro;
+  /** Release status.  For version in the post-0.1 format, this is always
+   * VER_RELEASE. */
+  enum { VER_PRE=0, VER_RC=1, VER_RELEASE=2, } status;
+  int patchlevel;
+  char status_tag[MAX_STATUS_TAG_LEN];
+  int svn_revision;
+
+  int git_tag_len;
+  char git_tag[DIGEST_LEN];
+};
+
+#endif
+

+ 1 - 0
src/test/test_dir.c

@@ -45,6 +45,7 @@
 #include "voting_schedule.h"
 
 #include "port_cfg_st.h"
+#include "tor_version_st.h"
 
 #define NS_MODULE dir