2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
13 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
17 * Declarations intentionally similar to the MSDN SDK file
18 * winsdk/Include/DsGetDC.h
22 #ifndef _ADS_DSGETDC_H
23 #define _ADS_DSGETDC_H
25 #include <sys/types.h>
33 * Flags to passed to DsGetDcName
36 #define DS_FORCE_REDISCOVERY 0x00000001
38 #define DS_DIRECTORY_SERVICE_REQUIRED 0x00000010
39 #define DS_DIRECTORY_SERVICE_PREFERRED 0x00000020
40 #define DS_GC_SERVER_REQUIRED 0x00000040
41 #define DS_PDC_REQUIRED 0x00000080
42 #define DS_BACKGROUND_ONLY 0x00000100
43 #define DS_IP_REQUIRED 0x00000200
44 #define DS_KDC_REQUIRED 0x00000400
45 #define DS_TIMESERV_REQUIRED 0x00000800
46 #define DS_WRITABLE_REQUIRED 0x00001000
47 #define DS_GOOD_TIMESERV_PREFERRED 0x00002000
48 #define DS_AVOID_SELF 0x00004000
49 #define DS_ONLY_LDAP_NEEDED 0x00008000
52 #define DS_IS_FLAT_NAME 0x00010000
53 #define DS_IS_DNS_NAME 0x00020000
55 #define DS_RETURN_DNS_NAME 0x40000000
56 #define DS_RETURN_FLAT_NAME 0x80000000
59 * Structure returned from DsGetDcName
60 * NB: Keep same as adspriv_dcinfo
63 typedef struct _DOMAIN_CONTROLLER_INFO
{
64 char *DomainControllerName
;
65 char *DomainControllerAddress
;
66 uint32_t DomainControllerAddressType
;
73 uint8_t _sockaddr
[256];
74 } DOMAIN_CONTROLLER_INFO
, *PDOMAIN_CONTROLLER_INFO
;
77 * Values for DomainControllerAddressType
80 #define DS_INET_ADDRESS 1
81 #define DS_NETBIOS_ADDRESS 2
84 * Values for returned Flags
87 #define DS_PDC_FLAG 0x00000001 /* DC is PDC of Domain */
88 #define DS_GC_FLAG 0x00000004 /* DC is a GC of forest */
89 #define DS_LDAP_FLAG 0x00000008 /* supports an LDAP server */
90 #define DS_DS_FLAG 0x00000010 /* supports a DS and is a */
91 /* Domain Controller */
92 #define DS_KDC_FLAG 0x00000020 /* is running KDC service */
93 #define DS_TIMESERV_FLAG 0x00000040 /* is running time service */
94 #define DS_CLOSEST_FLAG 0x00000080 /* DC is in closest site */
96 #define DS_WRITABLE_FLAG 0x00000100 /* DC has a writable DS */
97 #define DS_GOOD_TIMESERV_FLAG 0x00000200 /* is running time service */
98 /* (and has clock hardware) */
99 #define DS_NDNC_FLAG 0x00000400 /* DomainName is non-domain */
100 /* NC serviced by the */
102 #define DS_PING_FLAGS 0x0000FFFF /* Flags returned on ping */
104 #define DS_DNS_CONTROLLER_FLAG 0x20000000 /* DC Name is a DNS name */
105 #define DS_DNS_DOMAIN_FLAG 0x40000000 /* DomainName is a DNS name */
106 #define DS_DNS_FOREST_FLAG 0x80000000 /* ForestName is a DNS name */
110 * Function Prototypes
113 /* Offial API. Returns an NT error number. */
115 DsGetDcName(const char *ComputerName
,
116 const char *DomainName
, const struct uuid
*DomainGuid
,
117 const char *SiteName
, uint32_t Flags
,
118 DOMAIN_CONTROLLER_INFO
**dcinfo
);
120 /* internal version of above - returns a detailed NT status */
122 _DsGetDcName(const char *ComputerName
,
123 const char *DomainName
, const struct uuid
*DomainGuid
,
124 const char *SiteName
, uint32_t Flags
,
125 DOMAIN_CONTROLLER_INFO
**dcinfo
);
129 const char *ComputerName
,
133 * XXX: Others from DsGetDc.h we may want later:
134 * DsValidateSubnetName()
135 * DsAddressToSiteNames()
136 * DsAddressToSiteNamesEx()
137 * DsEnumerateDomainTrusts()
138 * DsGetForestTrustInformation()
139 * DsGetDcSiteCoverage()
140 * DsDeregisterDnsHostRecords()
141 * DsGetDcOpen(), DsGetDcNext(), DsGetDcClose()
145 * Until we can easily allocate a DC Info as one big hunk.
146 * This will free a DC Info returned by DsGetDcName().
149 DsFreeDcInfo(DOMAIN_CONTROLLER_INFO
*);
152 * Internal function to force DC Rediscovery.
155 _DsForceRediscovery(char *domain
, int flags
);
161 #endif /* _ADS_DSGETDC_H */