===================
data_structures.txt
===================

Data Structures
---------------

Name              Description
-------------------------------------------------------------
addit_addr_list:  list of ruli_rr_addr_t 
                  additional A RR list 

res_addr_list:    list of ruli_rr_addr_t 
                  resolver A RR list 
                  (for A RRs not found in additional section) 

srv_list:         list of ruli_rr_srv_t
                  store SRV RRs 

target_list:      list of ruli_rr_srv_t 
                  SRV RR list sorted by priority/weight 

target_addr_list: list of ruli_srv_target_t
                  target addr list issued to user 


Description
-----------

1) Once invoked, the ruli library queries the resolver for:

   qname  = _service._protocol.domain
   qclass = in
   qtype  = srv

   The SRV RRs received are stored accordingly priority/weight in
   srv_list.

** If SRV RRs are not available, the library falls back to the
   following query:

   qname  = domain
   qclass = in
   qtype  = a

   These IN A records are stored in res_addr_list. Records from this
   list are referred from target_addr_list.

2) RRs from additional section are stored in addit_addr_list.

3) The SRV RRs previously stored in srv_list at query time are
   randomly sorted accordingly RFC2783 algorithm for weight
   selection. In this sorting process, the RRs are moved from srv_list
   to target_list.

4) The addresses of targets from target_list are obtained (in
   addit_addr_list or res_addr_list) and referred from
   target_addr_list.

   To obtain such addresses, the library first consults the additional
   RRs stored in addit_addr_list. If they're not available, queries
   are performed for (target, in, a) and the resulting responses are
   stored in res_addr_list and then searched.

   This list target_addr_list is issued to user under iterative
   requests.

