xref: /titanic_41/usr/src/lib/smbsrv/libsmbns/common/libsmbns.h (revision bbaa8b60dd95d714741fc474adad3cf710ef4efd)
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 (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 #ifndef	_LIBSMBNS_H
26 #define	_LIBSMBNS_H
27 
28 #include <ldap.h>
29 #include <smbsrv/libsmb.h>
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 /* ADS typedef/data structures and functions */
36 
37 
38 typedef struct smb_ads_handle {
39 	char *domain;		/* ADS domain (in lower case) */
40 	char *domain_dn;	/* domain in Distinquish Name format */
41 	char *ip_addr;		/* ip addr in string format */
42 	char *hostname;		/* fully qualified hostname */
43 	char *site;		/* local ADS site */
44 	LDAP *ld;		/* LDAP handle */
45 } smb_ads_handle_t;
46 
47 typedef struct smb_ads_host_info {
48 	char name[MAXHOSTNAMELEN];  /* fully qualified hostname */
49 	int port;		/* ldap port */
50 	int priority;		/* DNS SRV record priority */
51 	int weight;		/* DNS SRV record weight */
52 	smb_inaddr_t ipaddr;	/* network byte order */
53 } smb_ads_host_info_t;
54 
55 /*
56  * The possible return status of the adjoin routine.
57  */
58 typedef enum smb_adjoin_status {
59 	SMB_ADJOIN_SUCCESS = 0,
60 	SMB_ADJOIN_ERR_GET_HANDLE,
61 	SMB_ADJOIN_ERR_GEN_PWD,
62 	SMB_ADJOIN_ERR_GET_DCLEVEL,
63 	SMB_ADJOIN_ERR_ADD_TRUST_ACCT,
64 	SMB_ADJOIN_ERR_MOD_TRUST_ACCT,
65 	SMB_ADJOIN_ERR_DUP_TRUST_ACCT,
66 	SMB_ADJOIN_ERR_TRUST_ACCT,
67 	SMB_ADJOIN_ERR_INIT_KRB_CTX,
68 	SMB_ADJOIN_ERR_GET_SPNS,
69 	SMB_ADJOIN_ERR_KSETPWD,
70 	SMB_ADJOIN_ERR_UPDATE_CNTRL_ATTR,
71 	SMB_ADJOIN_ERR_WRITE_KEYTAB,
72 	SMB_ADJOIN_ERR_IDMAP_SET_DOMAIN,
73 	SMB_ADJOIN_ERR_IDMAP_REFRESH,
74 	SMB_ADJOIN_ERR_COMMIT_KEYTAB
75 } smb_adjoin_status_t;
76 
77 /* ADS functions */
78 extern void smb_ads_init(void);
79 extern void smb_ads_fini(void);
80 extern void smb_ads_refresh(void);
81 extern smb_ads_handle_t *smb_ads_open(void);
82 extern void smb_ads_close(smb_ads_handle_t *);
83 extern int smb_ads_publish_share(smb_ads_handle_t *, const char *, const char *,
84     const char *, const char *);
85 extern int smb_ads_remove_share(smb_ads_handle_t *, const char *, const char *,
86     const char *, const char *);
87 extern int smb_ads_build_unc_name(char *, int, const char *, const char *);
88 extern int smb_ads_lookup_share(smb_ads_handle_t *, const char *, const char *,
89     char *);
90 extern int smb_ads_add_share(smb_ads_handle_t *, const char *, const char *,
91     const char *);
92 extern smb_adjoin_status_t smb_ads_join(char *, char *, char *, char *, size_t);
93 extern void smb_ads_join_errmsg(smb_adjoin_status_t);
94 extern boolean_t smb_ads_lookup_msdcs(char *, char *, char *, uint32_t);
95 extern smb_ads_host_info_t *smb_ads_find_host(char *, char *);
96 
97 /* DYNDNS functions */
98 extern void *dyndns_publisher(void *);
99 extern void dyndns_start(void);
100 extern void dyndns_stop(void);
101 extern int dyndns_update(char *);
102 extern void dyndns_update_zones(void);
103 extern void dyndns_clear_zones(void);
104 
105 /* Kerberos cache management function */
106 extern int smb_ccache_init(char *, char *);
107 extern void smb_ccache_remove(char *);
108 
109 /* NETBIOS Functions */
110 extern int smb_netbios_start(void);
111 extern void smb_netbios_stop(void);
112 extern void smb_netbios_name_reconfig(void);
113 
114 /* Browser Functions */
115 extern void smb_browser_reconfig(void);
116 extern boolean_t smb_browser_netlogon(char *, char *, uint32_t);
117 
118 
119 #ifdef	__cplusplus
120 }
121 #endif
122 
123 #endif	/* _LIBSMBNS_H */
124