1 /* Copied from Richard Levitte's (richard@levitte.org) LP library.  All
2  * symbol names have been changed, with permission from the author. */
3 
4 /* $LP: LPlib/source/LPdir.h,v 1.1 2004/06/14 08:56:04 _cvs_levitte Exp $ */
5 /*
6  * Copyright (c) 2004, Richard Levitte <richard@levitte.org>
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGE.
29  */
30 
31 #ifndef OPENSSL_HEADER_DIRECTORY_H
32 #define OPENSSL_HEADER_DIRECTORY_H
33 
34 #include <openssl/base.h>
35 
36 #if defined(__cplusplus)
37 extern "C" {
38 #endif
39 
40 
41 /* Directory functions abstract the O/S specific operations for opening and
42  * reading directories in the filesystem. */
43 
44 
45 /* OPENSSL_dir_context_st is an opaque structure that represents an open
46  * directory and a position in that directory. */
47 typedef struct OPENSSL_dir_context_st OPENSSL_DIR_CTX;
48 
49 /* OPENSSL_DIR_read reads a single filename from |ctx|. On the first call,
50  * |directory| must be given and |*ctx| must be NULL. Subsequent calls with the
51  * same |*ctx| will return subsequent file names until it returns NULL to
52  * indicate EOF. The strings returned reference a buffer internal to the
53  * |OPENSSL_DIR_CTX| and will be overridden by subsequent calls. */
54 OPENSSL_EXPORT const char *OPENSSL_DIR_read(OPENSSL_DIR_CTX **ctx,
55                                             const char *directory);
56 
57 /* OPENSSL_DIR_end closes |*ctx|. It returns one on success and zero on
58  * error. */
59 OPENSSL_EXPORT int OPENSSL_DIR_end(OPENSSL_DIR_CTX **ctx);
60 
61 
62 #if defined(__cplusplus)
63 }  /* extern C */
64 #endif
65 
66 #endif  /* OPENSSL_HEADER_DIRECTORY_H */
67