1/* $NetBSD: dir.h,v 1.5 2024/02/21 22:51:48 christos Exp $ */ 2 3/* 4 * Copyright (C) Internet Systems Consortium, Inc. ("ISC") 5 * 6 * SPDX-License-Identifier: MPL-2.0 7 * 8 * This Source Code Form is subject to the terms of the Mozilla Public 9 * License, v. 2.0. If a copy of the MPL was not distributed with this 10 * file, you can obtain one at https://mozilla.org/MPL/2.0/. 11 */ 12 13#pragma once 14 15#include <dirent.h> 16#include <sys/types.h> 17 18#include <dlz_minimal.h> 19 20#define DIR_NAMEMAX 256 21#define DIR_PATHMAX 1024 22 23typedef struct direntry { 24 char name[DIR_NAMEMAX]; 25 unsigned int length; 26} direntry_t; 27 28typedef struct dir { 29 char dirname[DIR_PATHMAX]; 30 direntry_t entry; 31 DIR *handle; 32} dir_t; 33 34void 35dir_init(dir_t *dir); 36 37isc_result_t 38dir_open(dir_t *dir, const char *dirname); 39 40isc_result_t 41dir_read(dir_t *dir); 42 43isc_result_t 44dir_reset(dir_t *dir); 45 46void 47dir_close(dir_t *dir); 48