4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2001-2003 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
30 #include "ldap_structs.h"
42 #define NIL(s) (((s) != 0) ? (s) : "<nil>")
43 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
47 #define MSG_NOTIMECHECK 0
49 #define MSG_MEMPARAM 2
52 #define MSG_INVALIDDELDISP 5
53 #define MSG_NORULEVALUE 6
54 #define MSG_NONPCOLDSTART 7
55 #define MSG_VLV_INSUFF_ACC 8
58 /* Error numbers (NPL is NisPlusLdap) */
62 #define NPL_BERENCODE 3
63 #define NPL_BERDECODE 4
65 /* Structure used to maintain a buffer with a length */
71 /* Generic print buffer */
72 extern __nis_buffer_t pb
;
74 /* Deferred error reporting buffer (TSD) */
78 } __nis_deferred_error_t
;
80 /* Exported symbols */
81 extern unsigned long numMisaligned
;
83 /* Exported functions */
84 void logmsg(int msgtype
, int priority
, const char *fmt
, ...);
85 void reportError(int error
, char *fmt
, ...);
86 int getError(char **message
);
87 void clearError(void);
88 void logError(int priority
);
89 void *am(const char *msg
, int size
);
90 int slen(const char *str
);
91 char *sdup(const char *msg
, int allocate
, char *str
);
92 char *scat(const char *msg
, int deallocate
, char *s1
, char *s2
);
93 void sfree(void *ptr
);
94 char lastChar(__nis_single_value_t
*v
);
95 void *appendString2SingleVal(char *str
, __nis_single_value_t
*v
,
97 int scmp(char *s
, __nis_single_value_t
*v
);
98 int scasecmp(char *s
, __nis_single_value_t
*v
);
99 int vp2buf(const char *msg
, char **buf
, int buflen
, const char *fmt
,
101 void p2buf(char *msg
, char *fmt
, ...);
102 void bp2buf(const char *msg
, __nis_buffer_t
*b
, const char *fmt
, ...);
103 void bc2buf(const char *msg
, void *buf
, int len
, __nis_buffer_t
*b
);
104 void sbc2buf(const char *msg
, void *buf
, int len
, __nis_buffer_t
*b
);
105 void c2buf(char *msg
, void *buf
, int len
);
106 void sc2buf(char *msg
, void *buf
, int len
);
108 void *extendArray(void *array
, int newsize
);
109 int checkIPaddress(char *addr
, int len
, char **newaddr
);
110 int sstrncmp(const char *s1
, const char *s2
, int n
);
111 char *trimWhiteSpaces(char *str
, int *len
, int deallocate
);
112 int escapeSpecialChars(__nis_value_t
*val
);
113 void removeEscapeChars(__nis_value_t
*val
);
118 #endif /* __cplusplus */
120 #endif /* _LDAP_UTIL_H */