Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 956 Categories, Downloaded 50.164.761 Times

BEncoding 1.0

Company: Glass Echidna
Date Added: September 15, 2013  |  Visits: 327

BEncoding

Report Broken Link
Printer Friendly Version


Product Homepage
Download (37 downloads)



I recently found my interest piqued by the open-source, cross-platform BitTorrent client, Transmission. Upon downloading the source code for Transmission, we were disappointed to see that libtransmission featured only a very low-level BEncoding implementation. The unofficial BitTorrent specification refers to implementations in several languages, including Objective-C.<br /><br />The Objective-C implementation provides a nice high-level library of methods (in reality, only two are needed!), but has a few flaws: there are some memory leaks, it doesn???*a*?t quite implement the specification entirely correctly and string-handling functionality is cumbersome. We???*a*?ve improved upon it in these respects and are releasing the code after the jump.<br /><br />The primary issue that motivated us to rewrite the provided Objective-C implementation is the handling of dictionaries. This is what the unofficial specification has to say on the matter (emphasis ours) :<br /><br /> The initial d and trailing e are the beginning and ending delimiters. Note that the keys must be bencoded strings. The values may be any bencoded type, including integers, strings, lists, and other dictionaries. Keys must be strings and appear in sorted order (sorted as raw strings, not alphanumerics). The strings should be compared using a binary comparison, not a culture-specific "natural" comparison.<br /><br />The Objective-C implementation fails to adhere to the bolded clause. This is because it provides support for dictionaries by means of Cocoa???*a*?s NSDictionary class cluster. Luckily, fixing this issue is as easy as using the OrderedDictionary class as a drop-in replacement. This takes care of instantiating order-aware dictionaries from bencoded data. Providing support for going the other way (from a dictionary to its bencoded equivalent) is similarly straight-forward.<br /><br />Once this was fixed, we moved onto the issue of memory leaks. We were not the only ones to notice these leaks, so we pulled out our static analyser and got to work. For internal code consistency, we opted to replace leaking manually-allocated objects with autoreleased counterparts. This also resulted in slightly more concise code than allocating and releasing everything by hand.<br /><br />Once we had finally arrived at a compliant implementation, we turned our attention towards the issue of string handling. The blog post to which the Obj-C implementation was attached noted that there is no hint as to whether a bencoded byte string is a human-readable string or a binary blob. Rather than leaving everything as NSData instances, we have developed another method for the BEncoding class that takes a "type advisor" block as an argument. Whenever a byte string is encountered, the user-provided block is called and passed the current dictionary key "stack" for the data being processed. This block can then "hint" to the decoding routine whether it should be processed as a string or a byte stream. An example of this is illustrated below.

Requirements: No special requirements
Platforms: Mac, Mac OSX
Keyword: Bencoded Binary Block Class Dictionaries Dictionary Implementation Issue Leaks Memory Objectivec Specification String Strings Support Takes
Users rating: 0/10

License: Freeware Size: 20.48 KB
USER REVIEWS
More Reviews or Write Review


BENCODING RELATED
Development Tools  -  Agilent 8753/8720 VNA Binary Data Read 1.0
This programs shows how to read data back from the Agilent/HP 8753/8720 Series Network Analyzers using FORM5 (32-bit little-endian) binary block format
10 KB  
Miscellaneous  -  A List of Dictionaries 1.0
ThisĀ  class emulates a list of dictionary objects without the memory and pickle storage overhead which occurs when storing every item in the list as a dictionary.
 
Development Tools  -  O.J. Danzy 1.0
This programs shows how to read data back from the Agilent/HP 8753/8720 Series Network Analyzers using FORM5 (32-bit little-endian) binary block format.
10 KB  
Server Management  -  SUAS MapServer 3.20.0625
SUAS MapServer is a PHP based Web Map Service (WMS) and WFS implementation according to OGC's specification. Data are stored according to Simple Features Specification in WKT format and delivered (among others) in SVG, PDF, Flash, PNG, and GIF...
 
Utilities  -  mcnet4l 20010902
MCNet4L is an implementation of the CompactPCI Multicomputing Specification (PICMG 2.14) for Linux.
153.6 KB  
Libraries  -  Transparent Parallel I/O Environment 20050912
Transparent Parallel I/O Environment is a software environment (written in C++) that facilitates the implementation of external memory algorithms. The goal of theoretical work in the area of external memory algorithms (also called I/O algorithms...
1.1 MB  
Libraries  -  TPIE 91905
TPIE is a software environment (written in C++) that facilitates the implementation of external memory algorithms. The goal of theoretical work in the area of external memory algorithms (also called I/O algorithms or out-of-core algorithms) has...
1.14 MB  
Programming  -  GroupPac 1.0
Implementation of Fault Tolerant CORBA specification, V1.0 (OMG Document ptc/2000-04-04), extended to support large-scale, distributed systems.Implements both Passive (Cold and Warm) and Active replication styles.
5.06 MB  
MP3 Tools  -  JEmpeg 2.0b11
JEmpeg aims to offer a Java implementation of the various Empeg management software to support as many platforms as possible.
508.4 KB  
Utilities  -  UNFS3 user-space NFSv3 server 3.0.9.22
UNFS3 is a user-space implementation of the NFSv3 server specification. It provides a unified mountd and nfsd program and so far runs under Linux, NetBSD, and Solaris.
164.5 KB  
NEW DOWNLOADS IN MACINTOSH SOFTWARE, PROGRAMMING
Macintosh Software  -  EasyEDA PCB Designer for MacOS 2.0.0
EasyEDA, a great web based EDA(Electronics Design Automation) tool, online PCB tool, online PCB software for electronics engineers, educators, students, makers and enthusiasts. Theres no need to install any software. Just open EasyEDA in any...
34.4 MB  
Macintosh Software  -  VideoSolo Video to GIF Converter (Mac) 1.0.12
How to make a GIF? VideoSolo Free Video to GIF Converter for Mac supports all popular video files including MP4, AVI, MOV, WMV, FLV, M4V, etc. You can easily turn MP4/AVI/MOV/WMV/FLV/M4V to GIF animation on Mac and share your GIFs with your...
46.51 MB  
Macintosh Software  -  VideoSolo Free Video Converter (Mac) 1.0.18
VideoSolo Free Video Converter for Mac is a fast, powerful and easy-to-master video converter. Its main purpose is to convert video files from one format into another. It is able to convert video and audio files in 300+ formats on Mac for totally...
75.29 MB  
Macintosh Software  -  ManyCam for Mac 6
ManyCam is a free Webcam software and a screen recorder for anyone to use. Several feature enhancements are included within ManyCam to produce a professional quality live video production. It can connect a desktop, smartphone, tablet and live...
90.49 MB  
Macintosh Software  -  MacX Free Rip DVD to QuickTime for Mac 4.1.9
MacX Free Rip DVD to QuickTime for Mac is totally free yet versatile DVD to QuickTime ripper software for Mac users to free rip both normal and copy-protected DVDs to QuickTime MOV, MP4 on Mac with excellent image quality. Besides the powerful...
36.3 MB  
Programming  -  MacX Free iMovie Video Converter 4.1.8
MacX Free iMovie Video Converter is a professional free iMovie video converter for Mac that can convert any SD and HD videos such as M2TS, MKV, AVI, WMV, FLV, VOB, 3GP and more to iMovie accepted video formats MOV & MP4 for importing to iMovie...
22.92 MB  
Programming  -  SwapList 0.1 Alpha
Java list implementation that swaps list items to a disk file in order to avoid out-of-memory error.
10.24 KB  
Programming  -  Mano 1.05 Beta
Mano is a makeFile navigator containing a tree grouping the targets.
20.48 KB  
Programming  -  Workhorse 1.2
Workhorse automates tedious file transfer and deletion tasks. Just tell it when or how often you want it to run, fill in the details, and let it do it's job! Do you know Applescript? Use Workhorse to run your scripts at a given time or interval....
225.28 KB  
Programming  -  PLT Scheme (formerly DrScheme) Darwin (PPC) 4.2
PLT Scheme is an interactive, integrated, graphical programming environment for the Scheme, MzScheme, and MrEd programming languages. PLT Scheme provides source highlighting for syntax and run-time errors, support for multiple language...
38.27 MB