netatalk  4.4.0dev
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
unicode.h File Reference
#include <errno.h>
#include <stdint.h>
#include <sys/param.h>

Go to the source code of this file.

Data Structures

struct  atalk_iconv_t
struct  charset_functions

Macros

#define ucs2_t   uint16_t
#define SAFE_FREE(x)
#define EILSEQ   84 /* Illegal byte sequence. */
#define CHARSET_CLIENT   1
#define CHARSET_VOLUME   2
#define CHARSET_PRECOMPOSED   4
#define CHARSET_DECOMPOSED   8
#define CHARSET_MULTIBYTE   16
#define CHARSET_WIDECHAR   32
#define CHARSET_ICONV   64
#define IGNORE_CHAR   '_'
#define CONV_IGNORE   (1<<0)
#define CONV_ESCAPEHEX   (1<<1)
#define CONV_ESCAPEDOTS   (1<<2)
#define CONV_UNESCAPEHEX   (1<<3)
#define CONV_TOUPPER   (1<<4)
#define CONV_TOLOWER   (1<<5)
#define CONV_PRECOMPOSE   (1<<6)
#define CONV_DECOMPOSE   (1<<7)
#define CONV_FORCE   (1<<8)
#define CONV__EILSEQ   (1<<9)
#define CONV_REQMANGLE   (1<<14)
#define CONV_REQESCAPE   (1<<15)
#define NUM_CHARSETS   5

Enumerations

enum  charset_t {
  CH_UCS2 = 0 , CH_UTF8 = 1 , CH_MAC = 2 , CH_UNIX = 3 ,
  CH_UTF8_MAC = 4
}

Functions

atalk_iconv_t atalk_iconv_open (const char *, const char *)
size_t atalk_iconv (atalk_iconv_t, const char **, size_t *, char **, size_t *)
int atalk_iconv_close (atalk_iconv_t)
struct charset_functionsfind_charset_functions (const char *)
int atalk_register_charset (struct charset_functions *)
ucs2_t toupper_w (ucs2_t)
uint32_t toupper_sp (uint32_t)
ucs2_t tolower_w (ucs2_t)
uint32_t tolower_sp (uint32_t)
int strupper_w (ucs2_t *)
int strlower_w (ucs2_t *)
int islower_w (ucs2_t)
int isupper_w (ucs2_t)
size_t strlen_w (const ucs2_t *)
size_t strnlen_w (const ucs2_t *, size_t)
ucs2_tstrchr_w (const ucs2_t *, ucs2_t)
ucs2_tstrcasechr_w (const ucs2_t *s, ucs2_t c)
int strcmp_w (const ucs2_t *, const ucs2_t *)
int strncmp_w (const ucs2_t *, const ucs2_t *, size_t)
int strcasecmp_w (const ucs2_t *, const ucs2_t *)
int strncasecmp_w (const ucs2_t *, const ucs2_t *, size_t)
ucs2_tstrstr_w (const ucs2_t *s, const ucs2_t *ins)
ucs2_tstrcasestr_w (const ucs2_t *, const ucs2_t *)
ucs2_tstrndup_w (const ucs2_t *, size_t)
ucs2_tstrdup_w (const ucs2_t *)
ucs2_tstrncpy_w (ucs2_t *, const ucs2_t *, const size_t)
ucs2_tstrncat_w (ucs2_t *, const ucs2_t *, const size_t)
ucs2_tstrcat_w (ucs2_t *, const ucs2_t *)
size_t precompose_w (ucs2_t *, size_t, ucs2_t *, size_t *)
size_t decompose_w (ucs2_t *, size_t, ucs2_t *, size_t *)
int set_charset_name (charset_t, const char *)
void free_charset_names (void)
void init_iconv (void)
size_t convert_string (charset_t, charset_t, void const *, size_t, void *, size_t)
size_t convert_string_allocate (charset_t, charset_t, void const *, size_t, char **)
size_t charset_strupper (charset_t, const char *, size_t, char *, size_t)
size_t charset_strlower (charset_t, const char *, size_t, char *, size_t)
size_t ucs2_to_charset_allocate (charset_t, char **dest, const ucs2_t *src)
size_t ucs2_to_charset (charset_t, const ucs2_t *src, char *dest, size_t)
size_t convert_charset (charset_t, charset_t, charset_t, const char *, size_t, char *, size_t, uint16_t *)
size_t charset_precompose (charset_t, char *, size_t, char *, size_t)
size_t charset_decompose (charset_t, char *, size_t, char *, size_t)
charset_t add_charset (const char *name)

Macro Definition Documentation

◆ CHARSET_CLIENT

#define CHARSET_CLIENT   1

◆ CHARSET_DECOMPOSED

#define CHARSET_DECOMPOSED   8

◆ CHARSET_ICONV

#define CHARSET_ICONV   64

◆ CHARSET_MULTIBYTE

#define CHARSET_MULTIBYTE   16

◆ CHARSET_PRECOMPOSED

#define CHARSET_PRECOMPOSED   4

◆ CHARSET_VOLUME

#define CHARSET_VOLUME   2

◆ CHARSET_WIDECHAR

#define CHARSET_WIDECHAR   32

◆ CONV__EILSEQ

#define CONV__EILSEQ   (1<<9)

◆ CONV_DECOMPOSE

#define CONV_DECOMPOSE   (1<<7)

◆ CONV_ESCAPEDOTS

#define CONV_ESCAPEDOTS   (1<<2)

◆ CONV_ESCAPEHEX

#define CONV_ESCAPEHEX   (1<<1)

◆ CONV_FORCE

#define CONV_FORCE   (1<<8)

◆ CONV_IGNORE

#define CONV_IGNORE   (1<<0)

◆ CONV_PRECOMPOSE

#define CONV_PRECOMPOSE   (1<<6)

◆ CONV_REQESCAPE

#define CONV_REQESCAPE   (1<<15)

◆ CONV_REQMANGLE

#define CONV_REQMANGLE   (1<<14)

◆ CONV_TOLOWER

#define CONV_TOLOWER   (1<<5)

◆ CONV_TOUPPER

#define CONV_TOUPPER   (1<<4)

◆ CONV_UNESCAPEHEX

#define CONV_UNESCAPEHEX   (1<<3)

◆ EILSEQ

#define EILSEQ   84 /* Illegal byte sequence. */

◆ IGNORE_CHAR

#define IGNORE_CHAR   '_'

◆ NUM_CHARSETS

#define NUM_CHARSETS   5

◆ SAFE_FREE

#define SAFE_FREE ( x)
Value:
do { if ((x) != NULL) {free(x); x=NULL;} } while(0)

◆ ucs2_t

#define ucs2_t   uint16_t

Enumeration Type Documentation

◆ charset_t

enum charset_t
Enumerator
CH_UCS2 
CH_UTF8 
CH_MAC 
CH_UNIX 
CH_UTF8_MAC 

Function Documentation

◆ add_charset()

charset_t add_charset ( const char * name)
extern

◆ atalk_iconv()

size_t atalk_iconv ( atalk_iconv_t cd,
const char ** inbuf,
size_t * inbytesleft,
char ** outbuf,
size_t * outbytesleft )
extern

This is a simple portable iconv() implementaion.

It only knows about a very small number of character sets - just enough that netatalk works on systems that don't have iconv.

◆ atalk_iconv_close()

int atalk_iconv_close ( atalk_iconv_t cd)
extern

◆ atalk_iconv_open()

atalk_iconv_t atalk_iconv_open ( const char * tocode,
const char * fromcode )
extern

◆ atalk_register_charset()

int atalk_register_charset ( struct charset_functions * funcs)
extern

◆ charset_decompose()

size_t charset_decompose ( charset_t ch,
char * src,
size_t inlen,
char * dst,
size_t outlen )
extern

◆ charset_precompose()

size_t charset_precompose ( charset_t ch,
char * src,
size_t inlen,
char * dst,
size_t outlen )
extern

◆ charset_strlower()

size_t charset_strlower ( charset_t ch,
const char * src,
size_t srclen,
char * dest,
size_t destlen )
extern

◆ charset_strupper()

size_t charset_strupper ( charset_t ch,
const char * src,
size_t srclen,
char * dest,
size_t destlen )
extern

◆ convert_charset()

size_t convert_charset ( charset_t from_set,
charset_t to_set,
charset_t cap_charset,
const char * src,
size_t src_len,
char * dest,
size_t dest_len,
uint16_t * flags )
extern

◆ convert_string()

size_t convert_string ( charset_t from,
charset_t to,
void const * src,
size_t srclen,
void * dest,
size_t destlen )
extern

◆ convert_string_allocate()

size_t convert_string_allocate ( charset_t from,
charset_t to,
void const * src,
size_t srclen,
char ** dest )
extern

◆ decompose_w()

size_t decompose_w ( ucs2_t * name,
size_t inplen,
ucs2_t * comp,
size_t * outlen )
extern

◆ find_charset_functions()

struct charset_functions * find_charset_functions ( const char * name)
extern

◆ free_charset_names()

void free_charset_names ( void )
extern

◆ init_iconv()

void init_iconv ( void )
extern

Initialize iconv conversion descriptors.

This is called the first time it is needed, and also called again every time the configuration is reloaded, because the charset or codepage might have changed.

◆ islower_w()

int islower_w ( ucs2_t c)
extern

◆ isupper_w()

int isupper_w ( ucs2_t c)
extern

◆ precompose_w()

size_t precompose_w ( ucs2_t * name,
size_t inplen,
ucs2_t * comp,
size_t * outlen )
extern

◆ set_charset_name()

int set_charset_name ( charset_t ch,
const char * name )
extern

◆ strcasechr_w()

ucs2_t * strcasechr_w ( const ucs2_t * s,
ucs2_t c )
extern

◆ strcasecmp_w()

int strcasecmp_w ( const ucs2_t * a,
const ucs2_t * b )
extern

◆ strcasestr_w()

ucs2_t * strcasestr_w ( const ucs2_t * s,
const ucs2_t * ins )
extern

◆ strcat_w()

ucs2_t * strcat_w ( ucs2_t * dest,
const ucs2_t * src )
extern

◆ strchr_w()

ucs2_t * strchr_w ( const ucs2_t * s,
ucs2_t c )
extern

◆ strcmp_w()

int strcmp_w ( const ucs2_t * a,
const ucs2_t * b )
extern

◆ strdup_w()

ucs2_t * strdup_w ( const ucs2_t * src)
extern

◆ strlen_w()

size_t strlen_w ( const ucs2_t * src)
extern

◆ strlower_w()

int strlower_w ( ucs2_t * s)
extern

◆ strncasecmp_w()

int strncasecmp_w ( const ucs2_t * a,
const ucs2_t * b,
size_t len )
extern

◆ strncat_w()

ucs2_t * strncat_w ( ucs2_t * dest,
const ucs2_t * src,
const size_t max )
extern

◆ strncmp_w()

int strncmp_w ( const ucs2_t * a,
const ucs2_t * b,
size_t len )
extern

◆ strncpy_w()

ucs2_t * strncpy_w ( ucs2_t * dest,
const ucs2_t * src,
const size_t max )
extern

◆ strndup_w()

ucs2_t * strndup_w ( const ucs2_t * src,
size_t len )
extern

◆ strnlen_w()

size_t strnlen_w ( const ucs2_t * src,
size_t max )
extern

◆ strstr_w()

ucs2_t * strstr_w ( const ucs2_t * s,
const ucs2_t * ins )
extern

◆ strupper_w()

int strupper_w ( ucs2_t * s)
extern

◆ tolower_sp()

uint32_t tolower_sp ( uint32_t val)
extern

◆ tolower_w()

ucs2_t tolower_w ( ucs2_t val)
extern

◆ toupper_sp()

uint32_t toupper_sp ( uint32_t val)
extern

◆ toupper_w()

ucs2_t toupper_w ( ucs2_t val)
extern

◆ ucs2_to_charset()

size_t ucs2_to_charset ( charset_t ch,
const ucs2_t * src,
char * dest,
size_t destlen )
extern

Copy a string from a UCS2 src to a unix char * destination, allocating a buffer

Parameters
destalways set at least to NULL
Returns
The number of bytes occupied by the string in the destination

◆ ucs2_to_charset_allocate()

size_t ucs2_to_charset_allocate ( charset_t ch,
char ** dest,
const ucs2_t * src )
extern