r14231@Kushana: nickm | 2007-08-27 14:56:14 -0400

Most configuration options have the same names in or.h and in torrc.  Make the macros reflect this, so that it is easier to fit them onto a line, and so that mismatched options stand out more


svn:r11290
This commit is contained in:
Nick Mathewson 2007-08-27 18:56:20 +00:00
parent d3224bad42
commit 7cbe302b3f

View File

@ -112,6 +112,9 @@ typedef struct config_var_t {
#define VAR(name,conftype,member,initvalue) \
{ name, CONFIG_TYPE_ ## conftype, STRUCT_OFFSET(or_options_t, member), \
initvalue }
/** As VAR, but the option name and member name are the same. */
#define V(member,conftype,initvalue) \
VAR(#member, conftype, member, initvalue)
/** An entry for config_vars: "The option <b>name</b> is obsolete." */
#define OBSOLETE(name) { name, CONFIG_TYPE_OBSOLETE, 0, NULL }
@ -121,170 +124,166 @@ typedef struct config_var_t {
*/
static config_var_t _option_vars[] = {
OBSOLETE("AccountingMaxKB"),
VAR("AccountingMax", MEMUNIT, AccountingMax, "0 bytes"),
VAR("AccountingStart", STRING, AccountingStart, NULL),
VAR("Address", STRING, Address, NULL),
VAR("AllowInvalidNodes", CSV, AllowInvalidNodes,
"middle,rendezvous"),
VAR("AllowNonRFC953Hostnames", BOOL, AllowNonRFC953Hostnames, "0"),
VAR("AssumeReachable", BOOL, AssumeReachable, "0"),
VAR("AuthDirBadExit", LINELIST, AuthDirBadExit, NULL),
VAR("AuthDirInvalid", LINELIST, AuthDirInvalid, NULL),
VAR("AuthDirReject", LINELIST, AuthDirReject, NULL),
VAR("AuthDirRejectUnlisted",BOOL, AuthDirRejectUnlisted,"0"),
VAR("AuthDirListBadExits", BOOL, AuthDirListBadExits, "0"),
VAR("AuthoritativeDirectory",BOOL, AuthoritativeDir, "0"),
VAR("AutomapHostsOnResolve",BOOL, AutomapHostsOnResolve,"0"),
VAR("AutomapHostsSuffixes",CSV, AutomapHostsSuffixes, ".onion,.exit"),
VAR("AvoidDiskWrites", BOOL, AvoidDiskWrites, "0"),
VAR("BandwidthBurst", MEMUNIT, BandwidthBurst, "6 MB"),
VAR("BandwidthRate", MEMUNIT, BandwidthRate, "3 MB"),
VAR("BridgeAuthoritativeDir", BOOL, BridgeAuthoritativeDir, "0"),
VAR("Bridge", LINELIST, Bridges, NULL),
VAR("CircuitBuildTimeout", INTERVAL, CircuitBuildTimeout, "1 minute"),
VAR("CircuitIdleTimeout", INTERVAL, CircuitIdleTimeout, "1 hour"),
VAR("ClientDNSRejectInternalAddresses", BOOL,
ClientDNSRejectInternalAddresses, "1"),
VAR("ClientOnly", BOOL, ClientOnly, "0"),
VAR("ConnLimit", UINT, ConnLimit, "1000"),
VAR("ConstrainedSockets", BOOL, ConstrainedSockets, "0"),
VAR("ConstrainedSockSize", MEMUNIT, ConstrainedSockSize, "8192"),
VAR("ContactInfo", STRING, ContactInfo, NULL),
VAR("ControlListenAddress",LINELIST, ControlListenAddress, NULL),
VAR("ControlPort", UINT, ControlPort, "0"),
VAR("ControlSocket", LINELIST, ControlSocket, NULL),
VAR("CookieAuthentication",BOOL, CookieAuthentication, "0"),
VAR("CookieAuthFileGroupReadable",BOOL,CookieAuthFileGroupReadable, "0"),
VAR("CookieAuthFile", STRING, CookieAuthFile, NULL),
VAR("DataDirectory", STRING, DataDirectory, NULL),
V(AccountingMax, MEMUNIT, "0 bytes"),
V(AccountingStart, STRING, NULL),
V(Address, STRING, NULL),
V(AllowInvalidNodes, CSV, "middle,rendezvous"),
V(AllowNonRFC953Hostnames, BOOL, "0"),
V(AssumeReachable, BOOL, "0"),
V(AuthDirBadExit, LINELIST, NULL),
V(AuthDirInvalid, LINELIST, NULL),
V(AuthDirReject, LINELIST, NULL),
V(AuthDirRejectUnlisted, BOOL, "0"),
V(AuthDirListBadExits, BOOL, "0"),
VAR("AuthoritativeDirectory", BOOL, AuthoritativeDir, "0"),
V(AutomapHostsOnResolve, BOOL, "0"),
V(AutomapHostsSuffixes, CSV, ".onion,.exit"),
V(AvoidDiskWrites, BOOL, "0"),
V(BandwidthBurst, MEMUNIT, "6 MB"),
V(BandwidthRate, MEMUNIT, "3 MB"),
V(BridgeAuthoritativeDir, BOOL, "0"),
VAR("Bridge", LINELIST, Bridges, NULL),
V(CircuitBuildTimeout, INTERVAL, "1 minute"),
V(CircuitIdleTimeout, INTERVAL, "1 hour"),
V(ClientDNSRejectInternalAddresses, BOOL,"1"),
V(ClientOnly, BOOL, "0"),
V(ConnLimit, UINT, "1000"),
V(ConstrainedSockets, BOOL, "0"),
V(ConstrainedSockSize, MEMUNIT, "8192"),
V(ContactInfo, STRING, NULL),
V(ControlListenAddress, LINELIST, NULL),
V(ControlPort, UINT, "0"),
V(ControlSocket, LINELIST, NULL),
V(CookieAuthentication, BOOL, "0"),
V(CookieAuthFileGroupReadable, BOOL, "0"),
V(CookieAuthFile, STRING, NULL),
V(DataDirectory, STRING, NULL),
OBSOLETE("DebugLogFile"),
VAR("DirAllowPrivateAddresses",BOOL, DirAllowPrivateAddresses, NULL),
VAR("DirListenAddress", LINELIST, DirListenAddress, NULL),
V(DirAllowPrivateAddresses, BOOL, NULL),
V(DirListenAddress, LINELIST, NULL),
OBSOLETE("DirFetchPeriod"),
VAR("DirPolicy", LINELIST, DirPolicy, NULL),
VAR("DirPort", UINT, DirPort, "0"),
V(DirPolicy, LINELIST, NULL),
V(DirPort, UINT, "0"),
OBSOLETE("DirPostPeriod"),
VAR("DirServer", LINELIST, DirServers, NULL),
VAR("DNSPort", UINT, DNSPort, "0"),
VAR("DNSListenAddress", LINELIST, DNSListenAddress, NULL),
VAR("DownloadExtraInfo", BOOL, DownloadExtraInfo, "0"),
VAR("EnforceDistinctSubnets", BOOL, EnforceDistinctSubnets,"1"),
VAR("EntryNodes", STRING, EntryNodes, NULL),
VAR("ExcludeNodes", STRING, ExcludeNodes, NULL),
VAR("ExitNodes", STRING, ExitNodes, NULL),
VAR("ExitPolicy", LINELIST, ExitPolicy, NULL),
VAR("ExitPolicyRejectPrivate", BOOL, ExitPolicyRejectPrivate, "1"),
VAR("FascistFirewall", BOOL, FascistFirewall, "0"),
VAR("FirewallPorts", CSV, FirewallPorts, ""),
VAR("FastFirstHopPK", BOOL, FastFirstHopPK, "1"),
VAR("FetchServerDescriptors",BOOL, FetchServerDescriptors,"1"),
VAR("FetchHidServDescriptors",BOOL, FetchHidServDescriptors, "1"),
VAR("FetchUselessDescriptors",BOOL, FetchUselessDescriptors, "0"),
VAR("Group", STRING, Group, NULL),
VAR("HardwareAccel", BOOL, HardwareAccel, "0"),
VAR("HashedControlPassword",STRING, HashedControlPassword, NULL),
VAR("DirServer", LINELIST, DirServers, NULL),
V(DNSPort, UINT, "0"),
V(DNSListenAddress, LINELIST, NULL),
V(DownloadExtraInfo, BOOL, "0"),
V(EnforceDistinctSubnets, BOOL, "1"),
V(EntryNodes, STRING, NULL),
V(ExcludeNodes, STRING, NULL),
V(ExitNodes, STRING, NULL),
V(ExitPolicy, LINELIST, NULL),
V(ExitPolicyRejectPrivate, BOOL, "1"),
V(FascistFirewall, BOOL, "0"),
V(FirewallPorts, CSV, ""),
V(FastFirstHopPK, BOOL, "1"),
V(FetchServerDescriptors, BOOL, "1"),
V(FetchHidServDescriptors, BOOL, "1"),
V(FetchUselessDescriptors, BOOL, "0"),
V(Group, STRING, NULL),
V(HardwareAccel, BOOL, "0"),
V(HashedControlPassword, STRING, NULL),
VAR("HiddenServiceDir", LINELIST_S, RendConfigLines, NULL),
VAR("HiddenServiceExcludeNodes", LINELIST_S, RendConfigLines, NULL),
VAR("HiddenServiceNodes", LINELIST_S, RendConfigLines, NULL),
VAR("HiddenServiceOptions",LINELIST_V, RendConfigLines, NULL),
VAR("HiddenServicePort", LINELIST_S, RendConfigLines, NULL),
VAR("HSAuthoritativeDir", BOOL, HSAuthoritativeDir, "0"),
VAR("HSAuthorityRecordStats",BOOL, HSAuthorityRecordStats,"0"),
VAR("HttpProxy", STRING, HttpProxy, NULL),
VAR("HttpProxyAuthenticator",STRING, HttpProxyAuthenticator,NULL),
VAR("HttpsProxy", STRING, HttpsProxy, NULL),
VAR("HttpsProxyAuthenticator",STRING,HttpsProxyAuthenticator,NULL),
V(HSAuthoritativeDir, BOOL, "0"),
V(HSAuthorityRecordStats, BOOL, "0"),
V(HttpProxy, STRING, NULL),
V(HttpProxyAuthenticator, STRING, NULL),
V(HttpsProxy, STRING, NULL),
V(HttpsProxyAuthenticator, STRING, NULL),
OBSOLETE("IgnoreVersion"),
VAR("KeepalivePeriod", INTERVAL, KeepalivePeriod, "5 minutes"),
VAR("Log", LINELIST, Logs, NULL),
V(KeepalivePeriod, INTERVAL, "5 minutes"),
VAR("Log", LINELIST, Logs, NULL),
OBSOLETE("LinkPadding"),
OBSOLETE("LogLevel"),
OBSOLETE("LogFile"),
VAR("LongLivedPorts", CSV, LongLivedPorts,
V(LongLivedPorts, CSV,
"21,22,706,1863,5050,5190,5222,5223,6667,6697,8300"),
VAR("MapAddress", LINELIST, AddressMap, NULL),
VAR("MaxAdvertisedBandwidth",MEMUNIT,MaxAdvertisedBandwidth,"1 GB"),
VAR("MaxCircuitDirtiness", INTERVAL, MaxCircuitDirtiness, "10 minutes"),
VAR("MaxOnionsPending", UINT, MaxOnionsPending, "100"),
VAR("MapAddress", LINELIST, AddressMap, NULL),
V(MaxAdvertisedBandwidth, MEMUNIT, "1 GB"),
V(MaxCircuitDirtiness, INTERVAL, "10 minutes"),
V(MaxOnionsPending, UINT, "100"),
OBSOLETE("MonthlyAccountingStart"),
VAR("MyFamily", STRING, MyFamily, NULL),
VAR("NewCircuitPeriod", INTERVAL, NewCircuitPeriod, "30 seconds"),
V(MyFamily, STRING, NULL),
V(NewCircuitPeriod, INTERVAL, "30 seconds"),
VAR("NamingAuthoritativeDirectory",BOOL, NamingAuthoritativeDir, "0"),
VAR("NatdListenAddress", LINELIST, NatdListenAddress, NULL),
VAR("NatdPort", UINT, NatdPort, "0"),
VAR("Nickname", STRING, Nickname, NULL),
VAR("NoPublish", BOOL, NoPublish, "0"),
VAR("NodeFamily", LINELIST, NodeFamilies, NULL),
VAR("NumCpus", UINT, NumCpus, "1"),
VAR("NumEntryGuards", UINT, NumEntryGuards, "3"),
VAR("ORListenAddress", LINELIST, ORListenAddress, NULL),
VAR("ORPort", UINT, ORPort, "0"),
VAR("OutboundBindAddress", STRING, OutboundBindAddress, NULL),
V(NatdListenAddress, LINELIST, NULL),
V(NatdPort, UINT, "0"),
V(Nickname, STRING, NULL),
V(NoPublish, BOOL, "0"),
VAR("NodeFamily", LINELIST, NodeFamilies, NULL),
V(NumCpus, UINT, "1"),
V(NumEntryGuards, UINT, "3"),
V(ORListenAddress, LINELIST, NULL),
V(ORPort, UINT, "0"),
V(OutboundBindAddress, STRING, NULL),
OBSOLETE("PathlenCoinWeight"),
VAR("PidFile", STRING, PidFile, NULL),
VAR("PreferTunneledDirConns", BOOL, PreferTunneledDirConns, "0"),
VAR("ProtocolWarnings", BOOL, ProtocolWarnings, "0"),
VAR("PublishServerDescriptor", CSV, PublishServerDescriptor,"v1,v2"),
VAR("PublishHidServDescriptors",BOOL,PublishHidServDescriptors, "1"),
VAR("ReachableAddresses", LINELIST, ReachableAddresses, NULL),
VAR("ReachableDirAddresses",LINELIST,ReachableDirAddresses,NULL),
VAR("ReachableORAddresses",LINELIST, ReachableORAddresses, NULL),
VAR("RecommendedVersions", LINELIST, RecommendedVersions, NULL),
VAR("RecommendedClientVersions", LINELIST, RecommendedClientVersions, NULL),
VAR("RecommendedServerVersions", LINELIST, RecommendedServerVersions, NULL),
VAR("RedirectExit", LINELIST, RedirectExit, NULL),
VAR("RelayBandwidthBurst", MEMUNIT, RelayBandwidthBurst, "0"),
VAR("RelayBandwidthRate", MEMUNIT, RelayBandwidthRate, "0"),
VAR("RendExcludeNodes", STRING, RendExcludeNodes, NULL),
VAR("RendNodes", STRING, RendNodes, NULL),
VAR("RendPostPeriod", INTERVAL, RendPostPeriod, "1 hour"),
VAR("RephistTrackTime", INTERVAL, RephistTrackTime, "24 hours"),
V(PidFile, STRING, NULL),
V(PreferTunneledDirConns, BOOL, "0"),
V(ProtocolWarnings, BOOL, "0"),
V(PublishServerDescriptor, CSV, "v1,v2"),
V(PublishHidServDescriptors, BOOL, "1"),
V(ReachableAddresses, LINELIST, NULL),
V(ReachableDirAddresses, LINELIST, NULL),
V(ReachableORAddresses, LINELIST, NULL),
V(RecommendedVersions, LINELIST, NULL),
V(RecommendedClientVersions, LINELIST, NULL),
V(RecommendedServerVersions, LINELIST, NULL),
V(RedirectExit, LINELIST, NULL),
V(RelayBandwidthBurst, MEMUNIT, "0"),
V(RelayBandwidthRate, MEMUNIT, "0"),
V(RendExcludeNodes, STRING, NULL),
V(RendNodes, STRING, NULL),
V(RendPostPeriod, INTERVAL, "1 hour"),
V(RephistTrackTime, INTERVAL, "24 hours"),
OBSOLETE("RouterFile"),
VAR("RunAsDaemon", BOOL, RunAsDaemon, "0"),
VAR("RunTesting", BOOL, RunTesting, "0"),
VAR("SafeLogging", BOOL, SafeLogging, "1"),
VAR("SafeSocks", BOOL, SafeSocks, "0"),
VAR("ServerDNSAllowNonRFC953Hostnames",
BOOL, ServerDNSAllowNonRFC953Hostnames, "0"),
VAR("ServerDNSDetectHijacking",BOOL, ServerDNSDetectHijacking,"1"),
VAR("ServerDNSResolvConfFile", STRING, ServerDNSResolvConfFile, NULL),
VAR("ServerDNSSearchDomains", BOOL, ServerDNSSearchDomains, "0"),
VAR("ServerDNSTestAddresses", CSV, ServerDNSTestAddresses,
V(RunAsDaemon, BOOL, "0"),
V(RunTesting, BOOL, "0"),
V(SafeLogging, BOOL, "1"),
V(SafeSocks, BOOL, "0"),
V(ServerDNSAllowNonRFC953Hostnames, BOOL,"0"),
V(ServerDNSDetectHijacking, BOOL, "1"),
V(ServerDNSResolvConfFile, STRING, NULL),
V(ServerDNSSearchDomains, BOOL, "0"),
V(ServerDNSTestAddresses, CSV,
"www.google.com,www.mit.edu,www.yahoo.com,www.slashdot.org"),
VAR("ShutdownWaitLength", INTERVAL, ShutdownWaitLength, "30 seconds"),
VAR("SocksListenAddress", LINELIST, SocksListenAddress, NULL),
VAR("SocksPolicy", LINELIST, SocksPolicy, NULL),
VAR("SocksPort", UINT, SocksPort, "9050"),
VAR("SocksTimeout", INTERVAL, SocksTimeout, "2 minutes"),
V(ShutdownWaitLength, INTERVAL, "30 seconds"),
V(SocksListenAddress, LINELIST, NULL),
V(SocksPolicy, LINELIST, NULL),
V(SocksPort, UINT, "9050"),
V(SocksTimeout, INTERVAL, "2 minutes"),
OBSOLETE("StatusFetchPeriod"),
VAR("StrictEntryNodes", BOOL, StrictEntryNodes, "0"),
VAR("StrictExitNodes", BOOL, StrictExitNodes, "0"),
V(StrictEntryNodes, BOOL, "0"),
V(StrictExitNodes, BOOL, "0"),
OBSOLETE("SysLog"),
VAR("TestSocks", BOOL, TestSocks, "0"),
VAR("TestVia", STRING, TestVia, NULL),
VAR("TrackHostExits", CSV, TrackHostExits, NULL),
VAR("TrackHostExitsExpire",INTERVAL, TrackHostExitsExpire, "30 minutes"),
V(TestSocks, BOOL, "0"),
V(TestVia, STRING, NULL),
V(TrackHostExits, CSV, NULL),
V(TrackHostExitsExpire, INTERVAL, "30 minutes"),
OBSOLETE("TrafficShaping"),
VAR("TransListenAddress", LINELIST, TransListenAddress, NULL),
VAR("TransPort", UINT, TransPort, "0"),
VAR("TunnelDirConns", BOOL, TunnelDirConns, "0"),
VAR("UpdateBridgesFromAuthority",BOOL,UpdateBridgesFromAuthority,"0"),
VAR("UseBridges", BOOL, UseBridges, "0"),
VAR("UseEntryGuards", BOOL, UseEntryGuards, "1"),
VAR("User", STRING, User, NULL),
V(TransListenAddress, LINELIST, NULL),
V(TransPort, UINT, "0"),
V(TunnelDirConns, BOOL, "0"),
V(UpdateBridgesFromAuthority, BOOL, "0"),
V(UseBridges, BOOL, "0"),
V(UseEntryGuards, BOOL, "1"),
V(User, STRING, NULL),
VAR("V1AuthoritativeDirectory",BOOL, V1AuthoritativeDir, "0"),
VAR("V2AuthoritativeDirectory",BOOL, V2AuthoritativeDir, "0"),
VAR("V3AuthoritativeDirectory",BOOL, V3AuthoritativeDir, "0"),
VAR("V3AuthVotingInterval",INTERVAL, V3AuthVotingInterval, "1 hour"),
VAR("V3AuthVoteDelay", INTERVAL, V3AuthVoteDelay, "5 minutes"),
VAR("V3AuthDistDelay", INTERVAL, V3AuthDistDelay, "5 minutes"),
VAR("V3AuthNIntervalsValid", UINT, V3AuthNIntervalsValid, "3"),
V(V3AuthVotingInterval, INTERVAL, "1 hour"),
V(V3AuthVoteDelay, INTERVAL, "5 minutes"),
V(V3AuthDistDelay, INTERVAL, "5 minutes"),
V(V3AuthNIntervalsValid, UINT, "3"),
VAR("VersioningAuthoritativeDirectory",BOOL,VersioningAuthoritativeDir, "0"),
VAR("VirtualAddrNetwork", STRING, VirtualAddrNetwork, "127.192.0.0/10"),
VAR("__AllDirActionsPrivate",BOOL, AllDirActionsPrivate, "0"),
VAR("__DisablePredictedCircuits",BOOL,DisablePredictedCircuits,"0"),
VAR("__LeaveStreamsUnattached", BOOL,LeaveStreamsUnattached, "0"),
V(VirtualAddrNetwork, STRING, "127.192.0.0/10"),
VAR("__AllDirActionsPrivate", BOOL, AllDirActionsPrivate, "0"),
VAR("__DisablePredictedCircuits",BOOL,DisablePredictedCircuits, "0"),
VAR("__LeaveStreamsUnattached",BOOL, LeaveStreamsUnattached, "0"),
{ NULL, CONFIG_TYPE_OBSOLETE, 0, NULL }
};
@ -294,35 +293,34 @@ static config_var_t _option_vars[] = {
{ name, CONFIG_TYPE_ ## conftype, STRUCT_OFFSET(or_state_t, member), \
initvalue }
static config_var_t _state_vars[] = {
VAR("AccountingBytesReadInInterval", MEMUNIT,
AccountingBytesReadInInterval, NULL),
VAR("AccountingBytesWrittenInInterval", MEMUNIT,
AccountingBytesWrittenInInterval, NULL),
VAR("AccountingExpectedUsage", MEMUNIT, AccountingExpectedUsage, NULL),
VAR("AccountingIntervalStart", ISOTIME, AccountingIntervalStart, NULL),
VAR("AccountingSecondsActive", INTERVAL, AccountingSecondsActive, NULL),
V(AccountingBytesReadInInterval, MEMUNIT, NULL),
V(AccountingBytesWrittenInInterval, MEMUNIT, NULL),
V(AccountingExpectedUsage, MEMUNIT, NULL),
V(AccountingIntervalStart, ISOTIME, NULL),
V(AccountingSecondsActive, INTERVAL, NULL),
VAR("EntryGuard", LINELIST_S, EntryGuards, NULL),
VAR("EntryGuardDownSince", LINELIST_S, EntryGuards, NULL),
VAR("EntryGuardUnlistedSince", LINELIST_S, EntryGuards, NULL),
VAR("EntryGuards", LINELIST_V, EntryGuards, NULL),
V(EntryGuards, LINELIST_V, NULL),
VAR("BWHistoryReadEnds", ISOTIME, BWHistoryReadEnds, NULL),
VAR("BWHistoryReadInterval", UINT, BWHistoryReadInterval, "900"),
VAR("BWHistoryReadValues", CSV, BWHistoryReadValues, ""),
VAR("BWHistoryWriteEnds", ISOTIME, BWHistoryWriteEnds, NULL),
VAR("BWHistoryWriteInterval", UINT, BWHistoryWriteInterval, "900"),
VAR("BWHistoryWriteValues", CSV, BWHistoryWriteValues, ""),
V(BWHistoryReadEnds, ISOTIME, NULL),
V(BWHistoryReadInterval, UINT, "900"),
V(BWHistoryReadValues, CSV, ""),
V(BWHistoryWriteEnds, ISOTIME, NULL),
V(BWHistoryWriteInterval, UINT, "900"),
V(BWHistoryWriteValues, CSV, ""),
VAR("TorVersion", STRING, TorVersion, NULL),
V(TorVersion, STRING, NULL),
VAR("LastRotatedOnionKey", ISOTIME, LastRotatedOnionKey, NULL),
VAR("LastWritten", ISOTIME, LastWritten, NULL),
V(LastRotatedOnionKey, ISOTIME, NULL),
V(LastWritten, ISOTIME, NULL),
{ NULL, CONFIG_TYPE_OBSOLETE, 0, NULL }
};
#undef VAR
#undef V
#undef OBSOLETE
/** Represents an English description of a configuration variable; used when