xref: /titanic_44/usr/src/cmd/ssh/include/g11n.h (revision 6f786ace10b9c0c7c5515e525fb660fbccfda6a3)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
532f863ecSjp161948  * Common Development and Distribution License (the "License").
632f863ecSjp161948  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  *
21*6f786aceSNobutomo Nakano  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
227c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
237c478bd9Sstevel@tonic-gate  */
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate #ifndef	_G11N_H
267c478bd9Sstevel@tonic-gate #define	_G11N_H
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate #ifdef __cplusplus
297c478bd9Sstevel@tonic-gate extern "C" {
307c478bd9Sstevel@tonic-gate #endif
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #include "includes.h"
347c478bd9Sstevel@tonic-gate #include <sys/types.h>
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate /*
377c478bd9Sstevel@tonic-gate  * Functions for language tag negotiation
387c478bd9Sstevel@tonic-gate  */
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /* boolean */
4132f863ecSjp161948 uint_t g11n_langtag_is_default(char *langtag);
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate /* return 0 if not, 1 if yes, 2 if the country is matched too */
4432f863ecSjp161948 uint_t g11n_langtag_matches_locale(char *langtag, char *locale);
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate /* get current locale */
477c478bd9Sstevel@tonic-gate char *g11n_getlocale();
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate /* get current locale */
507c478bd9Sstevel@tonic-gate void g11n_setlocale(int category, const char *locale);
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate /* get list of locales - returns pointer to array of pointers to char */
537c478bd9Sstevel@tonic-gate char **g11n_getlocales();
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate /* get list of langs spoken by the user, from SSH_LANGS env var */
567c478bd9Sstevel@tonic-gate char *g11n_getlangs();
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate /* make a comma-separated list of language tags from list of locales */
597c478bd9Sstevel@tonic-gate char *g11n_locales2langs(char **locale_set);
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate int g11n_langtag_match(char *langtag1, char *langtag2);
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate /* intersect comma-separated lists of IETF language tags */
647c478bd9Sstevel@tonic-gate char *g11n_langtag_set_intersect(char *set1, char *set2);
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate char *g11n_clnt_langtag_negotiate(char *clnt_langtags, char *srvr_langtags);
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate char **g11n_langtag_set_locale_set_intersect(char *langtag_set,
697c478bd9Sstevel@tonic-gate     char **locale_set);
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate char *g11n_srvr_locale_negotiate(char *clnt_langtags, char **srvr_locales);
727c478bd9Sstevel@tonic-gate 
739a8058b5Sjp161948 /* auxiliary functions */
749a8058b5Sjp161948 void g11n_freelist(char **list);
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate /*
777c478bd9Sstevel@tonic-gate  * Functions for converting to ASCII or UTF-8 from the local codeset
787c478bd9Sstevel@tonic-gate  * Functions for converting from ASCII or UTF-8 to the local codeset
797c478bd9Sstevel@tonic-gate  *
807c478bd9Sstevel@tonic-gate  * The error_str parameter is an optional pointer to a char variable
817c478bd9Sstevel@tonic-gate  * where to store a string suitable for use with error() or fatal() or
827c478bd9Sstevel@tonic-gate  * friends.
837c478bd9Sstevel@tonic-gate  *
847c478bd9Sstevel@tonic-gate  */
85*6f786aceSNobutomo Nakano extern char *g11n_convert_from_utf8(const char *str, uint_t *lenp,
86*6f786aceSNobutomo Nakano 				char **error_str);
877c478bd9Sstevel@tonic-gate 
88*6f786aceSNobutomo Nakano extern char *g11n_convert_to_utf8(const char *str, uint_t *lenp, int native,
89*6f786aceSNobutomo Nakano 				char **error_str);
907c478bd9Sstevel@tonic-gate 
91*6f786aceSNobutomo Nakano extern char *g11n_filter_string(char *);
92*6f786aceSNobutomo Nakano extern void g11n_test_langtag(const char *, int);
9332f863ecSjp161948 
947c478bd9Sstevel@tonic-gate #ifdef __cplusplus
957c478bd9Sstevel@tonic-gate }
967c478bd9Sstevel@tonic-gate #endif
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate #endif /* _G11N_H */
99