smb_lib.h revision a547be5daca7e465ca82df6d179f6b1f8e0cda72
/*
* Copyright (c) 2000-2001 Boris Popov
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Boris Popov.
* 4. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: smb_lib.h,v 1.21.82.2 2005/06/02 00:55:39 lindak Exp $
*/
/*
*/
#ifndef _NETSMB_SMB_LIB_H_
#define _NETSMB_SMB_LIB_H_
/*
* Internal interface exported to our commands in:
*/
#include <sys/byteorder.h>
#include <netsmb/smbfs_api.h>
extern const char smbutil_std_opts[];
#define STDPARAM_OPT smbutil_std_opts
/*
* bits to indicate the source of error
*/
#define SMB_ERRTYPE_MASK 0xf0000
#define SMB_SYS_ERROR 0x00000
#define SMB_RAP_ERROR 0x10000
#define SMB_NB_ERROR 0x20000
/*
* The driver needs to know this, so it's
* defined by smb_dev.h
*/
#define NTLM_HASH_SZ SMBIOC_HASH_SZ
/*
* This is what goes across the door call to the IOD
* when asking for a new connection.
*/
struct smb_iod_ssn {
struct smbioc_ossn iod_ossn;
int iod_authflags; /* SMB_AT_x */
/* Kerberos cred. cache res. name? */
};
typedef struct smb_iod_ssn smb_iod_ssn_t;
/*
* SMB work context. Used to store all values which are necessary
* to establish connection to an SMB server.
*/
struct smb_ctx {
int ct_flags; /* SMBCF_ */
int ct_dev_fd; /* device handle */
int ct_door_fd; /* to smbiod */
int ct_parsedlevel;
int ct_minlevel;
int ct_maxlevel;
char *ct_fullserver; /* orig. server name from cmd line */
char *ct_srvaddr_s; /* hostname or IP address of server */
char *ct_locname; /* local (machine) name */
/* smbioc_oshare_t ct_sh; XXX */
int ct_minauth;
int ct_shtype_req; /* share type wanted */
char *ct_origshare;
char *ct_home;
/* Connection setup SMB stuff. */
/* Strings from the SMB negotiate response. */
char *ct_srv_OS;
char *ct_srv_LM;
/* NTLM auth. stuff */
char ct_password[SMBIOC_MAX_NAME];
/* See ssp.c */
void *ct_ssp_ctx;
};
/*
* Short-hand for some of the substruct fields above
*/
/*
* Bits in smb_ctx_t.ct_flags
*/
/*
* Context management
*/
int smb_ctx_init(struct smb_ctx *);
void smb_ctx_done(struct smb_ctx *);
int smb_open_driver(void);
int smb_ctx_gethandle(struct smb_ctx *);
int smb_ctx_findvc(struct smb_ctx *);
int smb_ctx_newvc(struct smb_ctx *);
/*
* I/O daemon stuff
*/
#define SMBIOD_RUNDIR "/var/run/smbiod"
#define SMBIOD_START 1
char *smb_iod_door_path(void);
int smb_iod_open_door(int *);
int smb_iod_connect(struct smb_ctx *);
int smb_iod_work(struct smb_ctx *);
/*
* Other stuff
*/
int smb_open_rcfile(char *);
void smb_close_rcfile(void);
int nls_setrecode(const char *, const char *);
int nls_setlocale(const char *);
char *nls_str_toext(char *, const char *);
char *nls_str_toloc(char *, const char *);
void *nls_mem_toext(void *, const void *, int);
void *nls_mem_toloc(void *, const void *, int);
char *nls_str_upper(char *, const char *);
char *nls_str_lower(char *, const char *);
char *smb_getprogname();
#define __progname smb_getprogname()
#endif /* _NETSMB_SMB_LIB_H_ */