SF.net SVN: fclient: [105] trunk/sandbox/fcp/fcp2_0_consts.py
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <ju...@us...> - 2008-02-02 05:12:45
|
Revision: 105
http://fclient.svn.sourceforge.net/fclient/?rev=105&view=rev
Author: jurner
Date: 2008-02-01 21:12:51 -0800 (Fri, 01 Feb 2008)
Log Message:
-----------
moved types to types module
Modified Paths:
--------------
trunk/sandbox/fcp/fcp2_0_consts.py
Modified: trunk/sandbox/fcp/fcp2_0_consts.py
===================================================================
--- trunk/sandbox/fcp/fcp2_0_consts.py 2008-02-02 05:12:17 UTC (rev 104)
+++ trunk/sandbox/fcp/fcp2_0_consts.py 2008-02-02 05:12:51 UTC (rev 105)
@@ -2,7 +2,6 @@
"""Freennet Client Protocol consts and type mappings"""
-import base64
import logging
#************************************************************************
#
@@ -132,11 +131,16 @@
# others
class ConnectReason:
+ """Reason for connecting to the node
+ @cvar Connect: reason is a regualr connect
+ @cvar Reconnect: reason is a reconnect
+ """
Connect = 1
Reconnect = 2
class DebugVerbosity:
+ """Consts indicating the verbosity level for debugging"""
Debug = logging.DEBUG
Info = logging.INFO
Warning = logging.WARNING
@@ -156,6 +160,12 @@
class FilenameCollision:
+ """Filename collision flags
+ @cvar HandleNever: don't handle filename collisions
+ @cvar HandleRename: rename file on collisions
+ @cvar MaskHandle: bitmask indicating if collisions are hadled or not
+ @cvar CollisonHandled: if this bit is set, a collision has been handled
+ """
HandleNever = 0x0
HandleRename = 0x1
@@ -165,6 +175,7 @@
class KeyType:
+ """Supported key types"""
SSK = 'SSK@'
KSK = 'KSK@'
CHK = 'CHK@'
@@ -177,7 +188,8 @@
class LogMessages:
- """Message strings used for log infos"""
+ """Strings used for log infos"""
+
Connecting = 'connecting to node...'
Connected = 'connected to node'
ConnectionRetry = 'connecting to node failed... retrying'
@@ -193,6 +205,105 @@
+class Message:
+ """Fcp messages"""
+
+ # client s
+ ClientHello = 'ClientHello'
+ ListPeer = 'ListPeer' # (since 1045)
+ ListPeers = 'ListPeers'
+ ListPeerNotes = 'ListPeerNotes'
+ AddPeer = 'AddPeer'
+ ModifyPeer = 'ModifyPeer'
+ ModifyPeerNote = 'ModifyPeerNote'
+ RemovePeer = 'RemovePeer'
+ GetNode = 'GetNode'
+ GetConfig = 'GetConfig' # (since 1027)
+ ModifyConfig = 'ModifyConfig' # (since 1027)
+ TestDDARequest = 'TestDDARequest' # (since 1027)
+ TestDDAResponse = 'TestDDAResponse' # (since 1027)
+ GenerateSSK = 'GenerateSSK'
+ ClientPut = 'ClientPut'
+ ClientPutDiskDir = 'ClientPutDiskDir'
+ ClientPutComplexDir = 'ClientPutComplexDir'
+ ClientGet = 'ClientGet'
+ GetPluginInfo = 'GetPluginInfo'
+ FCPPlugin = 'FCPPlugin'
+ SubscribeUSK = 'SubscribeUSK'
+ WatchGlobal = 'WatchGlobal'
+ GetRequestStatus = 'GetRequestStatus'
+ ListPersistentRequests = 'ListPersistentRequests'
+ RemovePersistentRequest = 'RemovePersistentRequest'
+ ModifyPersistentRequest = 'ModifyPersistentRequest'
+ Shutdown = 'Shutdown'
+
+ # node s
+ NodeHello = 'NodeHello'
+ CloseConnectionDuplicateClientName = 'CloseConnectionDuplicateClientName'
+ Peer = 'Peer'
+ PeerNote = 'PeerNote'
+ EndListPeers = 'EndListPeers'
+ EndListPeerNotes = 'EndListPeerNotes'
+ PeerRemoved = 'PeerRemoved'
+ NodeData = 'NodeData'
+ ConfigData = 'ConfigData' # (since 1027)
+ TestDDAReply = 'TestDDAReply' # (since 1027)
+ TestDDAComplete = 'TestDDAComplete' # (since 1027)
+ SSKKeypair = 'SSKKeypair'
+ PersistentGet = 'PersistentGet'
+ PersistentPut = 'PersistentPut'
+ PersistentPutDir = 'PersistentPutDir'
+ URIGenerated = 'URIGenerated'
+ PutSuccessful = 'PutSuccessful'
+ PutFetchable = 'PutFetchable'
+ DataFound = 'DataFound'
+ AllData = 'AllData'
+ StartedCompression = 'StartedCompression'
+ FinishedCompression = 'FinishedCompression'
+ SimpleProgress = 'SimpleProgress'
+ EndListPersistentRequests = 'EndListPersistentRequests'
+ PersistentRequestRemoved = 'PersistentRequestRemoved' # (since 1016)
+ PersistentRequestModified = 'PersistentRequestModified' # (since 1016)
+ PutFailed = 'PutFailed'
+ GetFailed = 'GetFailed'
+ ProtocolError = 'ProtocolError'
+ IdentifierCollision = 'IdentifierCollision'
+ UnknownNodeIdentifier = 'UnknownNodeIdentifier'
+ UnknownPeerNoteType = 'UnknownPeerNoteType'
+ SubscribedUSKUpdate = 'SubscribedUSKUpdate'
+ PluginInfo = 'PluginInfo'
+ FCPPluginReply = 'FCPPluginReply'
+
+ # client s (internal use only)
+ ClientSocketTimeout = 1
+ ClientSocketDied = 2
+ ClientDisconnected = 3
+
+
+class MessageStatus:
+ Pending = 0x1
+ Compressing = 0x2
+ Started = 0x4
+ Complete = 0x8
+ Error = 0x10
+ Removed = 0x20
+ RestoreFailed = 0x40
+
+
+class MessageSubType:
+ """Consts indicating the subtype of a message"""
+
+ # some additional consts
+ Null = 0
+ GetData = 1
+ GetFile = 2
+ GetKeyInfo = 3
+ Put = 4
+ PutDiskDir = 5
+ PutComplexDir = 6
+
+
+
#TODO: no idea how fcp handles strings as in <Peer volatile.status=CONNECTED>
# all I could find in the sources where these constants as in PEER_NODE_STATUS_CONNECTED
# in --> freenet/node/PeerManager.java
@@ -229,6 +340,20 @@
Low = '4'
+class RequestModified:
+ """Flags indicating what of a request has been modified
+ @cvar Filename: the filename has been modified
+ @cvar Identifier: the identifier has been moodified
+ @cvar PersistentUserData: thepersistent user data has been modified
+ @cvar PriorityClass: the priority class has been modified
+ """
+ Filename = 0x8
+ Identifier = 0x4
+ PersistentUserData = 0x1
+ PriorityClass = 0x2
+
+
+
class ReturnType:
Direct = 'direct'
Disk = 'disk'
@@ -246,742 +371,3 @@
ReportProgress = 0x1
ReportCompression = 0x200
-#*************************************************************************************
-# python <--> fcp value mappings
-#*************************************************************************************
-class FcpType(object):
-
- @classmethod
- def pythonToFcp(clss, value):
- return value
-
- @classmethod
- def fcpToPython(clss, value):
- return value
-
-
-class FcpTypeString(FcpType):
-
- @classmethod
- def pythonToFcp(clss, value):
- return str(value) #TODO: unicode ???
-
- @classmethod
- def fcpToPython(clss, value):
- return value
-
-
-class FcpTypeBool(FcpType):
-
- @classmethod
- def pythonToFcp(clss, value):
- return FcpTrue if value else FcpFalse
-
- @classmethod
- def fcpToPython(clss, value):
- return value == FcpTrue
-
-
-class FcpTypeInt(FcpType):
-
- @classmethod
- def pythonToFcp(clss, value):
- return str(value)
-
- @classmethod
- def fcpToPython(clss, value):
- return int(value)
-
-
-class FcpTypeFloat(FcpType):
-
- @classmethod
- def pythonToFcp(clss, value):
- return str(value)
-
- @classmethod
- def fcpToPython(clss, value):
- return float(value)
-
-
-# GetFailed sets the ExpectedDataLenght field to '' (empty string). Fix this to show up as -1
-class FcpTypeInt_GetFailed_ExpectedDataLenght(FcpType):
-
- @classmethod
- def pythonToFcp(clss, value):
- return str(value)
-
- @classmethod
- def fcpToPython(clss, value):
- if value == '':
- return -1
- return int(value)
-
-
-class FcpTypeIntWithBounds(FcpType):
-
- def __init__(self, lowerBound, upperBound):
- self.lowerBound = lowerBound
- self.upperBound = upperBound
-
- def pythonToFcp(self, value):
- return str(value)
-
- def fcpToPython(self, value):
- return int(value)
-
-
-class FcpTypeBase64EncodedString(FcpType):
-
- @classmethod
- def pythonToFcp(clss, value):
- return base64.b64encode(value)
-
- @classmethod
- def fcpToPython(clss, value):
- return base64.b64decode(value)
-
-
-class FcpTypeTime(FcpType):
-
- @classmethod
- def pythonToFcp(clss, value):
- return str(value * 1000)
-
- @classmethod
- def fcpToPython(clss, value):
- return int(value) / 1000
-
-
-
-class FcpTypeIP(FcpType): pass
-class FcpTypeIPList(FcpType): pass
-class FcpTypeIPort(FcpType): pass
-class FcpTypeStringList(FcpType): pass
-class FcpTypeDirname(FcpType): pass
-class FcpTypeFilename(FcpType): pass
-class FcpTypeNumBytes(FcpType): pass
-class FcpTypePercent(FcpTypeFloat): pass
-class FcpTypeUri(FcpType): pass
-
-
-# special choice types for config message
-
-
-class FcpTypeChoiceFProxyCss(FcpType):
- Clean = 'Clean'
- Boxed = 'boxed'
- GrayAndBlue = 'grayandblue'
- Sky = 'sky'
-
- ChoicesAll = (Clean, Boxed, GrayAndBlue, Sky)
- ChoicesAllowMultiple = False
-
-class FcpTypeChoiceLoggerPriority(FcpType):
- Error = 'ERROR'
- Normal = 'NORMAL'
- Minor = 'MINOR'
- Debug = 'DEBUG'
-
- ChoicesAll = (Error, Normal, Minor, Debug)
- ChoicesAllowMultiple = False
-
-class FcpTypeChoiceNodeDownloadAllowedDirs(FcpType):
- All = 'all'
- Downloads = 'downloads'
- Nowhere = ''
-
- ChoicesAll = (All, Downloads, Nowhere)
- ChoicesAllowMultiple = False
-
-class FcpTypeChoiceNodeUploadAllowedDirs(FcpType):
- All = 'all'
- Nowhere = ''
- ChoicesAll = (All, Nowhere)
- ChoicesAllowMultiple = False
-
-class FcpTypeChoicePriorityPolicy(FcpType):
- Hard = 'HARD'
- Soft = 'SOFT'
-
- ChoicesAll = (Hard, Soft)
- ChoicesAllowMultiple = False
-
-
-class FcpTypeChoiceSSLVersion(FcpType):
- Stl = 'STL'
- SslV3 = 'SSLV3'
- TlsV1 = 'TLSv1'
-
- ChoicesAll = (Stl, SslV3, TlsV1)
- ChoicesAllowMultiple = False
-
-
-#***************************************************************************************
-#
-# param types for config message
-#
-# ..bit more efford here, cos we need types for user input checking
-# ...a slpoppy implementation of a dict should be enough
-#
-#***************************************************************************************
-class ConfigMessageParams(object):
-
- ComponentsSep = '.'
-
-
- # first component of a config message param is always the param class
-
- ParamClassCurrent = 'current'
- ParamClassDefault = 'default'
- ParamClassExpertFlag = 'expertFlag'
- ParamClassForceWriteFlag = 'forceWriteFlag'
- ParamClassShortDescription = 'shortDescription'
- ParamClassLongDescription = 'longDescription'
- ParamClassSortOrder = 'sortOrder'
-
- ParamClasses = (
- ParamClassCurrent,
- ParamClassDefault,
- ParamClassExpertFlag,
- ParamClassForceWriteFlag,
- ParamClassShortDescription,
- ParamClassLongDescription,
- )
-
-
-
- # all known config keys (param class stripped)
- Params = {
-
- 'console.allowedHosts': FcpTypeIPList, # host names, single IPs CIDR-maskip IPs likee 192.168.0.0/24
- 'console.bindTo': FcpTypeIPList,
- 'console.directEnabled': FcpTypeBool,
- 'console.enabled': FcpTypeBool,
- 'console.port': FcpTypeIPort,
- 'console.ssl': FcpTypeBool,
-
-
- 'fcp.allowedHosts': FcpTypeIPList,
- 'fcp.allowedHostsFullAccess': FcpTypeIPList,
- 'fcp.assumeDownloadDDAIsAllowed': FcpTypeBool,
- 'fcp.assumeUploadDDAIsAllowed': FcpTypeBool,
- 'fcp.bindTo': FcpTypeIP,
- 'fcp.enabled': FcpTypeBool,
- 'fcp.persistentDownloadsEnabled': FcpTypeBool,
- 'fcp.persistentDownloadsFile': FcpTypeFilename,
- 'fcp.persistentDownloadsInterval': FcpTypeIntWithBounds(0, None),
- 'fcp.port': FcpTypeIPort,
- 'fcp.ssl': FcpTypeBool,
-
-
- 'fproxy.CSSOverride': FcpTypeBool,
- 'fproxy.advancedModeEnabled': FcpTypeBool,
- 'fproxy.allowedHosts': FcpTypeIPList,
- 'fproxy.allowedHostsFullAccess': FcpTypeIPList,
- 'fproxy.bindTo': FcpTypeIPList,
- 'fproxy.css': FcpTypeChoiceFProxyCss,
- 'fproxy.doRobots': FcpTypeBool,
- 'fproxy.enabled': FcpTypeBool,
- 'fproxy.javascriptEnabled': FcpTypeBool,
- 'fproxy.port': FcpTypeIPort,
- 'fproxy.showPanicButton': FcpTypeBool,
- 'fproxy.ssl': FcpTypeBool,
-
-
- 'logger.dirname': FcpTypeDirname,
- 'logger.enabled': FcpTypeBool,
- 'logger.interval': FcpType, # ??? 1HOUR ??
- 'logger.maxCachedBytes': FcpTypeNumBytes,
- 'logger.maxCachedLines': FcpTypeNumBytes, # ???
- 'logger.maxZippedLogsSize': FcpTypeNumBytes, # ???
- 'logger.priority': FcpTypeChoiceLoggerPriority,
- 'logger.priorityDetail': FcpType, # ???? is it Detailed priority thresholds ???
-
-
- 'node.alwaysAllowLocalAddresses': FcpTypeBool,
- 'node.assumeNATed': FcpTypeBool,
- 'node.bindTo': FcpTypeIP,
- 'node.clientThrottleFile': FcpTypeFilename,
- 'node.databaseMaxMemory': FcpTypeNumBytes,
- 'node.disableHangCheckers': FcpTypeBool,
- 'node.disableProbabilisticHTLs': FcpTypeBool,
- 'node.downloadAllowedDirs': FcpTypeChoiceNodeDownloadAllowedDirs,
- 'node.downloadsDir': FcpTypeDirname,
- 'node.extraPeerDataDir': FcpTypeDirname,
- 'node.includeLocalAddressesInNoderefs': FcpTypeBool,
- 'node.inputBandwidthLimit': FcpTypeNumBytes, # -1 is possible as value aswell
- 'node.ipAddressOverride': FcpTypeIP,
- 'node.l10n': FcpType, # ???
- 'node.lazyResume': FcpTypeBool,
- 'node.listenPort': FcpTypeIPort,
- 'node.maxBackgroundUSKFetchers': FcpTypeIntWithBounds(0, None),
- 'node.maxHTL': FcpTypeIntWithBounds(0, None),
- 'node.name': FcpTypeString,
- 'node.nodeDir': FcpTypeDirname,
- 'node.oneConnectionPerIP': FcpTypeBool,
- 'node.outputBandwidthLimit': FcpTypeNumBytes,
- 'node.passOpennetPeersThroughDarknet': FcpTypeBool,
- 'node.persistentTempDir': FcpTypeDirname,
- 'node.storeDir': FcpTypeDirname,
- 'node.storeForceBigShrinks': FcpTypeBool,
- 'node.storeSize': FcpTypeNumBytes,
- 'node.tempDir': FcpTypeDirname,
- 'node.tempIPAddressHint': FcpTypeIP, # ???
- 'node.testingDropPacketsEvery': FcpTypeIntWithBounds(0, None),
- 'node.uploadAllowedDirs': FcpTypeChoiceNodeDownloadAllowedDirs,
-
-
- 'node.testnet.enabled': FcpTypeBool,
-
-
- 'node.load.aggressiveGC': FcpType, # ???
- 'node.load.freeHeapBytesThreshold': FcpTypeNumBytes,
- 'node.load.freeHeapPercentThreshold': FcpTypePercent,
- 'node.load.memoryChecker': FcpTypeBool,
- 'node.load.nodeThrottleFile': FcpTypeFilename,
- 'node.load.threadLimit': FcpTypeIntWithBounds(0, None),
-
-
- 'node.opennet.acceptSeedConnections': FcpTypeBool,
- 'node.opennet.alwaysAllowLocalAddresses': FcpTypeBool,
- 'node.opennet.assumeNATed': FcpTypeBool,
- 'node.opennet.bindTo': FcpTypeIP,
- 'node.opennet.enabled': FcpTypeBool,
- 'node.opennet.listenPort': FcpTypeIPort,
- 'node.opennet.maxOpennetPeers': FcpTypeIntWithBounds(0, None),
- 'node.opennet.oneConnectionPerIP': FcpTypeBool,
- 'node.opennet.testingDropPacketsEvery': FcpTypeIntWithBounds(0, None),
-
- 'node.scheduler.CHKinserter_priority_policy': FcpTypeChoicePriorityPolicy,
- 'node.scheduler.CHKrequester_priority_policy': FcpTypeChoicePriorityPolicy,
- 'node.scheduler.SSKinserter_priority_policy': FcpTypeChoicePriorityPolicy,
- 'node.scheduler.SSKrequester_priority_policy': FcpTypeChoicePriorityPolicy,
-
- 'node.updater.URI': FcpTypeUri,
- 'node.updater.autoupdate': FcpTypeBool,
- 'node.updater.enabled': FcpTypeBool,
- 'node.updater.extURI': FcpTypeUri,
- 'node.updater.revocationURI': FcpTypeUri,
-
-
- 'pluginmanager.loadplugin': FcpTypeStringList,
- 'pluginmanager2.loadedPlugins': FcpTypeStringList,
-
-
- 'ssl.sslEnable': FcpTypeBool,
- 'ssl.sslKeyPass': FcpTypeString,
- 'ssl.sslKeyStore': FcpTypeFilename,
- 'ssl.sslKeyStorePass': FcpTypeString,
- 'ssl.sslVersion': FcpTypeChoiceSSLVersion,
-
- 'toadletsymlinker.symlinks': FcpTypeStringList,
-
- }
-
-
- def __init__(self):
- pass
-
-
- def splitAll(self, paramName):
- return paramName.split(self.ComponentsSep)
-
- def splitParamClass(self, paramName):
- return paramName.split(self.ComponentsSep, 1)
-
-
- def get(self, paramName, default=None):
- try:
- return self[paramName]
- except KeyError:
- return default
-
-
- def __getitem__(self, paramName):
- paramClass, paramKey = self.splitParamClass(paramName)
- if paramClass == self.ParamClassCurrent:
- return self.Params[paramKey]
- elif paramClass == self.ParamClassDefault:
- return self.Params[paramKey]
- elif paramClass == self.ParamClassExpertFlag:
- return FcpTypeBool
- elif paramClass == self.ParamClassForceWriteFlag:
- return FcpTypeBool
- elif paramClass == self.ParamClassShortDescription:
- return FcpTypeString
- elif paramClass == self.ParamClassLongDescription:
- return FcpTypeString
- elif paramClass == self.ParamClassSortOrder:
- return FcpTypeInt
- else:
- raise ValueError('Unknown param class in: %r' % paramName)
-
-#***************************************************************************************
-#
-# param types for peer message
-#
-# ..need to do a bit more here, cos it may be needed to validate user input
-#
-#***************************************************************************************
-PeerMessageParams = {
- 'ark.number': FcpTypeInt,
- 'auth.negTypes': FcpTypeInt,
-
-
- 'location': FcpTypeFloat,
- 'opennet': FcpTypeBool,
- 'testnet': FcpTypeBool,
-
- 'metadata.timeLastConnected': FcpTypeTime,
- 'metadata.timeLastReceivedPacket': FcpTypeTime,
- 'metadata.timeLastRoutable': FcpTypeTime,
- 'metadata.timeLastSuccess': FcpTypeTime,
- 'metadata.routableConnectionCheckCount': FcpTypeInt,
- 'metadata.hadRoutableConnectionCount': FcpTypeInt,
-
- 'volatile.averagePingTime': FcpTypeFloat,
- 'volatile.overloadProbability': FcpTypePercent,
- 'volatile.routingBackoff': FcpTypeInt,
- 'volatile.routingBackoffPercent': FcpTypePercent,
- 'volatile.totalBytesIn': FcpTypeInt,
- 'volatile.totalBytesOut': FcpTypeInt,
- 'volatile.routingBackoffLength': FcpTypeInt,
- }
-
-'''all other Peer message params here....
-
->> identity=YIrE..................
->> lastGoodVersion=Fred,0.7,1.0,1106
->> physical.udp=00.000.000.000:00000
->> version=Fred,0.7,1.0,1107
->> dsaGroup.q=ALFDN...............
->> dsaGroup.p=AIYIrE..................
->> dsaPubKey.y=YSlb............
->> dsaGroup.g=UaRa...............
->> ark.pubURI=SSK@......................
->>
->> metadata.detected.udp=000.000.000.000:00000
-
->> volatile.lastRoutingBackoffReason=ForwardRejectedOverload
->> volatile.percentTimeRoutableConnection=99.4735.................
->> volatile.status=CONNECTED
-
-'''
-
-#***************************************************************************************
-#
-# param types for node message
-#
-#***************************************************************************************
-NodeMessageParams = {
- 'ark.number': FcpTypeInt,
- 'auth.negTypes': FcpTypeInt,
- 'location': FcpTypeFloat,
- 'opennet': FcpTypeBool,
- 'testnet': FcpTypeBool,
-
-
- 'volatile.allocatedJavaMemory': FcpTypeInt,
- 'volatile.availableCPUs': FcpTypeInt,
- 'volatile.averagePingTime': FcpTypeFloat,
- 'volatile.avgStoreAccessRate': FcpTypePercent,
- 'volatile.backedOffPercent': FcpTypePercent,
- 'volatile.bwlimitDelayTime': FcpTypeFloat,
- 'volatile.cacheAccess': FcpTypeInt,
- 'volatile.cachedKeys': FcpTypeInt,
- 'volatile.cachedSize': FcpTypeInt,
- 'volatile.cachedStoreHits': FcpTypeInt,
- 'volatile.cachedStoreMisses': FcpTypeInt,
- 'volatile.freeJavaMemory': FcpTypeInt,
- 'volatile.isUsingWrapper': FcpTypeBool,
- 'volatile.locationChangePerMinute': FcpTypeFloat,
- 'volatile.locationChangePerSession': FcpTypeFloat,
- 'volatile.locationChangePerSwap': FcpTypeFloat,
- 'volatile.maximumJavaMemory': FcpTypeInt,
- 'volatile.maxOverallKeys': FcpTypeInt,
- 'volatile.maxOverallSize': FcpTypeInt,
- 'volatile.networkSizeEstimate24hourRecent': FcpTypeInt,
- 'volatile.networkSizeEstimate48hourRecent': FcpTypeInt,
- 'volatile.networkSizeEstimateSession': FcpTypeInt,
- 'volatile.noSwaps': FcpTypeFloat,
- 'volatile.noSwapsPerMinute': FcpTypeFloat,
- 'volatile.numberOfARKFetchers': FcpTypeInt,
- 'volatile.numberOfBursting': FcpTypeInt,
- 'volatile.numberOfConnected': FcpTypeInt,
- 'volatile.numberOfDisabled': FcpTypeInt,
- 'volatile.numberOfDisconnected': FcpTypeInt,
- 'volatile.numberOfInsertSenders': FcpTypeInt,
- 'volatile.numberOfListening': FcpTypeInt,
- 'volatile.numberOfListenOnly': FcpTypeInt,
- 'volatile.numberOfNeverConnected': FcpTypeInt,
- 'volatile.numberOfNotConnected': FcpTypeInt,
- 'volatile.numberOfRemotePeerLocationsSeenInSwaps': FcpTypeFloat,
- 'volatile.numberOfRequestSenders': FcpTypeInt,
- 'volatile.numberOfRoutingBackedOff': FcpTypeInt,
- 'volatile.numberOfSimpleConnected': FcpTypeInt,
- 'volatile.numberOfTooNew': FcpTypeInt,
- 'volatile.numberOfTooOld': FcpTypeInt,
- 'volatile.numberOfTransferringRequestSenders': FcpTypeInt,
- 'volatile.numberWithRoutingBackoffReasons.ForwardRejectedOverload': FcpTypeInt,
- 'volatile.overallAccesses': FcpTypeInt,
- 'volatile.overallKeys': FcpTypeInt,
- 'volatile.overallSize': FcpTypeInt,
- 'volatile.percentCachedStoreHitsOfAccesses': FcpTypePercent,
- 'volatile.percentOverallKeysOfMax': FcpTypePercent,
- 'volatile.percentStoreHitsOfAccesses': FcpTypePercent,
- 'volatile.pInstantReject': FcpTypeFloat, # or percent?
- 'volatile.recentInputRate': FcpTypeFloat,
- 'volatile.recentOutputRate': FcpTypeFloat,
- 'volatile.routingMissDistance': FcpTypeFloat,
- 'volatile.runningThreadCount': FcpTypeInt,
- 'volatile.startedSwaps': FcpTypeInt,
- 'volatile.startupTime': FcpTypeTime,
- 'volatile.storeAccesses': FcpTypeInt,
- 'volatile.storeHits': FcpTypeInt,
- 'volatile.storeKeys': FcpTypeInt,
- 'volatile.storeMisses': FcpTypeInt,
- 'volatile.storeSize': FcpTypeInt,
- 'volatile.swaps': FcpTypeFloat,
- 'volatile.swapsPerMinute': FcpTypeFloat,
- 'volatile.swapsPerNoSwaps': FcpTypeFloat,
- 'volatile.swapsRejectedAlreadyLocked': FcpTypeInt,
- 'volatile.swapsRejectedLoop': FcpTypeInt,
- 'volatile.swapsRejectedNowhereToGo': FcpTypeInt,
- 'volatile.swapsRejectedRateLimit': FcpTypeInt,
- 'volatile.swapsRejectedRecognizedID': FcpTypeInt,
- 'volatile.totalInputBytes': FcpTypeInt,
- 'volatile.totalInputRate': FcpTypeInt,
- 'volatile.totalOutputBytes': FcpTypeInt,
- 'volatile.totalOutputRate': FcpTypeInt,
- 'volatile.totalPayloadOutputBytes': FcpTypeInt,
- 'volatile.totalPayloadOutputPercent': FcpTypePercent,
- 'volatile.totalPayloadOutputRate': FcpTypeInt,
- 'volatile.unclaimedFIFOSize': FcpTypeInt,
- 'volatile.uptimeSeconds': FcpTypeInt,
- 'volatile.usedJavaMemory': FcpTypeInt,
- }
-
-
-'''
->>all other NodeData message params here....
->>
->> physical.udp=000.000.000.000:00000
->> dsaPubKey.y=GgrpsNUK9m.................................................
->> version=Fred,0.7,1.0,1107
->> myName=whatever
->> ark.pubURI=SSK@...............
-
->> dsaGroup.q=ALFDNoq.....
->> dsaGroup.p=AIYIrE9VNhM3.............
->> volatile.avgConnectedPeersPerNode=15.35................
->> dsaGroup.g=UaRa.............
->> dsaPrivKey.x=Pwam..................
->> ark.privURI=SSK@.................
->> lastGoodVersion=Fred,0.7,1.0,1106
->> sig=691f............
->> identity=vMQa~..................
-
-'''
-#***************************************************************************************
-#
-# Mapping from message params to param types
-#
-# ...being lazy here, only types that are not strings are declared
-#
-#***************************************************************************************
-MessageParamTypes = {
-
- # client messages
-
- 'ListPeer': {
- 'WithMetadata': FcpTypeBool,
- 'WithVolantile': FcpTypeBool,
- },
-
- 'ListPeers': {
- 'WithMetadata': FcpTypeBool,
- 'WithVolantile': FcpTypeBool,
- },
-
- #'AddPeer': # added later as PeerMessageParams
-
- 'ModifyPeer': {
- 'AllowLocalAddresses': FcpTypeBool,
- 'IsDisabled': FcpTypeBool,
- 'ListenOnly': FcpTypeBool,
- },
-
- 'ModifyPeerNote': {
- 'NoteText': FcpTypeBase64EncodedString,
- },
-
- 'GetNode': {
- 'GiveOpennetRef': FcpTypeBool,
- 'WithPrivate': FcpTypeBool,
- 'WithVolatile': FcpTypeBool,
- },
- 'GetConfig': {
- 'WithCurrent': FcpTypeBool,
- 'WithDefaults': FcpTypeBool,
- 'WithSortOrder': FcpTypeBool,
- 'WithExpertFlag': FcpTypeBool,
- 'WithForceWriteFlag': FcpTypeBool,
- 'WithShortDescription': FcpTypeBool,
- 'WithLongDescription': FcpTypeBool,
- },
-
- #'ModifyConfig': # added later as ConfigMessageParams()
-
- 'TestDDARequest': {
- 'WantReadDirectory': FcpTypeBool,
- 'WantWriteDirectory': FcpTypeBool,
- },
- 'ClientPut': {
- 'BinaryBlob': FcpTypeBool,
- 'DontCompress': FcpTypeBool,
- 'EarlyEncode': FcpTypeBool,
- 'GetCHKOnly': FcpTypeBool,
- 'Global': FcpTypeBool,
- 'MaxRetries': FcpTypeInt,
- 'Verbosity': FcpTypeInt,
- },
- 'ClientGet': {
- 'BinaryBlob': FcpTypeBool,
- 'Global': FcpTypeBool,
- 'IgnoreDS': FcpTypeBool,
- 'DSOnly': FcpTypeBool,
- 'MaxSize': FcpTypeInt,
- 'MaxTempSize': FcpTypeInt,
- 'Verbosity': FcpTypeInt,
- },
- 'SubscribeUSK': {
- 'DontPoll': FcpTypeBool,
- },
- 'WatchGlobal': {
- 'Enabled': FcpTypeBool,
- 'VerbosityMask': FcpTypeInt,
- },
- 'GetRequestStatus': {
- 'Global': FcpTypeBool,
- 'OnlyData': FcpTypeBool,
- },
- 'RemopvePersistentRequest': {
- 'Global': FcpTypeBool,
- },
- 'ModifyPersistentRequest': {
- 'Global': FcpTypeBool,
- },
- 'GetPluginInfo': {
- 'Detailed': FcpTypeBool,
- },
-
-
-
- # node messages
-
- 'NodeHello': {
- 'Build': FcpTypeInt,
- 'CompressionCodecs': FcpTypeInt,
- 'ExtBuild': FcpTypeInt,
- 'ExtRevision': FcpTypeInt,
- 'FcpVersion': FcpTypeFloat,
- 'Testnet': FcpTypeBool,
- },
-
- #'Peer': # added later as PeerMessageParams
-
- 'PeerNote': {
- 'NoteText': FcpTypeBase64EncodedString,
- },
-
-
- #'NodeData': # added later as NodeMessageParams
- #'ConfigData': # added later as ConfigMessageParams()
-
- 'TestDDAComplete': {
- 'ReadDirectoryAllowed': FcpTypeBool,
- 'WriteDirectoryAllowed': FcpTypeBool,
- },
- 'PutFetchable': {
- 'Global': FcpTypeBool,
- },
- 'DataFound': {
- 'Global': FcpTypeBool,
- 'DataLength': FcpTypeInt,
- },
- 'AllData': {
- 'Global': FcpTypeBool,
- #NOTE: we ignore startup and completion time here as long as it is not passed in all related messages
-
- },
- 'FinishedCompression': {
- 'OriginalSize': FcpTypeInt,
- 'CompressedSize': FcpTypeInt,
- },
- 'SimpleProgress': {
- 'Total': FcpTypeInt,
- 'Required': FcpTypeInt,
- 'Failed': FcpTypeInt,
- 'FatalyFailed': FcpTypeInt,
- 'Succeeded': FcpTypeInt,
- 'Finalized': FcpTypeBool,
- },
- 'PersistentRequestRemoved': {
- 'Global': FcpTypeBool,
- },
- 'PersistentRequestModified': {
- 'Global': FcpTypeBool,
- },
- 'PutFailed': {
- 'Global': FcpTypeBool,
- 'Code': FcpTypeInt,
- },
- 'GetFailed': {
- 'Code': FcpTypeInt,
- 'ExpectedDataLength': FcpTypeInt_GetFailed_ExpectedDataLenght,
- 'Fatal': FcpTypeBool,
- 'FinalizedExpected': FcpTypeBool,
- 'Global': FcpTypeBool,
- },
- 'ProtocolError': {
- 'Code': FcpTypeInt,
- 'Global': FcpTypeBool,
- },
-
- 'IdentifierCollision': {
- 'Global': FcpTypeBool,
- },
- 'SubscribedUSKUpdate': {
- 'Edition': FcpTypeInt,
- },
- 'GetPluginInfo': {
- 'Started': FcpTypeBool,
- },
-
- }
-
-MessageParamTypes['ClientPutDiskDir'] = MessageParamTypes['ClientPut']
-MessageParamTypes['ClientComplexDir'] = MessageParamTypes['ClientPut']
-
-# TODO: "Started" param? Think we simply ignore it
-MessageParamTypes['PersistentGet'] = MessageParamTypes['ClientGet']
-MessageParamTypes['PersistentPut'] = MessageParamTypes['ClientPut']
-
-
-MessageParamTypes['ModifyConfig'] = MessageParamTypes['ConfigData'] = ConfigMessageParams()
-
-MessageParamTypes['Peer'] = MessageParamTypes['AddPeer'] = PeerMessageParams
-
-
-
-
-
-
-
-
-
-
-
-
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|