code understanding

Nidal Shater ngiw2012 at hotmail.com
Wed Aug 21 22:57:42 UTC 2013


Hi 
We all know rrset-order{order random;} option, I search bind code and find the part which deal with this 
*****************************************************
for (i = 0; i < count; i++) {
                dns_rdata_t rdata;
                isc_uint32_t val;

                isc_random_get(&val);
                choice = i + (val % (count - i));
                rdata = shuffled[i];
                shuffled[i] = shuffled[choice];
                shuffled[choice] = rdata;
                if (order != NULL)
                    sorted[i].key = (*order)(&shuffled[i],
                                 order_arg);
                else
                    sorted[i].key = 0; /* Unused */
                sorted[i].rdata = &shuffled[i];
            }
*****************************************************

which is located in /bind/lib/dns/rdataset.c 

Could anybody help me to understand this piece of code, thank for your time 

Nidal

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/bind-users/attachments/20130821/490dee57/attachment.html>


More information about the bind-users mailing list