xref: /onnv-gate/usr/src/cmd/ssh/include/g11n.h (revision 9600:113cf06ae502)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
52705Sjp161948  * Common Development and Distribution License (the "License").
62705Sjp161948  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  *
21*9600SNobutomo.Nakano@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
220Sstevel@tonic-gate  * Use is subject to license terms.
230Sstevel@tonic-gate  */
240Sstevel@tonic-gate 
250Sstevel@tonic-gate #ifndef	_G11N_H
260Sstevel@tonic-gate #define	_G11N_H
270Sstevel@tonic-gate 
280Sstevel@tonic-gate #ifdef __cplusplus
290Sstevel@tonic-gate extern "C" {
300Sstevel@tonic-gate #endif
310Sstevel@tonic-gate 
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #include "includes.h"
340Sstevel@tonic-gate #include <sys/types.h>
350Sstevel@tonic-gate 
360Sstevel@tonic-gate /*
370Sstevel@tonic-gate  * Functions for language tag negotiation
380Sstevel@tonic-gate  */
390Sstevel@tonic-gate 
400Sstevel@tonic-gate /* boolean */
412705Sjp161948 uint_t g11n_langtag_is_default(char *langtag);
420Sstevel@tonic-gate 
430Sstevel@tonic-gate /* return 0 if not, 1 if yes, 2 if the country is matched too */
442705Sjp161948 uint_t g11n_langtag_matches_locale(char *langtag, char *locale);
450Sstevel@tonic-gate 
460Sstevel@tonic-gate /* get current locale */
472705Sjp161948 char *g11n_getlocale();
480Sstevel@tonic-gate 
490Sstevel@tonic-gate /* get current locale */
500Sstevel@tonic-gate void g11n_setlocale(int category, const char *locale);
510Sstevel@tonic-gate 
520Sstevel@tonic-gate /* get list of locales - returns pointer to array of pointers to char */
532705Sjp161948 char **g11n_getlocales();
540Sstevel@tonic-gate 
550Sstevel@tonic-gate /* get list of langs spoken by the user, from SSH_LANGS env var */
562705Sjp161948 char *g11n_getlangs();
570Sstevel@tonic-gate 
580Sstevel@tonic-gate /* make a comma-separated list of language tags from list of locales */
592705Sjp161948 char *g11n_locales2langs(char **locale_set);
600Sstevel@tonic-gate 
610Sstevel@tonic-gate int g11n_langtag_match(char *langtag1, char *langtag2);
620Sstevel@tonic-gate 
630Sstevel@tonic-gate /* intersect comma-separated lists of IETF language tags */
642705Sjp161948 char *g11n_langtag_set_intersect(char *set1, char *set2);
650Sstevel@tonic-gate 
662705Sjp161948 char *g11n_clnt_langtag_negotiate(char *clnt_langtags, char *srvr_langtags);
670Sstevel@tonic-gate 
682705Sjp161948 char **g11n_langtag_set_locale_set_intersect(char *langtag_set,
692705Sjp161948     char **locale_set);
700Sstevel@tonic-gate 
712705Sjp161948 char *g11n_srvr_locale_negotiate(char *clnt_langtags, char **srvr_locales);
720Sstevel@tonic-gate 
735562Sjp161948 /* auxiliary functions */
745562Sjp161948 void g11n_freelist(char **list);
750Sstevel@tonic-gate 
760Sstevel@tonic-gate /*
770Sstevel@tonic-gate  * Functions for converting to ASCII or UTF-8 from the local codeset
780Sstevel@tonic-gate  * Functions for converting from ASCII or UTF-8 to the local codeset
790Sstevel@tonic-gate  *
800Sstevel@tonic-gate  * The error_str parameter is an optional pointer to a char variable
810Sstevel@tonic-gate  * where to store a string suitable for use with error() or fatal() or
820Sstevel@tonic-gate  * friends.
830Sstevel@tonic-gate  *
840Sstevel@tonic-gate  */
85*9600SNobutomo.Nakano@Sun.COM extern char *g11n_convert_from_utf8(const char *str, uint_t *lenp,
86*9600SNobutomo.Nakano@Sun.COM 				char **error_str);
870Sstevel@tonic-gate 
88*9600SNobutomo.Nakano@Sun.COM extern char *g11n_convert_to_utf8(const char *str, uint_t *lenp, int native,
89*9600SNobutomo.Nakano@Sun.COM 				char **error_str);
900Sstevel@tonic-gate 
91*9600SNobutomo.Nakano@Sun.COM extern char *g11n_filter_string(char *);
92*9600SNobutomo.Nakano@Sun.COM extern void g11n_test_langtag(const char *, int);
932705Sjp161948 
940Sstevel@tonic-gate #ifdef __cplusplus
950Sstevel@tonic-gate }
960Sstevel@tonic-gate #endif
970Sstevel@tonic-gate 
980Sstevel@tonic-gate #endif /* _G11N_H */
99