********************************

         DConnect Daemon

Documentation for version 0.0.4

********************************

    1. What is it?
    2. Features.
          2.1 Present features.
          2.2 ToDo list.
    3. License.
    4. Installation.
          4.1 Requirements.
          4.2 Instalation.
	  4.3 Config File.
    5. Know bugs.
    6. Direct Connect Protocol.
    7. Authors.



1. What is DConnect Daemon?
===========================

DConnect Daemon is a Direct Connect (from NeoModus Software) Hub clone for Linux. We created him, because we wanted to have stable program for stable system. It working as a system deamon.

You can find newest version of DConnect Deamon on website http://www.dc.ds.pg.gda.pl

2. Features
===========

2.1. Present features
---------------------

	* fast, pure C implementation
	* libwrap support (hosts.allow, hosts.deny)
	* low memory per user consumption
	* uses threads (no forking)
	* nick pattern matching

2.2 ToDo list
-------------

ToDo list is very long now :). We still working.

	* documentation (this what you reading now is only temporary documentation)
	* full protocol implementation:
        	o key checking
        	o passive mode: search/transfer query, search result
        	o op list
        	o 'admin' user with pass
        	o kick (that's it what OP like very much :)
        	o temporal/permanent ban (?)
        	o redirecting
		o hub net: MultiSearch, MultiConnectToMe
	* logging/debug
	* config file parser
	* remote FTP/HTTP client interface (?)
	* statistics output with HTML/SQL or something
	* ports to other systems
	* scripting (perl, tcl, etc.)
	* IPv6 support (?)
	* adding required libwrap detection to configure.in
	* scripts for Debian, RedHat, etc. ...
	* virtual hosts

And more....We waiting onto your sugestions on dc-hub@ds.pg.gda.pl.

3. License
==========

GPL version 2. See COPYRIGHT file shipped with sources for details.


4. Instalation
==============

4.1 Requirements
----------------

To compile DConnect Daemon, you will need:

	* libwrap
	* libpthread
	* automake
	* autoconf
	* libtool
	* gettext (not used now...)

4.2 Installation
----------------

In most cases this procedure should work:

	* $ cd dcd-0.0.3
	* $ ./configure
	* $ make
	* $ make install

You may propably use some traditional configure options. There are no dcd-specific options, so don't worry about it.

4.3 Config file
---------------
Config file is located in /etc/dcd folder. There is located config example after installation. Some options from this file  are ignored yet.

5. Know bugs
============

We know that there are a lot of them...(this file is too short :). If you find any - tell us about it: dc-hub@ds.pg.gda.pl

6. Direct Connect Protocol
==========================

Cracked by Albert.

	* Based on analysis source code of: DCJavaClient 0.20 (J) - 2001 - Stefan Grling - stefan@gorling.se (Java)
	* Opendcd 0.2 (O)- 2001 - suxxx@users.sourceforge.net (Kylix)
	* DCHub 0.0.3 (H) - Eric Prevoteau - www@ac2i.tzo.com (Linux C)

Several errors are here!!! Protocol was sniffed and it's incomplete !!!
-------------------------------------------------------------------------

+----+-------+---------------+----------------------------------------------+
|    |	     |               |					 	    |
| NR |  SRC  |   NAME AND    |                 DESCRIPTION		    |
|    |       |  STRUCTURE    |						    |
+----+-------+---------------+----------------------------------------------+
| 1  |   H   | $BadPass      |Authorization failed (password sended $MyPass |
|    |       |               |instruction is bad).			    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |hub -> client				    |
|    |       |               |Parameters:				    |
+----+-------+---------------+----------------------------------------------+
| 1  | J,O,H |$ConnectToMe   | Not recognized yet			    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |Parameters:				    |
+----+-------+---------------+----------------------------------------------+
| 2  |  J    |$Direction     |Not recognized yet			    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |Parameters:				    |
+----+-------+---------------+----------------------------------------------+
| 3  |  J    |$FileLength    |Information about size of file, which was     |
|    |       |               |asked $Get command (during direct connection  |
|    |       |               |between clients). Thanks this clients which   |
|    |       |               |downloading data, know size of this data.     |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |client -> client				    |
|    |       |               |Parameters:				    |
|    |       |               |fileSize|					    |
+----+-------+---------------+----------------------------------------------+
| 4  |  J,H  |$ForceMove     |Demand of redirecting to other hub. It it was |
|    |       |               |been possible to make balancing of load.      |
|    |       |               |(2 hubs and redirecting in dependence from    |
|    |       |               |size of shared data, hour of day or subnet    |
|    |       |               |from which client conecting)		    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |hub -> client				    |
|    |       |               |Parameters:				    |
|    |       |               |hubName|					    |
+----+-------+---------------+----------------------------------------------+
| 5  | J     |$Get 	     |Request about download, or resume of file     |
|    |       |               |(during direct connection between clients).   |
|    |       |               |Second client should answer command           |
|    |       |               |$FileLength. After that we send command $Send,|
|    |       |               |starting transfer of data.		    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |client -> client				    |
|    |       |               |Parameters:				    |
|    |       |               |fileName$startByte|			    |
+----+-------+---------------+----------------------------------------------+
| 6  |  J,O  |$GetINFO       |Demand of client information. Hub analyses    |
|    |       |               |nick field, and sending command to destination|
|    |       |               |client. Adressee should answer $MyINFO command|
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |client -> hub -> client			    |
|    |       |               |Parameters:				    |
|    |       |               |nick senderNick|				    |
+----+-------+---------------+----------------------------------------------+
| 7  |  J,O  |$GetNickList   |Demand of nicks list of clients of hub. Hub   |
|    |       |               |answers command $NickList and $OpList.	    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |client -> hub				    |
|    |       |               |Parameters:				    |
|    |       |               ||						    |
+----+-------+---------------+----------------------------------------------+
| 1  |  O,H  |$GetPass       |Demand of authorization (check nick           |
|    |       |               |permissions). Client answers command $MyPass  |
|    |       |               |with password.				    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |hub -> client				    |
|    |       |               |Parameters:				    |
|    |       |               ||						    |
+----+-------+---------------+----------------------------------------------+
| 8  |  J,O  |$Hello         |Information to everybody, that new client     |
|    |       |               |connected. Clients should answers command     |
|    |       |               |$MyINFO sending informations about itself to  |
|    |       |               |him(J).					    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |hub -> all				    |
|    |       |               |Parameters:				    |
|    |       |               |nick|					    |
+----+-------+---------------+----------------------------------------------+
| 21 |  H    |$HubIsFull     |Sending to client when hub is full and        |
|    |       |               |redirect is impossible.			    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |hub -> client				    |
|    |       |               |Parameters:				    |
|    |       |               ||						    |
+----+-------+---------------+----------------------------------------------+
| 9  |  J,H  |$HubName       |Sending to just connected client of hub.	    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |hub -> klient				    |
|    |       |               |Parameters:				    |
|    |       |               |hubName|					    |
+----+-------+---------------+----------------------------------------------+
| 10 | J,O,H |$Key           |0Answer of client on $Lock command (demand of |
|    |       |               |authorization). Key key is enumerated basis of|
|    |       |               |client alghoritm and field salt. Field salt is|
|    |       |               |sending on command $Lock.			    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |client -> hub; client <-> client              |
|    |       |               |Parameters:				    |
|    |       |               |key|			 		    |
+----+-------+---------------+----------------------------------------------+
| 1  |  O,H  |$Kick 	     |Kick from hub. Only admin can do that.	    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |client -> hub				    |
|    |       |               |Parameters:				    |
|    |       |               |nick|					    |
+----+-------+---------------+----------------------------------------------+
| 11 | J,O,H |$Lock 	     |Demand of authorization. This is protection   |
|    |       |               |from unauthorized connection to hub. Algorithm|
|    |       |               | of enumerating of key is fortunately already |
|    |       |               |broken :)) In answer client sent to hub 	    |
|    |       |               |command $Key with key, enumerated basis of    |
|    |       |               |field salt. Authorization is realized also    |
|    |       |               |during direct connection between clients      |
|    |       |               |(session download) into both side. Length of  |
|    |       |               |salt field is changing (less than 3 bytes - in|
|    |       |               |(H) length is drawing from range 50-100, and  |
|    |       |               |chars from range '%' - 'z'), however 	    |
|    |       |               |privateKey is not used in any analysed sources|
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |hub -> client; client <-> client		    |
|    |       |               |Parameters:				    |
|    |       |               |salt Pk=privateKey|			    |
+----+-------+---------------+----------------------------------------------+
| 1  |  O,H  |$LoggedIn      |Authorization succcess. Password sending after|
|    |       |               |command $MyPass is correct. User is logged on |
|    |       |               |hub.					    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |hub -> client				    |
|    |       |               |Parameters:				    |
|    |       |               ||						    |
+----+-------+---------------+----------------------------------------------+
| 12 |  J    |$MaxedOut      |Not recognized yet.			    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |Parameters:				    |
+----+-------+---------------+----------------------------------------------+
| 1  |  O    |$MultiSearch   |Not recognized yet.			    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |Parameters:				    |
+----+-------+---------------+----------------------------------------------+
| 13 |  J,O  |$MyINFO        |Information about itself. Hub records all     |
|    |       |               |parameters and sends this command to rest of  |
|    |       |               |clients. (added $ALL before - this means that |
|    |       |               |exist version of $MyINFO for one client only. |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |client -> hub; hub -> all			    |
|    |       |               |						    |
|    |       |               |Parameters:				    |
|    |       |               |nick description$ 			    | 
|    |       |               |$connectionTypeF$email$sharedBytes$|          |
|    |       |               |(klient -> hub)				    |
|    |       |               |						    |
|    |       |               |$ALL nick description$                        |    
|    |       |               |$connectionTypeF$email$sharedBytes$|          |
|    |       |               |(hub -> all)				    |
|    |       |               |						    |
|    |       |               |# description - any desription		    |
|    |       |               |# connectionType - 56Kbps/33.6Kbps/28.8Kbps   |
|    |       |               |      Satellite/ISDN/DSL/Cable/LAN(T1)/LAN(T3)|
|    |       |               |# F - one-byte flag (default \x01) - when     |
|    |       |               |bit 1 is 0 - client is behind firewall (\x00).|
|    |       |               |# email - address (usual empty)		    |
|    |       |               |# sharedBytes - size of share		    |
+----+-------+---------------+----------------------------------------------+
| 14 |  J    |$MyNick        |Information about nick. This is first command,|
|    |       |               |sended during direct connection between       |
|    |       |               |clients (download session).		    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |client -> client				    |
|    |       |               |Parameters:				    |
|    |       |               |nick|					    |
+----+-------+---------------+----------------------------------------------+
| 13 |  O,H  |$MyPass        |Answer on $GetPass command. That is nicks     |
|    |       |               |rights confirmation. If password is correct,  |
|    |       |               |hub sending command $Hello to all, with       |
|    |       |               |information about new user. If this user is OP|
|    |       |               |hub sending commands $LoggedIn and $Hello to  |
|    |       |               |all. If password is incorrect, client is 	    |
|    |       |               |disconnecting (O) or command $BadPass (H) is  |
|    |       |               |sending.					    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |client -> hub				    |
|    |       |               |Parameters:				    |
|    |       |               |password|					    |
+----+-------+---------------+----------------------------------------------+
| 15 |  J,O  |$NickList      |List all of nicks logged on hub (admin and    |
|    |       |               |user are not distinguished). This is answer of|
|    |       |               |server onto command $GetNickList. Turned list |
|    |       |               |is separated '$$'. User with admin rights,    |
|    |       |               |sees additionally user HubSecurity (first on  |
|    |       |               |turned list).				    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |hub -> client				    |
|    |       |               |Parameters:				    |
|    |       |               |nick1$$nick2$$nick3|			    |
+----+-------+---------------+----------------------------------------------+
| 4  |  O    |$OpForceMove   |Demand of redirecting user with admin's rights|
|    |       |               |to other hub.				    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |hub -> client				    |
|    |       |               |Parameters:				    |
|    |       |               |hubName|					    |
+----+-------+---------------+----------------------------------------------+
| 16 |  J,O  |$OpList 	     |List of admins logged on hub. This is hub's   |
|    |       |               |answer on command$GetNickList. 		    |
|    |       |               |Turned nicks list is separated '$$'. User with|
|    |       |               |admin rights, sees additionally user          |
|    |       |               |HubSecurity (first on turned list).	    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |hub -> client				    |
|    |       |               |Parameters:				    |
|    |       |               |nick1$$nick2$$nick3|			    |
+----+-------+---------------+----------------------------------------------+
| 17 |  J    |$Quit 	     |Correct end of connection. Hub removes sender |
|    |       |               |from nicks list, then sends command $Quit to  |
|    |       |               |remaining users. (They can remove sender from |
|    |       |               |own nicks list).				    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |client -> hub -> all			    |
|    |       |               |Parameters:				    |
|    |       |               |nick|					    |
+----+-------+---------------+----------------------------------------------+
| 18 | J,O,H |$RevConnectToMe|Not recognized yet			    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |Parameters:				    |
+----+-------+---------------+----------------------------------------------+
| 19 | J,O,H |$Search        |File searching. Hub may pass this command     |
|    |       |               |between itself.				    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |client -> hub -> [hub] -> all		    |
|    |       |               |Parameters:				    |
|    |       |               |Hub:senderNick ifSize?ifLess?size?dataType?pattern|
|    |       |               |						    |
|    |       |               |# ifSize - F when file size is unimportant,   |
|    |       |               |	in opposite time T			    |
|    |       |               |# ifLess - F when we looking for files with   |
|    |       |               |	size grather than size, T - when less	    |
|    |       |               |# size - size in bytes			    |
|    |       |               |# dataType - 1=any, 2=audio, 3=compressed,    |
|    |       |               |	4=document, 5=exe, 6=picture, 7=videos,     |
|    |       |               |	8=folder				    |
+----+-------+---------------+----------------------------------------------+
| 20 |  J    |$Send          |Starting stream of data during download       |
|    |       |               |session (between clients). Sent previously    |
|    |       |               |command $Get and $FileLength define which file|
|    |       |               |is sent, from which of byte and what portion  |
|    |       |               |of data is transmited.                        |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |client -> client				    |
|    |       |               |Parameters:				    |
|    |       |               ||						    |
+----+-------+---------------+----------------------------------------------+
| 21 | J,O,H |$SR 	     |Not recognized yet.			    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |Parameters:				    |
+----+-------+---------------+----------------------------------------------+
| 22 |  J,H  |$To	     |Sending private message (on DC chat).	    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |client -> hub -> client			    |
|    |       |               |Parameters:				    |
|    |       |               |nick To: senderNick$<senderNick>message|      |
+----+-------+---------------+----------------------------------------------+
| 23 |  J,H  |$ValidateNick  |Validation of nick. This command is sent to   |
|    |       |               |hub soon after $Key command (on start of      |
|    |       |               |connection). Hub checks whether nick is not   |
|    |       |               |already used or banned. Chars ' ' and '$' are |
|    |       |               |incorrect in nick. If nick is password        |
|    |       |               |protected, hub sends command $GetPass to      |
|    |       |               |confirm rights to using nick. Hub sends $Hello|
|    |       |               |information to everybody, that new client     |
|    |       |               |connected. (O).				    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |client -> hub				    |
|    |       |               |Parameters:				    |
|    |       |               |nick|					    |
+----+-------+---------------+----------------------------------------------+
| 24 |  J,H  |$Version       |Information about client version. Currently is|
|    |       |               |not used.					    |
|    |       |               |						    |
|    |       |               |Direction:				    |
|    |       |               |client -> hub				    |
|    |       |               |Parameters:				    |
|    |       |               |clientVersion|				    |
+----+-------+---------------+----------------------------------------------+

7. Authors

And here We in alphabetical order:

	* Robert `Albert' Zoralski robertzor@pletwa.pl
		o protocol cracking
	* Pawel `blues' Golaszewski blues@ds.pg.gda.pl
		o ac/am support
		o cvs support
		o packaging
	* Michal `Fela' Felski fela@ds.pg.gda.pl
		o web site design
	* Sebastian `rawsock' Rosenkiewicz rawsock@ds.pg.gda.pl
		o network programming
		o protocol implementation
	* Artur P. `ventox' Wojcik ventox@wp.pl
		o framework
		o configuration
