Protocols » History » Version 19
  Greg Burri, 04/19/2012 10:42 PM 
  
| 1 | 1 | Greg Burri | h1. Protocols | 
|---|---|---|---|
| 2 | |||
| 3 | 4 | Greg Burri | * [[Protocol core-core]] | 
| 4 | * [[Protocol core-GUI]] | ||
| 5 | |||
| 6 | 18 | Greg Burri | There is two main protocols, one between cores and one between GUI and core. Both are using "protocol buffers":http://code.google.com/p/protobuf/ for describing the exchanged messages. | 
| 7 | 1 | Greg Burri | |
| 8 | 5 | Greg Burri | Each data sent over the network (using TCP or UDP) are formatted like this : | 
| 9 | 3 | Greg Burri | |
| 10 | <pre> | ||
| 11 | 14 | Greg Burri | <messageType:uint32><size:uint32><senderId:20*uint8><serializedMessage> | 
| 12 | 3 | Greg Burri | </pre> | 
| 13 | |||
| 14 | Where : | ||
| 15 | * _messageType_ is a number which determine the message type, more information in the proto files. | ||
| 16 | 19 | Greg Burri | * _size_ is the size of the following serialized message. It may be zero for an empty message. | 
| 17 | 12 | Greg Burri | * _senderId_ is the sender id. | 
| 18 | 1 | Greg Burri | * _serializedMessage_ is the data serialized by protocol buffer. | 
| 19 | 12 | Greg Burri | |
| 20 | 15 | Greg Burri | The first three items is the header and is exactly 28 bytes long. | 
| 21 | 12 | Greg Burri | |
| 22 | 6 | Greg Burri | |
| 23 | |||
| 24 | 9 | Greg Burri | h2. Links to resource (DRAFT) | 
| 25 | 6 | Greg Burri | |
| 26 | 17 | Greg Burri | h3. Proposal 1 | 
| 27 | |||
| 28 | 10 | Greg Burri | Links can be shared across peers. It locates a remote resource like folder or file from a specific peer. It can contain chunk hashes, thus the source peer doesn't need to be online to download a file or a folder. | 
| 29 | 6 | Greg Burri | |
| 30 | 16 | Greg Burri | _dl://[<peer name>][:<file id>][:<shared id>/<folder>/<file>]_ | 
| 31 | 6 | Greg Burri | |
| 32 | 7 | Greg Burri | * <peer name> : Not required and not used to locate the resource, just an information for the user. | 
| 33 | * <file id> : its the n first group of nibble of the m first chunk where _n * m = 40 nibbles_ (20 octets). | ||
| 34 | ** 20,87cace382f7371cd3fab3cb0a53b93b7cd9719f6 : 20 chunks of 2 nibbles. | ||
| 35 | ** 8,05649bcbf065e0d032ada540d4a749d98db055cf : 8 chunks of 5 nibbles. | ||
| 36 | * <shared id> : Contains only the beginning of the hash. | ||
| 37 | 6 | Greg Burri | |
| 38 | 1 | Greg Burri | |
| 39 | 17 | Greg Burri | h4. Examples | 
| 40 | 6 | Greg Burri | |
| 41 | 1 | Greg Burri | * _dl://20,87cace382f7371cd3fab3cb0a53b93b7cd9719f6_ | 
| 42 | * _dl://pierre:20,87cace382f7371cd3fab3cb0a53b93b7cd9719f6_ | ||
| 43 | * _dl://pierre:20,87cace382f7371cd3fab3cb0a53b93b7cd9719f6:dac4f75c/my%20movies/LOLCat.avi_ | ||
| 44 | * _dl://pierre:dac4f75c/my%20movies/LOLCat.avi_ | ||
| 45 | * _dl://pierre:dac4f75c/my%20movies_ | ||
| 46 | 17 | Greg Burri | |
| 47 | |||
| 48 | h3. Proposal 2 | ||
| 49 | |||
| 50 | This version is much simpler, it doesn't identify the file and contains only the path to the ressource. | ||
| 51 | |||
| 52 | _dl://<peer name>(<peer ID>)<path>_ | ||
| 53 | |||
| 54 | _<path>_ always starts with a slash. It can be a folder or a file. | ||
| 55 | |||
| 56 | h3. Examples | ||
| 57 | |||
| 58 | _dl://pierre(d51f479)/my%20movies/LOLCat.avi_ |