#ifndef _SMBSRV_STRING_H
#define _SMBSRV_STRING_H
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
#define _smb_between(l, c, u) ((l) <= (c) && (c) <= (u))
#define smb_isalpha(c) (smb_islower(c) || smb_isupper(c))
#define smb_isdigit(c) _smb_between('0', (c), '9')
#define smb_isalnum(c) (smb_isalpha(c) || smb_isdigit(c))
#define smb_isxdigit(c) (smb_isdigit(c) || \
_smb_between('a', (c), 'f') || \
_smb_between('A', (c), 'F'))
#define smb_isblank(c) ((c) == ' ' || (c) == '\t')
#define smb_isspace(c) ((c) == ' ' || \
(c) == '\t' || \
(c) == '\n' || \
(c) == '\r' || \
(c) == '\f')
#define smb_isascii(c) (!((c) &~ 0x7F))
#define smb_isalpha_ascii(c) \
(_smb_between('a', (c), 'z') || _smb_between('A', (c), 'Z'))
#define smb_isalnum_ascii(c) (smb_isalpha_ascii(c) || smb_isdigit(c))
#define smb_isprint(c) _smb_between('!', (c), '~')
#define smb_iscntrl(c) ((((c) >= 0) && ((c) <= 0x1f)) || ((c) == 0x7f))
#define smb_ispunct(c) (smb_isprint(c) && !smb_isxdigit(c) && !smb_isspace(c))
typedef enum codepage_id {
OEM_CPG_850 = 0,
OEM_CPG_950,
OEM_CPG_1252,
OEM_CPG_949,
OEM_CPG_936,
OEM_CPG_932,
OEM_CPG_852,
OEM_CPG_1250,
OEM_CPG_1253,
OEM_CPG_737,
OEM_CPG_1254,
OEM_CPG_857,
OEM_CPG_1251,
OEM_CPG_866,
OEM_CPG_1255,
OEM_CPG_862,
OEM_CPG_1256,
OEM_CPG_720
} codepage_id_t;
#define MTS_MB_CUR_MAX 4
#define MTS_MB_CHAR_MAX MTS_MB_CUR_MAX
typedef uint16_t smb_wchar_t;
#define CODEPAGE_ISNONE 0x00
#define CODEPAGE_ISUPPER 0x01
#define CODEPAGE_ISLOWER 0x02
typedef struct smb_codepage {
unsigned char ctype;
smb_wchar_t upper;
smb_wchar_t lower;
} smb_codepage_t;
void smb_codepage_init(void);
void smb_codepage_fini(void);
int smb_isupper(int);
int smb_islower(int);
uint32_t smb_toupper(uint32_t);
uint32_t smb_tolower(uint32_t);
char *smb_strupr(char *);
char *smb_strlwr(char *);
int smb_isstrupr(const char *);
int smb_isstrlwr(const char *);
int smb_strcasecmp(const char *, const char *, size_t);
boolean_t smb_match(const char *, const char *, boolean_t);
size_t smb_mbstowcs(smb_wchar_t *, const char *, size_t);
size_t smb_wcstombs(char *, const smb_wchar_t *, size_t);
int smb_mbtowc(uint32_t *, const char *, size_t);
int smb_wctomb(char *, uint32_t);
size_t smb_wcequiv_strlen(const char *);
size_t smb_sbequiv_strlen(const char *);
int smb_oemtombs(char *, const uint8_t *, int);
int smb_mbstooem(uint8_t *, const char *, int);
size_t ucstooem(char *, const smb_wchar_t *, size_t, uint32_t);
size_t oemtoucs(smb_wchar_t *, const char *, size_t, uint32_t);
char *strsubst(char *, char, char);
char *strsep(char **, const char *);
char *strcanon(char *, const char *);
typedef struct smb_unc {
char *unc_server;
char *unc_share;
char *unc_path;
char *unc_buf;
} smb_unc_t;
int smb_unc_init(const char *, smb_unc_t *);
void smb_unc_free(smb_unc_t *);
#ifdef __cplusplus
}
#endif
#endif