#ifndef _SMBSRV_SMBINFO_H
#define _SMBSRV_SMBINFO_H
#include <sys/types.h>
#include <sys/uuid.h>
#include <smbsrv/netbios.h>
#include <netinet/in.h>
#include <smbsrv/smb_inet.h>
#include <smbsrv/smb2.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef NATIVE_OS_DEFINED
#define NATIVE_OS_DEFINED
#define NATIVE_OS_UNKNOWN 0x00000000
#define NATIVE_OS_WINNT 0x00000001
#define NATIVE_OS_WIN95 0x00000002
#define NATIVE_OS_MACOS 0x00000003
#define NATIVE_OS_WIN2000 0x00000004
#endif
#ifndef NATIVE_LANMAN_DEFINED
#define NATIVE_LANMAN_DEFINED
#define NATIVE_LM_NONE 0x00000000
#define NATIVE_LM_NT 0x00000001
#define NATIVE_LM_WIN2000 0x00000002
#endif
#define PDC_UNKNOWN 0
#define PDC_WINNT 1
#define PDC_WIN2000 2
#define PDC_WINXP 3
#define PDC_SAMBA 4
#ifndef MAX_NETWORKS
#define MAX_NETWORKS 36
#endif
#define SMB_PI_MAX_NETWORKS 36
#define SMB_PI_MAX_WINS 2
#define SMB_SECMODE_WORKGRP 1
#define SMB_SECMODE_DOMAIN 2
#define SMB_PI_MAX_HOST 48
#define SMB_PI_MAX_DOMAIN 256
#define SMB_PI_MAX_SCOPE 16
#define SMB_PI_MAX_COMMENT 58
#define SMB_PI_MAX_NATIVE_OS 32
#define SMB_PI_MAX_LANMAN 32
#define SMB_PI_MAX_NEGTOK 256
#define SMB_PI_KEEP_ALIVE_MIN (90 * 60)
#define SMB_PI_MAX_WORKERS_MIN 64
#define SMB_PI_MAX_WORKERS_DEF 1024
#define SMB_PI_MAX_WORKERS_MAX 16384
#define SMB_PI_INITIAL_CREDITS_MIN 16
#define SMB_PI_INITIAL_CREDITS_DEF 20
#define SMB_PI_INITIAL_CREDITS_MAX 256
#define SMB_PI_MAXIMUM_CREDITS_MIN 64
#define SMB_PI_MAXIMUM_CREDITS_DEF 1000
#define SMB_PI_MAXIMUM_CREDITS_MAX 1024
#define SMB_PI_NETLOGON_FLAGS_DEFAULT 0x00000000
typedef struct smb_version {
uint32_t sv_size;
uint32_t sv_major;
uint32_t sv_minor;
uint32_t sv_build_number;
uint32_t sv_platform_id;
} smb_version_t;
typedef enum smb_cfg_val {
SMB_CONFIG_DISABLED = 0,
SMB_CONFIG_ENABLED = 1,
SMB_CONFIG_REQUIRED = 2
} smb_cfg_val_t;
void smb_cfg_set_require(const char *, smb_cfg_val_t *);
typedef struct smb_kmod_cfg {
uint32_t skc_maxworkers;
uint32_t skc_maxconnections;
uint32_t skc_keepalive;
int32_t skc_restrict_anon;
int32_t skc_signing_enable;
int32_t skc_signing_required;
int32_t skc_oplock_enable;
int32_t skc_sync_enable;
int32_t skc_secmode;
int32_t skc_netbios_enable;
int32_t skc_ipv6_enable;
int32_t skc_print_enable;
int32_t skc_traverse_mounts;
int32_t skc_short_names;
uint32_t skc_max_protocol;
uint32_t skc_min_protocol;
smb_cfg_val_t skc_encrypt;
uint32_t skc_encrypt_ciphers;
uint32_t skc_execflags;
uint32_t skc_negtok_len;
uint32_t skc_max_opens;
uint32_t skc_sign_algs;
smb_version_t skc_version;
uint16_t skc_initial_credits;
uint16_t skc_maximum_credits;
uuid_t skc_machine_uuid;
uchar_t skc_negtok[SMB_PI_MAX_NEGTOK];
char skc_native_os[SMB_PI_MAX_NATIVE_OS];
char skc_native_lm[SMB_PI_MAX_LANMAN];
char skc_nbdomain[NETBIOS_NAME_SZ];
char skc_fqdn[SMB_PI_MAX_DOMAIN];
char skc_hostname[SMB_PI_MAX_HOST];
char skc_system_comment[SMB_PI_MAX_COMMENT];
} smb_kmod_cfg_t;
#define SMB_EXEC_MAP 0x01
#define SMB_EXEC_UNMAP 0x02
#define SMB_EXEC_TERM 0x04
#define SMB_EXEC_DISP_CONTINUE "continue"
#define SMB_EXEC_DISP_TERMINATE "terminate"
#define SMB_MAJOR_NT 4
#define SMB_MAJOR_2000 5
#define SMB_MAJOR_XP 5
#define SMB_MAJOR_2003 5
#define SMB_MAJOR_VISTA 6
#define SMB_MAJOR_2008 6
#define SMB_MAJOR_2008R2 6
#define SMB_MAJOR_7 6
#define SMB_MINOR_NT 0
#define SMB_MINOR_2000 0
#define SMB_MINOR_XP 1
#define SMB_MINOR_2003 2
#define SMB_MINOR_VISTA 0
#define SMB_MINOR_2008 0
#define SMB_MINOR_2008R2 1
#define SMB_MINOR_7 1
#define SMB_VERSTR_LEN 8
int smbnative_os_value(const char *);
int smbnative_lm_value(const char *);
int smbnative_pdc_value(const char *);
const char *smbnative_os_str(smb_version_t *);
const char *smbnative_lm_str(smb_version_t *);
#define AUTH_USER_GRANT 0x00000000
#define AUTH_GUEST_GRANT 0x00000001
#define AUTH_IPC_ONLY_GRANT 0x00000002
#define SMB_VERS_1 1
#define SMB_VERS_2_BASE 0x200
#define SMB_VERS_2_002 0x202
#define SMB_VERS_2_1 0x210
#define SMB_VERS_3_0 0x300
#define SMB_VERS_3_02 0x302
#define SMB_VERS_3_11 0x311
#define SMB3_CIPHER_BIT(c) (1 << (c))
#define SMB3_CIPHER_FLAGS_ALL ((1 << (SMB3_CIPHER_ID_MAX)) - 1)
#define SMB3_CIPHER_FLAG_AES128_CCM SMB3_CIPHER_BIT(SMB3_CIPHER_AES128_CCM)
#define SMB3_CIPHER_FLAG_AES128_GCM SMB3_CIPHER_BIT(SMB3_CIPHER_AES128_GCM)
#define SMB3_CIPHER_FLAG_AES256_CCM SMB3_CIPHER_BIT(SMB3_CIPHER_AES256_CCM)
#define SMB3_CIPHER_FLAG_AES256_GCM SMB3_CIPHER_BIT(SMB3_CIPHER_AES256_GCM)
#define SMB3_SIGN_ALG_BIT(c) (1 << (c))
#define SMB3_SIGN_FLAGS_ALL ((1 << (SMB3_SIGN_ID_MAX)) - 1)
#define SMB3_SIGN_FLAG_AES128_CMAC SMB3_SIGN_ALG_BIT(SMB3_SIGN_AES128_CMAC)
#define SMB3_SIGN_FLAG_AES128_GMAC SMB3_SIGN_ALG_BIT(SMB3_SIGN_AES128_GMAC)
#define SMB3_SIGN_FLAG_SHA256_HMAC SMB3_SIGN_ALG_BIT(SMB3_SIGN_SHA256_HMAC)
#ifdef __cplusplus
}
#endif
#endif