reindent-20030715
[openafs.git] / src / tests / xfiles.h
1 /*
2  * CMUCS AFStools
3  * dumpscan - routines for scanning and manipulating AFS volume dumps
4  *
5  * Copyright (c) 1998 Carnegie Mellon University
6  * All Rights Reserved.
7  * 
8  * Permission to use, copy, modify and distribute this software and its
9  * documentation is hereby granted, provided that both the copyright
10  * notice and this permission notice appear in all copies of the
11  * software, derivative works or modified versions, and any portions
12  * thereof, and that both notices appear in supporting documentation.
13  *
14  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
15  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
16  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17  *
18  * Carnegie Mellon requests users of this software to return to
19  *
20  *  Software Distribution Coordinator  or  Software_Distribution@CS.CMU.EDU
21  *  School of Computer Science
22  *  Carnegie Mellon University
23  *  Pittsburgh PA 15213-3890
24  *
25  * any improvements or extensions that they make and grant Carnegie Mellon
26  * the rights to redistribute these changes.
27  */
28
29 /* xfiles.h - Type, constant, and function declarations for
30  * extensible file-like things */
31
32 #ifndef _XFILES_H_
33 #define _XFILES_H_
34
35 #include <stdio.h>
36 #include <stdarg.h>
37 #include "intNN.h"
38
39 struct rx_call;
40 struct rx_connection;
41
42 /* The XFILE structure */
43 typedef struct XFILE XFILE;
44 struct XFILE {
45     afs_uint32(*do_read) (XFILE *, void *, afs_uint32); /* read data */
46     afs_uint32(*do_write) (XFILE *, void *, afs_uint32);        /* write data */
47     afs_uint32(*do_tell) (XFILE *, u_int64 *);  /* find position */
48     afs_uint32(*do_seek) (XFILE *, u_int64 *);  /* set position */
49     afs_uint32(*do_skip) (XFILE *, afs_uint32); /* skip forward */
50     afs_uint32(*do_close) (XFILE *);    /* close */
51     u_int64 filepos;            /* position (counted) */
52     int is_seekable;            /* 1 if seek works */
53     int is_writable;            /* 1 if write works */
54     XFILE *passthru;            /* XFILE to pass thru to */
55     void *refcon;               /* type-specific data */
56 };
57
58
59 /* Functions for opening XFILEs.  For these, the first two arguments are
60  * always a pointer to an XFILE to fill in, and the mode in which to
61  * open the file.  O_RDONLY and O_RDWR are permitted; O_WRONLY is not.
62  * Other open modes may or may not be used, depending on the object type.
63  * Remaining arguments are a function of the object type
64  */
65 extern afs_uint32 xfopen(XFILE *, int, char *); /* open by TYPE:name */
66 extern afs_uint32 xfopen_path(XFILE *, int, char *, int);       /* open by path   */
67 extern afs_uint32 xfopen_FILE(XFILE *, int, FILE *);    /* open by FILE * */
68 extern afs_uint32 xfopen_fd(XFILE *, int, int); /* open by fd     */
69 extern afs_uint32 xfopen_rxcall(XFILE *, int, struct rx_call *);
70 extern afs_uint32 xfopen_voldump(XFILE *, struct rx_connection *, afs_int32,
71                                  afs_int32, afs_int32);
72 extern afs_uint32 xfopen_profile(XFILE *, int, char *, char *);
73
74 extern afs_uint32 xfregister(char *, afs_uint32(*)(XFILE *, int, char *));
75
76 /* Standard operations on XFILEs */
77 extern afs_uint32 xfread(XFILE *, void *, afs_uint32);  /* read data */
78 extern afs_uint32 xfwrite(XFILE *, void *, afs_uint32); /* write data */
79 extern afs_uint32 xfprintf(XFILE *, char *, ...);       /* formatted */
80 extern afs_uint32 vxfprintf(XFILE *, char *, va_list);  /* formatted VA */
81 extern afs_uint32 xftell(XFILE *, u_int64 *);   /* get position */
82 extern afs_uint32 xfseek(XFILE *, u_int64 *);   /* set position */
83 extern afs_uint32 xfskip(XFILE *, afs_uint32);  /* skip forward */
84 extern afs_uint32 xfpass(XFILE *, XFILE *);     /* set passthru */
85 extern afs_uint32 xfunpass(XFILE *);    /* unset passthru */
86 extern afs_uint32 xfclose(XFILE *);     /* close */
87
88 #endif /* _XFILES_H_ */