addressdb revision 499b34cea04a46823d003d4c0520c8b03e8513cb
998d56ea74f8cc733b423da076dadb0fd0a789f3wroweCopyright (C) 2000, 2001 Internet Software Consortium.
998d56ea74f8cc733b423da076dadb0fd0a789f3wroweSee COPYRIGHT in the source root or http://isc.org/copyright.html for terms.
2ad080048d86cc499a05750422d99a4b54da9e6dwrowe$Id: addressdb,v 1.5 2001/01/09 21:46:38 bwelling Exp $
998d56ea74f8cc733b423da076dadb0fd0a789f3wroweYou are lost in a maze of twisty little pointers, all alike...
a601d863bd772fefc4dc82a883589d8be6a44811wroweADB |-> 0 |-> handle ---> handle ---> 0
a601d863bd772fefc4dc82a883589d8be6a44811wrowe |-lists of names --------> name -------> name -------> 0
6f51bbc3054846e0c0a897d5f16ceba1726bebc6jerenkrantz | namehook namehook
6f51bbc3054846e0c0a897d5f16ceba1726bebc6jerenkrantz | | 0 0 -> fetch
6f51bbc3054846e0c0a897d5f16ceba1726bebc6jerenkrantz |-lists of elements -----> element ----> element ----> element ---> 0
ff920f8ae37ba372801b67ea7c3d5bf1dfb55585dreid | |-> zoneinfo |-> 0 |-> zoneinfo
ff920f8ae37ba372801b67ea7c3d5bf1dfb55585dreid |-lists of dead handles
998a0c99bc22357406f359ace2f602c5d6e376c6wroweA handle contains a task, taskaction, and event argument, and is linkable
998a0c99bc22357406f359ace2f602c5d6e376c6wrowein two ways. One, for the list returned to the caller, and two to be
998a0c99bc22357406f359ace2f602c5d6e376c6wroweattached to either a name (so events can be generated) or to the dead handle
998a0c99bc22357406f359ace2f602c5d6e376c6wrowelist, where no events are generated.
998a0c99bc22357406f359ace2f602c5d6e376c6wrowe |--- addrinfo ---> addrinfo ---> 0
998d56ea74f8cc733b423da076dadb0fd0a789f3wrowe | |-> entry |-> entry
998d56ea74f8cc733b423da076dadb0fd0a789f3wrowe |--- task, action, arg
a601d863bd772fefc4dc82a883589d8be6a44811wroweNotes and questions:
fc9e01023a2fb7f7af9b25621ab080bbe7a95611jerenkrantz o If a handle is on the dead handle list, it is only waiting for
a601d863bd772fefc4dc82a883589d8be6a44811wrowe the caller to dns_adb_done() it.
998a0c99bc22357406f359ace2f602c5d6e376c6wrowe o If a handle is on a name list, it will generate at most one
998a0c99bc22357406f359ace2f602c5d6e376c6wrowe event, and then be moved to the dead handle list.
998a0c99bc22357406f359ace2f602c5d6e376c6wrowe o If events are not requested, it is NEVER placed on the name's
998a0c99bc22357406f359ace2f602c5d6e376c6wrowe list, even though fetches for that name may be started.
998a0c99bc22357406f359ace2f602c5d6e376c6wrowe o Names will have to have a reference count for each fetch
998a0c99bc22357406f359ace2f602c5d6e376c6wrowe in progress. They will also have a bit that says some
998a0c99bc22357406f359ace2f602c5d6e376c6wrowe previous fetches failed. XXX How in the world would I
998a0c99bc22357406f359ace2f602c5d6e376c6wrowe "refresh" the data? If I only got 2 of 9 A6 chains to converge,
998a0c99bc22357406f359ace2f602c5d6e376c6wrowe when and how do I restart them later?
ac901b38303d566fa40041abc9f3f9253afd6bd4brianp o The caller will give us a name, and we will return two items:
ac901b38303d566fa40041abc9f3f9253afd6bd4brianp a handle and a list of addresses. If the list was non-empty when
ac901b38303d566fa40041abc9f3f9253afd6bd4brianp it was given to us, we will append (unique) addrinfo's to the list.
ac901b38303d566fa40041abc9f3f9253afd6bd4brianp o How in the world do you shut this thing down?
ac901b38303d566fa40041abc9f3f9253afd6bd4brianp If you cancel the fetches first:
ac901b38303d566fa40041abc9f3f9253afd6bd4brianp 1. The handles are sent an event saying "no more
ac901b38303d566fa40041abc9f3f9253afd6bd4brianp names are coming."
ac901b38303d566fa40041abc9f3f9253afd6bd4brianp 2. The handles are moved to the dead handle list.
27ddebab333df2a3d82b0f4ea63878d1d9f38ae8gstein If you cancel the handles first:
27ddebab333df2a3d82b0f4ea63878d1d9f38ae8gstein 1. The handles are moved to the dead handle list.
27ddebab333df2a3d82b0f4ea63878d1d9f38ae8gstein It would therefore seem simpler to cancel/done all handles first,
27ddebab333df2a3d82b0f4ea63878d1d9f38ae8gstein then all fetches.
27ddebab333df2a3d82b0f4ea63878d1d9f38ae8gstein o If a fetch returns a CNAME, what do we do?
27ddebab333df2a3d82b0f4ea63878d1d9f38ae8gstein o If a fetch returns a DNAME, what do we do?
27ddebab333df2a3d82b0f4ea63878d1d9f38ae8gstein o If a fetch returns 4 ipv4 addresses, we will have to allocate
27ddebab333df2a3d82b0f4ea63878d1d9f38ae8gstein 3 more (total of 4) namehooks, 4 entries, and fill them in.
27ddebab333df2a3d82b0f4ea63878d1d9f38ae8gstein What happens if only some of these can be allocated?
27ddebab333df2a3d82b0f4ea63878d1d9f38ae8gstein o ipv6 raises the memory problem to a new level. What if we
cdc56e100a8fa11e989d1633914502db1c8e0818wrowe have to fork into multiple chains, but we run out of memory?
cdc56e100a8fa11e989d1633914502db1c8e0818wrowe----------------------------------------------------------------------
39d8628e74736d0bd8c4114d8e615dffa8fbbcf7gsteinLooking up entries via names:
39d8628e74736d0bd8c4114d8e615dffa8fbbcf7gstein Look for the name in the database.
39d8628e74736d0bd8c4114d8e615dffa8fbbcf7gstein For each complete address, allocate an addrinfo structure
39d8628e74736d0bd8c4114d8e615dffa8fbbcf7gstein and add it to the handle.
39d8628e74736d0bd8c4114d8e615dffa8fbbcf7gstein If any fetches are in progress for this name, attach this
39d8628e74736d0bd8c4114d8e615dffa8fbbcf7gstein handle to this name so events can be posted to the handle,
39d8628e74736d0bd8c4114d8e615dffa8fbbcf7gstein if the handle wants events.
39d8628e74736d0bd8c4114d8e615dffa8fbbcf7gstein If no fetches are in progress and the name is incomplete,
39d8628e74736d0bd8c4114d8e615dffa8fbbcf7gstein see if we can start a fetch for this name.
39d8628e74736d0bd8c4114d8e615dffa8fbbcf7gstein Create a new adbname structure.
39d8628e74736d0bd8c4114d8e615dffa8fbbcf7gstein Create a new namehook structure.
bb16031776199a40aa54b2a6540835f7f8db0ce8jerenkrantz Start a fetch on this name.
bb16031776199a40aa54b2a6540835f7f8db0ce8jerenkrantz If more data is coming (fetches are in progress) attach
bb16031776199a40aa54b2a6540835f7f8db0ce8jerenkrantz the handle to the name, so it can get notification of
bb16031776199a40aa54b2a6540835f7f8db0ce8jerenkrantz If the name is incomplete (due to fetches in progress,
bb16031776199a40aa54b2a6540835f7f8db0ce8jerenkrantz recently failed fetches, or the inability to start new
27ddebab333df2a3d82b0f4ea63878d1d9f38ae8gstein fetches) copy the incomplete flag to the handle, so the
cdc56e100a8fa11e989d1633914502db1c8e0818wrowe caller can know this.