xref: /titanic_51/usr/src/lib/smbsrv/libsmbns/common/libsmbns.h (revision 53a7b6b6763f5865522a76e5e887390a8f4777d7)
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	"@(#)libsmbns.h	1.10	08/07/24 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	SMB_ADS_MAXBUFLEN 100
40 
41 typedef struct smb_ads_handle {
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 } smb_ads_handle_t;
51 
52 /*
53  * The possible return status of the adjoin routine.
54  */
55 typedef enum smb_adjoin_status {
56 	SMB_ADJOIN_SUCCESS = 0,
57 	SMB_ADJOIN_ERR_GET_HANDLE,
58 	SMB_ADJOIN_ERR_GEN_PASSWD,
59 	SMB_ADJOIN_ERR_GET_DCLEVEL,
60 	SMB_ADJOIN_ERR_ADD_TRUST_ACCT,
61 	SMB_ADJOIN_ERR_MOD_TRUST_ACCT,
62 	SMB_ADJOIN_ERR_DUP_TRUST_ACCT,
63 	SMB_ADJOIN_ERR_TRUST_ACCT,
64 	SMB_ADJOIN_ERR_GET_ENCTYPES,
65 	SMB_ADJOIN_ERR_INIT_KRB_CTX,
66 	SMB_ADJOIN_ERR_GET_SPNS,
67 	SMB_ADJOIN_ERR_KSETPWD,
68 	SMB_ADJOIN_ERR_UPDATE_CNTRL_ATTR,
69 	SMB_ADJOIN_ERR_WRITE_KEYTAB,
70 	SMB_ADJOIN_ERR_IDMAP_SET_DOMAIN,
71 	SMB_ADJOIN_ERR_IDMAP_REFRESH,
72 	SMB_ADJOIN_ERR_COMMIT_KEYTAB,
73 	SMB_ADJOIN_NUM_STATUS
74 } smb_adjoin_status_t;
75 
76 /* ADS functions */
77 extern void smb_ads_init(void);
78 extern void smb_ads_refresh(void);
79 extern smb_ads_handle_t *smb_ads_open(void);
80 extern void smb_ads_close(smb_ads_handle_t *);
81 extern int smb_ads_publish_share(smb_ads_handle_t *, const char *, const char *,
82     const char *, const char *);
83 extern int smb_ads_remove_share(smb_ads_handle_t *, const char *, const char *,
84     const char *, const char *);
85 extern int smb_ads_build_unc_name(char *, int, const char *, const char *);
86 extern int smb_ads_lookup_share(smb_ads_handle_t *, const char *, const char *,
87     char *);
88 extern int smb_ads_add_share(smb_ads_handle_t *, const char *, const char *,
89     const char *);
90 extern smb_adjoin_status_t smb_ads_join(char *, char *, char *, char *, int);
91 extern char *smb_adjoin_report_err(smb_adjoin_status_t);
92 extern boolean_t smb_ads_lookup_msdcs(char *, char *, char *, uint32_t);
93 
94 /* DYNDNS functions */
95 extern int dyndns_start(void);
96 extern void dyndns_stop(void);
97 extern int dyndns_update(char *);
98 extern void dyndns_update_zones(void);
99 extern void dyndns_clear_zones(void);
100 
101 /* Kerberos initialization function */
102 extern int smb_kinit(char *, char *);
103 extern int smb_ccache_init(char *, char *);
104 extern void smb_ccache_remove(char *);
105 
106 /* NETBIOS Functions */
107 extern int smb_netbios_start(void);
108 extern void smb_netbios_shutdown(void);
109 extern void smb_netbios_name_reconfig(void);
110 
111 /* Browser Functions */
112 extern void smb_browser_reconfig(void);
113 extern boolean_t smb_browser_netlogon(char *, char *, uint32_t);
114 
115 
116 #ifdef	__cplusplus
117 }
118 #endif
119 
120 #endif	/* _LIBSMBNS_H */
121