Unleashed v1.4
[unleashed.git] / usr / src / lib / libadutils / common / addisc.h
blobb3a0b44cc337a14ea66b91feafacd033b6bd2039
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
27 #ifndef _ADINFO_H
28 #define _ADINFO_H
30 #include <sys/socket.h>
31 #include <sys/uuid.h>
32 #include "libadutils.h"
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
40 * Maximum string SID size. 4 bytes for "S-1-", 15 for 2^48 (max authority),
41 * another '-', and ridcount (max 15) 10-digit RIDs plus '-' in between, plus
42 * a null.
44 #define MAXSTRSID 185
45 #define MAXDOMAINNAME 256
46 #define AD_DISC_MAXHOSTNAME 256
48 typedef struct ad_disc *ad_disc_t;
51 typedef struct ad_disc_domains_in_forest {
52 char domain[MAXDOMAINNAME];
53 char sid[MAXSTRSID];
54 int trusted; /* This is not used by auto */
55 /* discovery. It is provided so that */
56 /* domains in a forest can be marked */
57 /* as trusted. */
58 } ad_disc_domainsinforest_t;
61 typedef struct ad_disc_trusted_domains {
62 char domain[MAXDOMAINNAME];
63 int direction;
64 } ad_disc_trusteddomains_t;
66 enum ad_disc_req {
67 AD_DISC_PREFER_SITE = 0, /* Prefer Site specific version */
68 AD_DISC_SITE_SPECIFIC, /* Request Site specific version */
69 AD_DISC_GLOBAL /* Request global version */
73 * First four members of this are like idmap_ad_disc_ds_t
74 * (for compatiblity) until that can be eliminated.
75 * See PROP_DOMAIN_CONTROLLER in idmapd/server.c
77 typedef struct ad_disc_ds {
78 /* Keep these first four in sync with idmap_ad_disc_ds_t */
79 int port;
80 int priority;
81 int weight;
82 char host[AD_DISC_MAXHOSTNAME];
83 /* Members after this are private and free to change. */
84 char site[AD_DISC_MAXHOSTNAME];
85 struct sockaddr_storage addr;
86 uint32_t flags;
87 uint32_t ttl;
88 } ad_disc_ds_t;
90 ad_disc_t ad_disc_init(void);
92 void ad_disc_fini(ad_disc_t);
95 * The following routines auto discover the specific item
97 char *
98 ad_disc_get_DomainName(ad_disc_t ctx, boolean_t *auto_discovered);
100 uchar_t *
101 ad_disc_get_DomainGUID(ad_disc_t ctx, boolean_t *auto_discovered);
103 ad_disc_ds_t *
104 ad_disc_get_DomainController(ad_disc_t ctx,
105 enum ad_disc_req req, boolean_t *auto_discovered);
107 ad_disc_ds_t *
108 ad_disc_get_PreferredDC(ad_disc_t ctx, boolean_t *auto_discovered);
110 char *
111 ad_disc_get_SiteName(ad_disc_t ctx, boolean_t *auto_discovered);
113 char *
114 ad_disc_get_ForestName(ad_disc_t ctx, boolean_t *auto_discovered);
116 ad_disc_ds_t *
117 ad_disc_get_GlobalCatalog(ad_disc_t ctx, enum ad_disc_req,
118 boolean_t *auto_discovered);
120 ad_disc_trusteddomains_t *
121 ad_disc_get_TrustedDomains(ad_disc_t ctx, boolean_t *auto_discovered);
123 ad_disc_domainsinforest_t *
124 ad_disc_get_DomainsInForest(ad_disc_t ctx, boolean_t *auto_discovered);
128 * The following routines over ride auto discovery with the
129 * specified values
132 ad_disc_set_DomainName(ad_disc_t ctx, const char *domainName);
135 ad_disc_set_DomainGUID(ad_disc_t ctx, uchar_t *u);
138 ad_disc_set_DomainController(ad_disc_t ctx,
139 const ad_disc_ds_t *domainController);
141 ad_disc_set_PreferredDC(ad_disc_t ctx, const ad_disc_ds_t *dc);
144 ad_disc_set_SiteName(ad_disc_t ctx, const char *siteName);
147 ad_disc_set_ForestName(ad_disc_t ctx, const char *forestName);
150 ad_disc_set_GlobalCatalog(ad_disc_t ctx,
151 const ad_disc_ds_t *globalCatalog);
154 * This function sets a FILE * on which this library will write
155 * progress information during DC Location.
157 void
158 ad_disc_set_StatusFP(ad_disc_t ctx, struct __FILE_TAG *);
161 ad_disc_getnameinfo(char *, int, struct sockaddr_storage *);
164 * This routine forces all auto discovery item to be recomputed
165 * on request
167 void ad_disc_refresh(ad_disc_t);
170 * This routine marks the end of a discovery cycle and sets
171 * the sanity limits on the time before the next cycle.
173 void ad_disc_done(ad_disc_t);
175 /* This routine unsets all overridden values */
176 int ad_disc_unset(ad_disc_t ctx);
178 /* This routine test for subnet changes */
179 boolean_t ad_disc_SubnetChanged(ad_disc_t);
181 /* This routine returns the Time To Live for auto discovered items */
182 int ad_disc_get_TTL(ad_disc_t);
184 int ad_disc_compare_uuid(uuid_t *u1, uuid_t *u2);
186 int ad_disc_compare_ds(ad_disc_ds_t *ds1, ad_disc_ds_t *ds2);
188 int ad_disc_compare_trusteddomains(ad_disc_trusteddomains_t *td1,
189 ad_disc_trusteddomains_t *td2);
191 int ad_disc_compare_domainsinforest(ad_disc_domainsinforest_t *td1,
192 ad_disc_domainsinforest_t *td2);
194 #ifdef __cplusplus
196 #endif
198 #endif /* _ADINFO_H */