Extract tor_version_t into its own header.

This commit is contained in:
Nick Mathewson 2018-06-15 12:12:15 -04:00
parent d51de77311
commit 7d2d131afa
6 changed files with 39 additions and 23 deletions

View file

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

View file

@ -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

View file

@ -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) */

View file

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

32
src/or/tor_version_st.h Normal file
View file

@ -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

View file

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