2 * The contents of this file are subject to the Netscape Public
3 * License Version 1.1 (the "License"); you may not use this file
4 * except in compliance with the License. You may obtain a copy of
5 * the License at http://www.mozilla.org/NPL/
7 * Software distributed under the License is distributed on an "AS
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9 * implied. See the License for the specific language governing
10 * rights and limitations under the License.
12 * The Original Code is Mozilla Communicator client code, released
15 * The Initial Developer of the Original Code is Netscape
16 * Communications Corporation. Portions created by Netscape are
17 * Copyright (C) 1998-1999 Netscape Communications Corporation. All
24 * LDAP tools fileurl.h -- defines for file URL functions.
29 * ldaptool_fileurl2path() convert a file URL to a local path.
31 * If successful, LDAPTOOL_FILEURL_SUCCESS is returned and *localpathp is
32 * set point to an allocated string. If not, a different LDAPTOOL_FILEURL_
33 * error code is returned.
35 int ldaptool_fileurl2path( const char *fileurl
, char **localpathp
);
39 * Convert a local path to a file URL.
41 * If successful, LDAPTOOL_FILEURL_SUCCESS is returned and *urlp is
42 * set point to an allocated string. If not, a different LDAPTOOL_FILEURL_
43 * error code is returned. At present, the only possible error is
44 * LDAPTOOL_FILEURL_NOMEMORY.
47 int ldaptool_path2fileurl( char *path
, char **urlp
);
51 * Populate *bvp from "value" of length "vlen."
53 * If recognize_url_syntax is non-zero, :<fileurl is recognized.
54 * If always_try_file is recognized and no file URL was found, an
55 * attempt is made to stat and read the value as if it were the name
58 * If reporterrs is non-zero, specific error messages are printed to
61 * If successful, LDAPTOOL_FILEURL_SUCCESS is returned and bvp->bv_len
62 * and bvp->bv_val are set (the latter is set to malloc'd memory).
63 * Upon failure, a different LDAPTOOL_FILEURL_ error code is returned.
65 int ldaptool_berval_from_ldif_value( const char *value
, int vlen
,
66 struct berval
*bvp
, int recognize_url_syntax
, int always_try_file
,
71 * Map an LDAPTOOL_FILEURL_ error code to an LDAP error code (crude).
73 int ldaptool_fileurlerr2ldaperr( int lderr
);
77 * Possible return codes for the functions declared in this file:
79 #define LDAPTOOL_FILEURL_SUCCESS 0
80 #define LDAPTOOL_FILEURL_NOTAFILEURL 1
81 #define LDAPTOOL_FILEURL_MISSINGPATH 2
82 #define LDAPTOOL_FILEURL_NONLOCAL 3
83 #define LDAPTOOL_FILEURL_NOMEMORY 4
84 #define LDAPTOOL_FILEURL_FILEIOERROR 5