xref: /titanic_50/usr/src/lib/smbsrv/libsmbns/common/libsmbns.h (revision c0889d7a91fa87e1cb7ef4457629b0cb51d47b50)
1 /*
2  * CDDL HEADER START
3  *
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.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_LIBSMBNS_H
27 #define	_LIBSMBNS_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <ldap.h>
32 #include <smbsrv/libsmb.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 /* ADS typedef/data structures and functions */
39 #define	ADS_MAXBUFLEN 100
40 
41 typedef struct ads_handle_s {
42 	char *user;		/* admin user to create share in ADS */
43 	char *pwd;		/* user password */
44 	char *domain;		/* ADS domain */
45 	char *domain_dn;	/* domain in Distinquish Name format */
46 	char *ip_addr;		/* ip addr in string format */
47 	char *hostname;		/* fully qualified hostname */
48 	char *site;		/* local ADS site */
49 	LDAP *ld;		/* LDAP handle */
50 } ADS_HANDLE;
51 
52 /*
53  * The possible return status of the adjoin routine.
54  */
55 typedef enum adjoin_status {
56 	ADJOIN_SUCCESS = 0,
57 	ADJOIN_ERR_GET_HANDLE,
58 	ADJOIN_ERR_GEN_PASSWD,
59 	ADJOIN_ERR_ADD_TRUST_ACCT,
60 	ADJOIN_ERR_MOD_TRUST_ACCT,
61 	ADJOIN_ERR_GET_ENCTYPES,
62 	ADJOIN_ERR_GET_HOST_PRINC,
63 	ADJOIN_ERR_INIT_KRB_CTX,
64 	ADJOIN_ERR_GET_KRB_PRINC,
65 	ADJOIN_ERR_KSETPWD,
66 	ADJOIN_ERR_UPDATE_CNTRL_ATTR,
67 	ADJOIN_ERR_WRITE_KEYTAB,
68 	ADJOIN_ERR_IDMAP_SET_DOMAIN,
69 	ADJOIN_ERR_IDMAP_REFRESH,
70 	ADJOIN_ERR_SMB_REFRESH,
71 	ADJOIN_NUM_STATUS
72 } adjoin_status_t;
73 
74 /* ADS functions */
75 extern void ads_init(void);
76 extern void ads_refresh(void);
77 extern ADS_HANDLE *ads_open(void);
78 extern void ads_close(ADS_HANDLE *);
79 extern int ads_publish_share(ADS_HANDLE *, const char *, const char *,
80     const char *, const char *);
81 extern int ads_remove_share(ADS_HANDLE *, const char *, const char *,
82     const char *, const char *);
83 extern int ads_build_unc_name(char *, int, const char *, const char *);
84 extern int ads_lookup_share(ADS_HANDLE *, const char *, const char *, char *);
85 extern int ads_add_share(ADS_HANDLE *, const char *, const char *,
86     const char *);
87 extern adjoin_status_t ads_join(char *, char *, char *, char *, int);
88 extern char *adjoin_report_err(adjoin_status_t status);
89 extern int ads_domain_change_cleanup(char *);
90 
91 /* DYNDNS functions */
92 extern int dns_msgid_init(void);
93 extern int dyndns_update(void);
94 extern int dyndns_clear_rev_zone(void);
95 
96 /* Kerberos initialization function */
97 extern int smb_kinit(char *user, char *passwd);
98 
99 
100 /* NETBIOS Functions */
101 extern int msdcs_lookup_ads(char *);
102 extern int smb_netbios_start(void);
103 extern void smb_netbios_shutdown(void);
104 extern void smb_netbios_name_reconfig(void);
105 
106 /* Browser Functions */
107 extern void smb_browser_reconfig(void);
108 extern void smb_browser_netlogon(char *);
109 
110 
111 #ifdef	__cplusplus
112 }
113 #endif
114 
115 #endif	/* _LIBSMBNS_H */
116