nameserver_address_store.cc 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // Permission to use, copy, modify, and/or distribute this software for any
  4. // purpose with or without fee is hereby granted, provided that the above
  5. // copyright notice and this permission notice appear in all copies.
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. // $Id$
  15. #include <boost/shared_ptr.hpp>
  16. #include "config.h"
  17. #include "hash_deleter.h"
  18. #include "nsas_entry_compare.h"
  19. #include "nameserver_entry.h"
  20. #include "nameserver_address_store.h"
  21. #include "zone_entry.h"
  22. using namespace isc::dns;
  23. using namespace std;
  24. using namespace boost;
  25. namespace isc {
  26. namespace nsas {
  27. // Constructor.
  28. //
  29. // The LRU lists are set equal to three times the size of the respective
  30. // hash table, on the assumption that three elements is the longest linear
  31. // search we want to do when looking up names in the hash table.
  32. NameserverAddressStore::NameserverAddressStore(ResolverInterface& resolver,
  33. uint32_t zonehashsize, uint32_t nshashsize) :
  34. zone_hash_(new NsasEntryCompare<ZoneEntry>, zonehashsize),
  35. nameserver_hash_(new NsasEntryCompare<NameserverEntry>, nshashsize),
  36. zone_lru_((3 * zonehashsize), new HashDeleter<ZoneEntry>(zone_hash_)),
  37. nameserver_lru_((3 * nshashsize), new HashDeleter<NameserverEntry>(
  38. nameserver_hash_)),
  39. resolver_(resolver)
  40. {
  41. }
  42. void
  43. NameserverAddressStore::lookup(const std::string& , uint16_t ,
  44. const AbstractRRset& , const vector<AbstractRRset>& ,
  45. shared_ptr<AddressRequestCallback> )
  46. {
  47. // TODO Implement
  48. }
  49. } // namespace nsas
  50. } // namespace isc