Author: Christopher R. Hertel
License: GNU GPL version 3 or above
+ Some modules released under the LGPL v3.0 or above.
Acknowledgements:
This code was developed in participation with the Protocol Freedom
PeerDist
is a distributed content caching system that Microsoft threw together
- for Windows 7 and Windows 2008r2. The commercial name for the
- distributed caching system is "BranchCache", but if you get into the
- guts of their documentation they refer to the underlying protocols as
- PeerDist.
+ for Windows 7 and Windows 2008r2. The commercial name for the system is
+ "BranchCache", but if you get into the guts of their documentation they
+ refer to the underlying protocols as PeerDist.
Prequel
- is an Open Source project dedicated to implementing PeerDist protocols
- for Linux (and, eventually, *BSD and other Unix-like systems).
+ is an Open Source project aimed at implementing PeerDist protocols for
+ Linux (and, eventually, *BSD and other Unix-like systems).
Overview
Compiling
Current Requirements:
- * Linux 2.6 and 3.0 based system (see below for other platforms)
+ * Linux 2.6 or above (see below for other platforms)
* OpenSSL (again, see the notes below)
- The initial release of PrequelD was written for and tested on Linux.
- It should compile and run on most 2.6/3.0 kernel systems. It has been
- tested on 32-bit Linux for ARM (Arch Linux), and both 32-bit and 64-bit
- x86 platforms.
+ The initial release of PrequelD was written for and tested on Linux. It
+ should compile and run on most 2.6+ kernel systems. It has been tested on
+ 32-bit Linux for ARM (Arch Linux), and both 32-bit and 64-bit x86 platforms.
The plan is to port PrequelD to OpenBSD, with the goal of making it work
nicely on FreeBSD and NetBSD as well.
shown below. The only external requirement is OpenSSL, but the code is
written to make it easy to replace OpenSSL with another hashing library.
- cc FIX FIX FIX:
+ cc -I.. -o PrequelD PrequelD.c Gstr.c PD_peerdist1.c PD_read_config.c \
+ PD_sha2_oSSL.c PD_utils.c ../ubi_sLinkList.c -lcrypto -lpthread
- DEFAULT_CONFIG_FILE
- DEFAULT_SOCK_FILE
- DEFAULT_KEY_FILE
+ You can also add command-line definitions for the following constants:
+
+ * DEFAULT_CONFIG_FILE
+ Defaults to: /etc/prequeld/pd.conf
+
+ * DEFAULT_SOCK_FILE
+ Defaults to: /var/run/prequeld.sock
+
+ * DEFAULT_KEY_FILE
+ Defaults to: /etc/prequeld/pd.key
+
+ The above are all default values that are compiled into the program. An
+ alternate configuration file can be specified on the command-line, and the
+ socket and key file pathnames can be changed in the configuration file.
Configuration File Syntax and Semantics
the sourcedir.
* You can also put key/value pairs within a cachedir block, but remember
- that they only apply to sourcedir entries that appear later in the same
- block.
+ that they only apply to sourcedir entries that appear *later* in the
+ same block.
* Comments are introduced using a hash character ('#') and continue to the
end of the line. Whitespace is anything recognized as such by the
PrequelD socket file (a "unix domain socket") and sending a request.
Request format:
- "Gimme " pathname '\n' [ "Range " start '-' end '\n'] '\n'
+ message :== gimme [range] [peerdist] '\n'
+ gimme :== "Gimme " pathname '\n'
+ range :== "Range: " start '-' end '\n'
+ peerdist :== "Peerdist: " major '.' minor '\n'
+
+ ...where start, end, major, and minor are all strings of numeric digits.
Yes, the command being sent is "Gimme". It must be followed by a space
and a pathname. The pathname identifies the original (source) file,
original file that is being requested. The hash segments returned will
cover at least the requested range.
+ The optional "Peerdist: " clause is used to specify the version of
+ PeerDist that the client is requesting. If this clause is ommitted, the
+ server will return Content Information using the lowest available
+ version format.
+
Whitespace (particularly spaces and oddities such as carriage returns
- ('\r')) are ignored. Other control characters will cause an error to
- be returned.
+ ('\r')) are ignored. Control characters are also handled as whitespace.
+ PrequelD tries to be forgiving.
Responses:
Responses come in two forms: Negative and positive.
have been requested, but not yet hashed. These files
get priority treatment.
- "Error" - An internal error caused PrequelD to fail the request.
- Sorry. Error messages are always logged.
+ "Error" - An internal error caused PrequelD to fail the request,
+ sorry. Error messages are always logged.
A positive response looks more like this:
- "Size " bytecount '\n' raw_bytes
+ "Size: " bytecount '\n' '\n' raw_bytes
That is, the keyword "Size", followed by a space, followed by the number
of bytes (given as a text string) that follow. The response line is
- terminated by a newline ('\n'). The raw_bytes are the requested
- PeerDist Content Information. See [MS-PCCRC] for a definition of the
- format.
+ terminated by a newline ('\n') and the response header is terminated by
+ a blank line. The raw_bytes are the requested PeerDist Content
+ Information. See [MS-PCCRC] for a definition of the format.
ToDo: