Package DebTorrent :: Package BT1 :: Module btformats
[hide private]
[frames] | no frames]

Module btformats

source code

Functions for verifying debtorrent metainfo.

These functions all work on bdecoded debtorrent metainfo, and are used to verify their conformance with the protocol.

Functions [hide private]
 
check_info(info)
Checks the info dictionary for conformance.
source code
 
check_message(message)
Checks the metainfo dictionary for conformance.
source code
 
check_peers(message)
Checks the peers dictionary returned by a tracker for conformance.
source code
Variables [hide private]
regex reg = re.compile(r'^[^/\\\.~][^/\\]*$')
a compiled regex for verifying the security of path names
tuple of types ints = (<type 'long'>, <type 'int'>)
the types that are acceptable for integer values

Imports: types.StringType, types.LongType, types.IntType, types.ListType, types.DictType, re.compile, bisect.bisect


Function Details [hide private]

check_info(info)

source code 

Checks the info dictionary for conformance.

Verifies that the info dictionary of the metainfo conforms to the debtorrent protocol.
Parameters:
  • info (dictionary) - the info field from the metainfo dictionary
Raises:
  • ValueError - if the info doesn't conform

check_message(message)

source code 

Checks the metainfo dictionary for conformance.

Verifies that the metainfo dictionary conforms to the debtorrent protocol.
Parameters:
  • message (dictionary) - the bdecoded metainfo dictionary
Raises:
  • ValueError - if the metainfo doesn't conform

check_peers(message)

source code 

Checks the peers dictionary returned by a tracker for conformance.

Verifies that the peers dictionary returned by a tracker conforms to the debtorrent protocol.
Parameters:
  • message (dictionary) - the bdecoded peers dictionary returned by a tracker
Raises:
  • ValueError - if the info doesn't conform