1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-27 18:18:10 +00:00
transmission/third-party/libutp
2011-03-30 23:54:39 +00:00
..
LICENSE import libutp into third-party/ and plug it in to autoconf, automake 2011-02-18 00:31:49 +00:00
Makefile.am import libutp into third-party/ and plug it in to autoconf, automake 2011-02-18 00:31:49 +00:00
README.md import libutp into third-party/ and plug it in to autoconf, automake 2011-02-18 00:31:49 +00:00
StdAfx.h import libutp into third-party/ and plug it in to autoconf, automake 2011-02-18 00:31:49 +00:00
templates.h import libutp into third-party/ and plug it in to autoconf, automake 2011-02-18 00:31:49 +00:00
utp.cpp Revert "Protect against broken implementations of monotonic time." 2011-03-12 22:45:14 +00:00
utp.h import libutp into third-party/ and plug it in to autoconf, automake 2011-02-18 00:31:49 +00:00
utp_config.h make a note that we need to implement UTP_GetGlobalUTPBytesSent in libtransmission 2011-02-18 00:33:54 +00:00
utp_config_example.h import libutp into third-party/ and plug it in to autoconf, automake 2011-02-18 00:31:49 +00:00
utp_utils.cpp (trunk libT) #4153 "Protect against non-monotonic time in libutp" -- try again. 2011-03-30 23:54:39 +00:00
utp_utils.h import libutp into third-party/ and plug it in to autoconf, automake 2011-02-18 00:31:49 +00:00
utypes.h (trunk) #4138 "use stdbool.h instead of tr_bool" -- done. 2011-03-22 15:19:54 +00:00

libutp - The uTorrent Transport Protocol library.

Copyright (c) 2010 BitTorrent, Inc.

uTP is a TCP-like implementation of LEDBAT documented as a BitTorrent extension in BEP-29. uTP provides provides reliable, ordered delivery while maintaining minimum extra delay. It is implemented on top of UDP to be cross-platform and functional today. As a result, uTP is the primary transport for uTorrent peer-to-peer connections.

uTP is written in C++, but the external interface is strictly C (ANSI C89).

The Interface

The uTP socket interface is a bit different from the Berkeley socket API to avoid the need for our own select() implementation, and to make it easier to write event-based code with minimal buffering.

When you create a uTP socket, you register a set of callbacks. Most notably, the on_read callback is a reactive callback which occurs when bytes arrive off the network. The write side of the socket is proactive, and you call UTP_Write to indicate the number of bytes you wish to write. As packets are created, the on_write callback is called for each packet, so you can fill the buffers with data.

The libutp interface is not thread-safe. It was designed for use in a single-threaded asyncronous context, although with proper synchronization it may be used from a multi-threaded environment as well.

See utp.h for more details and other API documentation.

Examples

See the utp_test and utp_file directories for examples.

Building

uTP has been known to build on Windows with MSVC and on linux and OS X with gcc. On Windows, use the MSVC project files (utp.sln, and friends). On other platforms, building the shared library is as simple as:

make

To build one of the examples, which will statically link in everything it needs from libutp:

cd utp_test && make

License

libutp is released under the MIT license.

Research and analysis of congestion control mechanisms can be found here.