1258945Sroberto/* 2258945Sroberto * Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC") 3258945Sroberto * Copyright (C) 1999-2001 Internet Software Consortium. 4258945Sroberto * 5258945Sroberto * Permission to use, copy, modify, and/or distribute this software for any 6258945Sroberto * purpose with or without fee is hereby granted, provided that the above 7258945Sroberto * copyright notice and this permission notice appear in all copies. 8258945Sroberto * 9258945Sroberto * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 10258945Sroberto * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 11258945Sroberto * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 12258945Sroberto * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13258945Sroberto * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 14258945Sroberto * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15258945Sroberto * PERFORMANCE OF THIS SOFTWARE. 16258945Sroberto */ 17258945Sroberto 18258945Sroberto/* $Id: dir.h,v 1.15 2007/06/19 23:47:20 tbox Exp $ */ 19258945Sroberto 20258945Sroberto/* Principal Authors: DCL */ 21258945Sroberto 22258945Sroberto#ifndef ISC_DIR_H 23258945Sroberto#define ISC_DIR_H 1 24258945Sroberto 25258945Sroberto#include <windows.h> 26258945Sroberto#include <stdlib.h> 27258945Sroberto 28258945Sroberto#include <isc/lang.h> 29258945Sroberto#include <isc/boolean.h> 30258945Sroberto#include <isc/result.h> 31258945Sroberto 32258945Sroberto#define ISC_DIR_NAMEMAX _MAX_FNAME 33258945Sroberto#define ISC_DIR_PATHMAX _MAX_PATH 34258945Sroberto 35258945Srobertotypedef struct { 36258945Sroberto char name[ISC_DIR_NAMEMAX]; 37258945Sroberto unsigned int length; 38258945Sroberto WIN32_FIND_DATA find_data; 39258945Sroberto} isc_direntry_t; 40258945Sroberto 41258945Srobertotypedef struct { 42258945Sroberto unsigned int magic; 43258945Sroberto char dirname[ISC_DIR_PATHMAX]; 44258945Sroberto isc_direntry_t entry; 45258945Sroberto isc_boolean_t entry_filled; 46258945Sroberto HANDLE search_handle; 47258945Sroberto} isc_dir_t; 48258945Sroberto 49258945SrobertoISC_LANG_BEGINDECLS 50258945Sroberto 51258945Srobertovoid 52258945Srobertoisc_dir_init(isc_dir_t *dir); 53258945Sroberto 54258945Srobertoisc_result_t 55258945Srobertoisc_dir_open(isc_dir_t *dir, const char *dirname); 56258945Sroberto 57258945Srobertoisc_result_t 58258945Srobertoisc_dir_read(isc_dir_t *dir); 59258945Sroberto 60258945Srobertoisc_result_t 61258945Srobertoisc_dir_reset(isc_dir_t *dir); 62258945Sroberto 63258945Srobertovoid 64258945Srobertoisc_dir_close(isc_dir_t *dir); 65258945Sroberto 66258945Srobertoisc_result_t 67258945Srobertoisc_dir_chdir(const char *dirname); 68258945Sroberto 69258945Srobertoisc_result_t 70258945Srobertoisc_dir_chroot(const char *dirname); 71258945Sroberto 72258945Srobertoisc_result_t 73258945Srobertoisc_dir_createunique(char *templet); 74258945Sroberto/* 75258945Sroberto * Use a templet (such as from isc_file_mktemplate()) to create a uniquely 76258945Sroberto * named, empty directory. The templet string is modified in place. 77258945Sroberto * If result == ISC_R_SUCCESS, it is the name of the directory that was 78258945Sroberto * created. 79258945Sroberto */ 80258945Sroberto 81258945SrobertoISC_LANG_ENDDECLS 82258945Sroberto 83258945Sroberto#endif /* ISC_DIR_H */ 84