xref: /reactos/sdk/lib/dnslib/addr.c (revision 7e22dc05)
1 /*
2  * COPYRIGHT:   See COPYING in the top level directory
3  * PROJECT:     ReactOS DNS Shared Library
4  * FILE:        lib/dnslib/addr.c
5  * PURPOSE:     Contains the Address Family Information Tables
6  */
7 
8 /* INCLUDES ******************************************************************/
9 #include "precomp.h"
10 
11 /* DATA **********************************************************************/
12 
13 DNS_FAMILY_INFO AddrFamilyTable[3] =
14 {
15     {
16         AF_INET,
17         DNS_TYPE_A,
18         sizeof(IP4_ADDRESS),
19         sizeof(SOCKADDR_IN),
20         FIELD_OFFSET(SOCKADDR_IN, sin_addr)
21     },
22     {
23         AF_INET6,
24         DNS_TYPE_AAAA,
25         sizeof(IP6_ADDRESS),
26         sizeof(SOCKADDR_IN6),
27         FIELD_OFFSET(SOCKADDR_IN6, sin6_addr)
28     },
29     {
30         AF_ATM,
31         DNS_TYPE_ATMA,
32         sizeof(ATM_ADDRESS),
33         sizeof(SOCKADDR_ATM),
34         FIELD_OFFSET(SOCKADDR_ATM, satm_number)
35     }
36 };
37 
38 /* FUNCTIONS *****************************************************************/
39 
40 PDNS_FAMILY_INFO
41 WINAPI
42 FamilyInfo_GetForFamily(IN WORD AddressFamily)
43 {
44     /* Check which family this is */
45     switch (AddressFamily)
46     {
47         case AF_INET:
48             /* Return IPv4 Family Info */
49             return &AddrFamilyTable[0];
50 
51         case AF_INET6:
52             /* Return IPv6 Family Info */
53             return &AddrFamilyTable[1];
54 
55         case AF_ATM:
56             /* Return ATM Family Info */
57             return &AddrFamilyTable[2];
58 
59         default:
60             /* Invalid family */
61             return NULL;
62     }
63 
64 }
65 
66