Commit graph

20034 commits

Author SHA1 Message Date
Lubos Slovak
f02c549cd5 A lot of bugfixes + some debug output added. 2010-03-25 20:05:10 +01:00
Lubos Slovak
7fb6b5da93 Module Server implemented + Name Server finished.
Server structure (cute_server; should be renamed) created,
  together with basic functions: create(), destroy(), start().
Added create() and destroy() functions for Name Server module.
2010-03-25 18:40:35 +01:00
Lubos Slovak
d3ee458a36 Added module Zone Parser + minor changes.
Module Zone Parser:
  One API function + test implementation of zone parsing (uses
  the test file format).
Minor changes to dns-simple library API (would need further
  changes).
2010-03-25 16:39:20 +01:00
Lubos Slovak
359e99154d Tests moved to separate directory.
Proper change of the Makefile + some fixes of it.
2010-03-25 13:51:13 +01:00
Lubos Slovak
cc6e99040a Added module Name Server.
Name Server is used for answering queries relayed by the Socket
  Manager (Network) module.
The ns_nameserver structure is rather simple now, but will be
  expanded in the future.
Changed some API parameters to const. Should consider the const-
  -ness of parameters more thoroughly.
2010-03-25 12:00:02 +01:00
Lubos Slovak
0fc1f5b3f9 Zone node implementation.
Lightweight module holding only an array of pointers to RRs and
  with basic operations: create, destroy, add, find and
  destructor for using in the overlying data structure.
2010-03-24 22:06:31 +01:00
Lubos Slovak
2102422abb Zone database implementation + minor changes.
Implemented functions
  zdb_create()
  zdb_create_zone()
  zdb_find_zone()
  zdb_remove_zone()
  zdb_insert_name()
  zdb_find_name()
  zdb_destroy()
Removed the useless zds_node structure.
Added some other functions for working with dnss_dname_wire:
  copy, compare, destroy.
2010-03-24 21:40:37 +01:00
Lubos Slovak
6766c53fba Added modules Zone database & Zone data structure.
Zone database - Now dummy module, no functions implemented yet.
  Later will group all zone data structures, and provide high-
  level API for the other server modules.

Zone data structure - Only wrapper around hash table functions.
  Should provide transparent API for Zone database, disregarding
  the underlying data structure.

Zone node - data structure to hold all information associated with
  a domain name.
  Consider renaming this structure later.
  Used in Zone data structure and through its zds_node structure
  in the rest of the server modules.
  The use of zds_node structure needs revision, maybe useless.

New (now dummy) types for domain name (dnss_dname) and wire format
  of the domain name (dnss_dname_wire). Both typedef'ed to char *.
Convenience methods to get string from dname and to get length of
  a dname. Will be changed later, when the types change.

Minor changes (comment style changed).
2010-03-24 20:30:43 +01:00
Lubos Slovak
c4c1b93040 Dispatcher integrated with the present program.
Removed sm_start() and thread information from socket-manager.
sm_listen() made public, passed to dispatcher in start_server().
Fixes in dispatcher.
2010-03-24 17:12:44 +01:00
Lubos Slovak
b4a4696cdc Changes in common.[ch], added Dispatcher.
Print routines moved to from common.[ch] to print.[ch].
Added module Dispatcher - just a draft, no tests done yet.
2010-03-24 16:19:57 +01:00
Lubos Slovak
b00487309d Folder structure fixed. 2010-03-24 14:54:37 +01:00
Lubos Slovak
eba9bb58fb Branch for main development + reorganized files.
An actual (working) development version should be always in this
  branch.
For subtasks, new branches will be created. For now all the old
  files are here, although this is actually a subtask. Later,
  we will remove all the old code from this branch and move it to
  some other branch.
The master branch should be used for working or stable versions.

Added .gitignore file.
Created basic directory structure for the project and changed
  Makefile accordingly.
Added QtCreator project files (CuteDNS.*).
2010-03-24 14:43:56 +01:00
Lubos Slovak
5fd4ebc153 Hashing loop check fixed. Rehashing working.
ck_check_used2() renamed to ck_check_used() as the previous
  function of this name was of no use.
Added ck_check_used_twice() which checks if some position was used
  twice druing a rehash - only after using a position twice can we
  assume that an infinite loop occured
  (can we or is it only a heuristic?)
Rehashing probably working in a basic setup and with no locks.
  (Need to add: item locks, using both hashing functions in
     lookup function, switching the generation after half the table
     is rehashed, etc.)
2010-03-22 14:29:05 +01:00
Lubos Slovak
28adf6f20d Removed item rwlocks implementation.
This was not a feasible way to lock the items
  - there was no way to atomically acquire the lock and save
    the information to the structure.
Consider using some totally diffrent technique - copy-on-write,
  RCU, etc.
2010-03-22 10:52:10 +01:00
Lubos Slovak
a1e0eef359 Item rwlocks bugfixes and changes.
Bugfix: assumed the first free place is after all locks.
Now using counter to keep tracks of threads waiting for lock.
STILL NOT FUNCTIONAL! (not tested, but the idea is wrong)
2010-03-19 09:41:06 +01:00
Lubos Slovak
b29b888b45 Minor changes and bugfixes.
Bugfixes in ck_hash_item().
Completed ck_rehash() (rehashing of items from 2nd table).
No locks are used for rehashing yet.
Bug not fixed: detection of infinite loop in hashing is not correct.
2010-03-19 09:10:38 +01:00
Lubos Slovak
b1d5613073 Item rwlocks standalone implementation.
Added structure irwl_table which holds table of locks (type
  irwl_lock) of arbitrary items identified by a pointer.
Implemented read locking, write locking, unlocking, creation
  and destruction of the structure.
Implementation uses mutex associated with the table to prevent
  race conditions while locking/unlocking.
2010-03-16 12:59:37 +01:00
Lubos Slovak
32321fb29d Code refactoring.
Function main() moved to new file main.c.
Bitset test moved to new files test.[ch].
Tests related to cuckoo table remain in cuckoo-test.[ch].
Removed rwlocks from ck_hash_table (will be replaced by standalone
  item lock implementation).
2010-03-16 12:56:16 +01:00
Lubos Slovak
a448fb8eef First draft of rehashing function.
Added rehashing function + general hashing function for item which
  may later be used in the ck_insert_item() function.
No locks used yet.
2010-03-12 22:11:32 +01:00
Lubos Slovak
76ee386735 Synchronisation in cuckoo-hash-table.
Added general table mutex, locking when inserting, rehashing and
  destroying.
Added rwlocks for 2 items. Will be used in rehashing.
2010-03-12 19:42:46 +01:00
Lubos Slovak
2358741b35 Bugfixes.
Buffer was not used (wrong check).
Item which caused error in insertion (infinite loop while buffer
  full) was being deleted in the test function even though it
  may have been inserted into the table. (This was causing the
  invalid pointer error.)
Simplified ck_insert_item().
2010-03-09 11:10:51 +01:00
Lubos Slovak
bc0b9fe962 Some refactoring & debugging stuff (still 1 bug).
A lot of macros in cuckoo-hash-table.c replaced by constants and
  static inline functions.
Some debug output added.
dns-simple: RDATA is now allocated separately, not together with
  RR.
There is some bug, probably in hash table insertion, resulting
  in "Invalid pointer" error when destroying certain item in hash
  table.
2010-03-08 17:33:20 +01:00
Lubos Slovak
1785a05328 Memory issues fixed + minor changes the hash table
Added "generation" to hash table items and proper methods, hash counting, etc.
Added checks for NULL pointers when deleting items from table.
Fixed dnss_destroy_rr() (deleting RDATA twice).
Minor changes and fixes.
Universal system's functions moved to .c file.
2010-03-08 15:54:02 +01:00
Lubos Slovak
cefa14584d Bugfix in file parsing. 2010-03-05 21:39:53 +01:00
Lubos Slovak
256390eb96 Added test file with all CZ zones and A types. 2010-03-05 21:36:03 +01:00
Lubos Slovak
5f8abd67f7 Memory leaks and problems fixed. API modifications
All items are now properly created, copied and destroyed.
  (too much copying - should avoid in later development)

Modified API of dns-simple 'library':
  Added destructors which take ** to the object
    and are setting the pointer to NULL.
  dnss_dname_to_wire() now takes the position and allocated size as parameters.
  dnss_create_response(), dnss_create_error_response() and dnss_wire_format()
    now all return errors as appropriate.

Fixed copying issues in dns-simple 'library':
  Questions and RRs are now copied entirely, not just pointers.
    (See functions dnss_copy_questions() and dnss_copy_rrs().)
  Added some checks for NULL-pointers when deallocating.

Added pointer to hash table item destructor function to the hash table.

ck_destroy_table() rewritten to destroy individual items in the table and buffer.

A lot of checks added (mostly for result of malloc).

Redundant and old code removed.
2010-03-05 20:28:11 +01:00
Lubos Slovak
78db51c3c7 Bugfixes & minor changes. Now replying to queries.
Bugfix in default A RR value (was string, should be 4 integers).
Ignoring query if response too long.
Removed some redundant code.
Added some debug output.
2010-03-03 23:13:41 +01:00
Lubos Slovak
331af39fe0 Modified to use wire-format domain names to hash.
Modified functions hash_from_file() and test_lookup_from_file().
Some additional checks for successful memory allocation added.
2010-03-03 21:32:49 +01:00
Lubos Slovak
dbecb9096b Changes to make the program answer queries.
Added use of the socket manager to listen for queries.
Added function answer_request() to be called from worker threads.
2010-03-03 21:05:05 +01:00
Lubos Slovak
e99e6d47a8 A lot of fixes.
Replaced some macros by (static) const variables.
Added answer_request() function to be called.
Corrected dnss_create_response().
Added dnss_create_error_response().
dnss_wire_format() fixed.
dnss_parse_query() fixed.
socket manager fixed.
2010-03-03 20:22:44 +01:00
Lubos Slovak
4c08996d7f Added epoll-based socket manager (not tested). 2010-03-02 11:49:31 +01:00
Lubos Slovak
86a470cdd1 Test now inserts RR into the hash table.
Creating default A RRs with dummy address (loopback), this has no implications
  on performance testing.
Fixed some bugs in dns-simple.
Added header common.h to contain common typedefs, constants and macros.
More consistent debug messages (better #ifdefs)
2010-03-01 23:21:08 +01:00
Lubos Slovak
9540d1d86c Completed DNS functions & fixes to comply with C99
Removed read_domain_names() and test_lookup() functions.
Added dnss_wire_format(), dnss_dname_to_wire() and dnss_parse_query().
Many functions in universal-system.h and bitset.h not inline any more
  (should check it later and find a way to make them inline).
2010-03-01 21:36:22 +01:00
Lubos Slovak
2da03d5da4 First commit - server with cuckoo hash prototype
Classic (2-ary) cuckoo hash table with char* keys.
  (Insert, find, delete implemented.)
Simple bitset (not used right now).
Several hash functions downloaded from web.
Universal system of hash functions (according to J. Katajainen & M. Lykke
  of University of Copenhagen).
Several basic data structures for DNS data - not finished yet.
2010-02-28 15:44:38 +01:00