libmlsvc.h revision 1fcced4c370617db71610fecffd5451a5894ca5e
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _LIBMLSVC_H
#define _LIBMLSVC_H
#include <stdio.h>
#include <string.h>
#include <netdb.h>
#include <libuutil.h>
#include <smbsrv/wintypes.h>
#include <smbsrv/hash_table.h>
#include <smbsrv/smb_token.h>
#include <smbsrv/smb_privilege.h>
#include <smbsrv/smb_share.h>
#include <smbsrv/libsmbrdr.h>
#include <smbsrv/libmlrpc.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* SMB domain API to discover a domain controller and obtain domain
* information.
*/
extern void dssetup_clear_domain_info(void);
extern int mlsvc_init(void);
extern void mlsvc_fini(void);
extern DWORD mlsvc_netlogon(char *, char *);
/*
* The maximum number of domains (NT limit).
*/
#define MLSVC_DOMAIN_MAX 32
/*
* Status code returned from enumeration RPCs to indicate
* that the server has no more data. Normally returned at
* severity level ERROR_SEVERITY_WARNING.
*/
#define MLSVC_NO_MORE_DATA 0x1A
#define MLSVC_ANON_USER "IPC$"
/*
* Passthrough negotiation and authentication interface.
*
* NT supports two forms of password: a Lanman (case-insensitive)
* password and an NT (case-sensitive) password. If either of the
* passwords is not available its pointer and length should be set
* to zero. The session key and vc number are required to validate
* the encrypted passwords.
*/
int outmax);
#define SMB_AUTOHOME_FILE "smbautohome"
#define SMB_AUTOHOME_PATH "/etc"
typedef struct smb_autohome {
struct smb_autohome *ah_next;
char *ah_name; /* User account name */
char *ah_path; /* Home directory path */
char *ah_container; /* ADS container distinguished name */
extern void smb_autohome_add(const char *);
extern void smb_autohome_remove(const char *);
/*
* A local unique id (LUID) is an opaque id used by servers to identify
* local resources, such as privileges. A client will use lookup
* functions to translate the LUID to a more general, machine independent
* form; such as a string.
*/
typedef struct ms_luid {
} ms_luid_t;
/*
* Information about a server as reported by NetServerGetInfo.
* The SV_PLATFORM and SV_TYPE definitions are in srvsvc.ndl.
*/
typedef struct srvsvc_server_info {
char *sv_name;
char *sv_comment;
int srvsvc_net_server_getinfo(char *, char *, srvsvc_server_info_t *);
/*
* A client_t is created while binding a client connection to hold the
* context for calls made using that connection.
*
* Handles are RPC call specific and we use an inheritance mechanism to
* ensure that each handle has a pointer to the client_t. When the top
* level (bind) handle is released, we close the connection.
*/
typedef struct mlsvc_handle {
int remote_os;
int ndr_rpc_bind(mlsvc_handle_t *, char *, char *, char *, const char *);
void ndr_rpc_unbind(mlsvc_handle_t *);
int ndr_rpc_call(mlsvc_handle_t *, int, void *);
int ndr_rpc_server_os(mlsvc_handle_t *);
void ndr_rpc_release(mlsvc_handle_t *);
/* SVCCTL service */
/*
* Calculate the wide-char equivalent string length required to
* store a string - including the terminating null wide-char.
*/
/* An AVL-storable node representing each service in the SCM database. */
typedef struct svcctl_svc_node {
char *sn_name; /* Service Name (Key) */
char *sn_fmri; /* Display Name (FMRI) */
char *sn_desc; /* Description */
char *sn_state; /* State */
/* This structure provides context for each svcctl_s_OpenManager call. */
typedef struct svcctl_manager_context {
/* This structure provides context for each svcctl_s_OpenService call. */
typedef struct svcctl_service_context {
char *sc_svcname; /* Service Name */
typedef enum {
/* This structure provides abstraction for service and manager context call. */
typedef struct svcctl_context {
union {
void *uc_cp;
} c_ctx;
/* Service Control Manager (SCM) functions */
void svcctl_init(void);
void svcctl_fini(void);
void svcctl_scm_fini(svcctl_manager_context_t *);
uint32_t svcctl_scm_map_status(const char *);
/* LOGR service */
#define LOGR_APPLICATION_LOG "Application"
#define LOGR_SECURITY_LOG "Security"
#define LOGR_SYSTEM_LOG "System"
#define LOGR_NMSGMASK 1023
#define LOGR_MAXMSGLEN 800
typedef struct logr_entry {
int le_pri; /* Message priority */
} logr_entry_t;
typedef struct logr_info {
int li_idx; /* Index */
} logr_info_t;
typedef struct logr_read_data {
int rd_tot_recnum; /* Total no. of record read */
int rd_last_sentrec; /* Last sentence read */
char rd_first_read; /* First sentence read */
/* This structure provides the context for eventlog calls from clients. */
typedef struct logr_context {
char *lc_source_name;
void logr_init(void);
void logr_fini(void);
boolean_t logr_is_supported(char *);
int logr_get_snapshot(logr_context_t *);
#ifdef __cplusplus
}
#endif
#endif /* _LIBMLSVC_H */