1 /* 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/ 6 * 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. 11 * 12 * The Original Code is Mozilla Communicator client code, released 13 * March 31, 1998. 14 * 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 18 * Rights Reserved. 19 * 20 * Contributor(s): 21 */ 22 23 /* 24 * LDAP tools fileurl.h -- defines for file URL functions. 25 * Used by ldapmodify. 26 */ 27 28 /* 29 * ldaptool_fileurl2path() convert a file URL to a local path. 30 * 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. 34 */ 35 int ldaptool_fileurl2path( const char *fileurl, char **localpathp ); 36 37 38 /* 39 * Convert a local path to a file URL. 40 * 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. 45 * 46 */ 47 int ldaptool_path2fileurl( char *path, char **urlp ); 48 49 50 /* 51 * Populate *bvp from "value" of length "vlen." 52 * 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 56 * of a file. 57 * 58 * If reporterrs is non-zero, specific error messages are printed to 59 * stderr. 60 * 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. 64 */ 65 int ldaptool_berval_from_ldif_value( const char *value, int vlen, 66 struct berval *bvp, int recognize_url_syntax, int always_try_file, 67 int reporterrs ); 68 69 70 /* 71 * Map an LDAPTOOL_FILEURL_ error code to an LDAP error code (crude). 72 */ 73 int ldaptool_fileurlerr2ldaperr( int lderr ); 74 75 76 /* 77 * Possible return codes for the functions declared in this file: 78 */ 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 85