1 /* $NetBSD: dir.h,v 1.1.1.1 2009/12/13 16:54:47 kardel Exp $ */ 2 3 /* 4 * Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC") 5 * Copyright (C) 1999-2001 Internet Software Consortium. 6 * 7 * Permission to use, copy, modify, and/or distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 13 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 16 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 /* Id: dir.h,v 1.15 2007/06/19 23:47:20 tbox Exp */ 21 22 /* Principal Authors: DCL */ 23 24 #ifndef ISC_DIR_H 25 #define ISC_DIR_H 1 26 27 #include <windows.h> 28 #include <stdlib.h> 29 30 #include <isc/lang.h> 31 #include <isc/boolean.h> 32 #include <isc/result.h> 33 34 #define ISC_DIR_NAMEMAX _MAX_FNAME 35 #define ISC_DIR_PATHMAX _MAX_PATH 36 37 typedef struct { 38 char name[ISC_DIR_NAMEMAX]; 39 unsigned int length; 40 WIN32_FIND_DATA find_data; 41 } isc_direntry_t; 42 43 typedef struct { 44 unsigned int magic; 45 char dirname[ISC_DIR_PATHMAX]; 46 isc_direntry_t entry; 47 isc_boolean_t entry_filled; 48 HANDLE search_handle; 49 } isc_dir_t; 50 51 ISC_LANG_BEGINDECLS 52 53 void 54 isc_dir_init(isc_dir_t *dir); 55 56 isc_result_t 57 isc_dir_open(isc_dir_t *dir, const char *dirname); 58 59 isc_result_t 60 isc_dir_read(isc_dir_t *dir); 61 62 isc_result_t 63 isc_dir_reset(isc_dir_t *dir); 64 65 void 66 isc_dir_close(isc_dir_t *dir); 67 68 isc_result_t 69 isc_dir_chdir(const char *dirname); 70 71 isc_result_t 72 isc_dir_chroot(const char *dirname); 73 74 isc_result_t 75 isc_dir_createunique(char *templet); 76 /* 77 * Use a templet (such as from isc_file_mktemplate()) to create a uniquely 78 * named, empty directory. The templet string is modified in place. 79 * If result == ISC_R_SUCCESS, it is the name of the directory that was 80 * created. 81 */ 82 83 ISC_LANG_ENDDECLS 84 85 #endif /* ISC_DIR_H */ 86