KadC - P2P library






Welcome to KadC, a C library for publishing and retrieving records in Kademlia-based Distributed Hash Tables. Possible uses include publishing a client's IP address for other peers to connect to (e.g., Internet phones, serverless IM programs); replacements for DNS; search engine for BitTorrent clients; replacements for LDAP directories; etc. For other ideas, see my postings archived here and here .


19 October 2006: Fixes and new features:

  • Updated kadc.ini with valid contact nodes
  • API for writing an updated inifile
  • Inifile kept closed when not needed
  • Bug fix: inifile not written successfully on exit

02 August 2006: improve the operation. Recommended if you use KadC:

  • Fixed overnet search to seed from only alive nodes instead of all
  • Rearranged connecting code to be faster by utilizing all threads more efficiently
  • New interface KadC_find2 that can be used to obtain the hits immediately with callback syntax
  • Searching code rearranged to be one-pass so that hits can be returned faster for the callback syntax
  • A modified example application of KadCmain.c called KadCcbmain.c that shows how the callback syntax can be used.
  • The bootstrap code and logic modified to prefer many threads initially for connecting and less aggressive node searching afterwards
  • Added mgwz.dll to ease deployment on Windows
  • Some minor changes in Makefile and utility functions, rearranged external libs to its own directory (pthreads-win32 files to external_libs/win32)
  • The old code in regards to connecting/searching can be enabled with compile switches OLD_KBOOT and OLD_SEARCH_ONLY for the time being. Likely to remove the old code in next release unless problems found

11 November 2004: Fixed bug in KadCrouting.c that resulted in progressively less accurate searches as time passed, and added to overnet.c a workaround to accomodate malformed OVERNET_SEARCH_NEXT packets sent by some broken client. Added API calls to blacklist, for a given number of seconds, peer nodes (identified by their IPaddress:UDPport) found to misbehave due to either malice or simple brokenness. The blacklisting information for nodes still blacklisted is saved to the ini file, and reloaded on startup. Also: extensive code cleanups; added to the API KadCdictionary_gethash() to extract the hash from a KadCdictionary returned by KadC_find() (now printed by the KadC application for each hit). Version bumped to 0.1.0.

16 October 2004: Greatly increased speed for
KadC_republish(), thanks to the parallelization over multiple threads in overnet_republishnow(); and minor changes to the external IP detection logic (to make it more robust) in overnet_kboot().
Also: namecache now uses leaf mode as default (-l option no longer necessary), and its -d option acquires the ability of publishing A records for explicitly-stated IP addresses (e.g.
"-d www.xyz.p2p=") in addition to, implicitly, the external IP address of the node or its NAT router
("-d www.xyz.p2p").

11 October 2004: Added to the tarball a copy of the compiled "Pthreads for Win32" files used to build the WIN32 executables (which rely upon pthreadGC.dll). See the pthreads-win32\README.txt file for the installation details. Basically, if you just want to run the distributed executables, you'll have to copy pthreads-win32\pthreadGC.dll to some directory in the path; and if you want to rebuild them, you'll have to place pthreads-win32\libpthreadGC.a into \cygwin\lib\mingw , and pthreads-win32\pthread.h into \cygwin\usr\include\mingw .

10 October 2004: Added to the main programs KadC and namecache proper pthread_sigmask()-based POSIX signal handling for the platforms where it's supported (this is automatically detected by tinyconfig and results in the macro OLD_STYLE_SIGNAL being undefined or defined in ./config.h). This change makes signal handling work with GNU Pth. Patchlevel bumped to 0.0.2.

7 October 2004: Initial release. The version is 0.0.1. Known issues: At least on RH 7.0, the application namecache built with GNU Pth 2.0.1 rather than a real POSIX Threads package segfaults if it receives a signal (i.e., signal handling through signal(2) doesn't appear to work).

© 2004 by Enzo Michelangeli