xref: /illumos-gate/usr/src/man/man3ldap/ldap_charset.3ldap (revision 14b24e2b79293068c8e016a69ef1d872fb5e2fd5)
te
Copyright (C) 1990, Regents of the University of Michigan. All Rights Reserved.
Portions Copyright (C) 2002, Sun Microsystems, Inc. All Rights Reserved.
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
LDAP_CHARSET 3LDAP "Jan 27, 2002"
NAME
ldap_charset, ldap_set_string_translators, ldap_t61_to_8859, ldap_8859_to_t61, ldap_translate_from_t61, ldap_translate_to_t61, ldap_enable_translation - LDAP character set translation functions
SYNOPSIS

cc[ flag... ] file... -lldap[ library... ]
#include <lber.h>
#include <ldap.h>

void ldap_set_string_translators(LDAP *ld,
 BERTranslateProc encode_proc, BERTranslateProc decodeproc);

typedef int(*BERTranslateProc)(char **bufp, unsigned long *buflenp,
 int free_input);

int ldap_t61_to_8859(char **bufp, unsigned long *buflenp,
 int free_input);

int ldap_8859_to_t61(char **bufp, unsigned long *buflenp,
 int free_input);

int ldap_translate_from_t61(LDAP *ld, char **bufp,
 unsigned long *lenp, int free_input);

int ldap_translate_to_t61(LDAP *ld, char **bufp, unsigned long *lenp,
 int free_input);

void ldap_enable_translation(LDAP *ld, LDAPMessage *entry, int enable);
DESCRIPTION

These functions are used to used to enable translation of character strings used in the LDAP library to and from the T.61 character set used in the LDAP protocol. These functions are only available if the LDAP and LBER libraries are compiled with STR_TRANSLATION defined. It is also possible to turn on character translation by default so that all LDAP library callers will experience translation; see the LDAP Make-common source file for details.

ldap_set_string_translators() sets the translation functions that will be used by the LDAP library. They are not actually used until the ld_lberoptions field of the LDAP structure is set to include the LBER_TRANSLATE_STRINGS option.

ldap_t61_to_8859() and ldap_8859_to_t61() are translation functions for converting between T.61 characters and ISO-8859 characters. The specific 8859 character set used is determined at compile time.

ldap_translate_from_t61() is used to translate a string of characters from the T.61 character set to a different character set. The actual translation is done using the decode_proc that was passed to a previous call to ldap_set_string_translators(). On entry, *bufp should point to the start of the T.61 characters to be translated and *lenp should contain the number of bytes to translate. If free_input is non-zero, the input buffer will be freed if translation is a success. If the translation is a success, LDAP_SUCCESS will be returned, *bufp will point to a newly malloc'd buffer that contains the translated characters, and *lenp will contain the length of the result. If translation fails, an LDAP error code will be returned.

ldap_translate_to_t61() is used to translate a string of characters to the T.61 character set from a different character set. The actual translation is done using the encode_proc that was passed to a previous call to ldap_set_string_translators(). This function is called just like ldap_translate_from_t61().

ldap_enable_translation() is used to turn on or off string translation for the LDAP entry entry (typically obtained by calling ldap_first_entry() or ldap_next_entry() after a successful LDAP search operation). If enable is zero, translation is disabled; if non-zero, translation is enabled. This function is useful if you need to ensure that a particular attribute is not translated when it is extracted using ldap_get_values() or ldap_get_values_len(). For example, you would not want to translate a binary attributes such as jpegPhoto.

ATTRIBUTES

See attributes(5) for a description of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
Interface Stability Evolving
SEE ALSO

ldap(3LDAP), attributes(5)