1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 /* 27 * Support for oem <-> unicode translations. 28 */ 29 30 #ifndef _SMBSRV_OEM_H 31 #define _SMBSRV_OEM_H 32 33 #pragma ident "@(#)oem.h 1.1 07/10/25 SMI" 34 35 #include <smbsrv/smb_i18n.h> 36 37 #ifdef __cplusplus 38 extern "C" { 39 #endif 40 41 #define oem_default_smb_cpid OEM_CP_IND_850 42 #define oem_default_telnet_cpid OEM_CP_IND_1252 43 #define oem_default_language "english" 44 45 /* 46 * The id should corresponds to oemcp_table in os/library/oem.c. 47 */ 48 typedef enum codepage_id { 49 OEM_CP_IND_850 = 0, 50 OEM_CP_IND_950, 51 OEM_CP_IND_1252, 52 OEM_CP_IND_949, 53 OEM_CP_IND_936, 54 OEM_CP_IND_932, 55 OEM_CP_IND_852, 56 OEM_CP_IND_1250, 57 OEM_CP_IND_1253, 58 OEM_CP_IND_737, 59 OEM_CP_IND_1254, 60 OEM_CP_IND_857, 61 OEM_CP_IND_1251, 62 OEM_CP_IND_866, 63 OEM_CP_IND_1255, 64 OEM_CP_IND_862, 65 OEM_CP_IND_1256, 66 OEM_CP_IND_720, 67 NO_OF_OEM_CP_INDS 68 } codepage_id_t; 69 70 71 typedef struct language { 72 char *language; 73 unsigned int smbIndex; 74 unsigned int telnetIndex; 75 } language; 76 77 78 /* 79 * cpid = the cpid of the oemcp_table that oempage_t belong to. 80 * value = the conversion values 81 */ 82 typedef struct oempage_t { 83 unsigned int cpid; 84 mts_wchar_t *value; 85 } oempage_t; 86 87 /* 88 * Private functions for opmlang.c 89 */ 90 extern int oem_codepage_init(unsigned int); 91 extern void oem_codepage_free(unsigned int); 92 extern language *oem_get_lang_table(void); 93 extern int oem_no_of_languages(void); 94 #define NO_OF_LANGUAGES oem_no_of_languages() 95 96 /* 97 * Public functions 98 */ 99 extern size_t unicodestooems(char *, const mts_wchar_t *, size_t, unsigned int); 100 extern size_t oemstounicodes(mts_wchar_t *, const char *, size_t, unsigned int); 101 102 #ifdef __cplusplus 103 } 104 #endif 105 106 #endif /* _SMBSRV_OEM_H */ 107