windows-more-updates-20030315
[openafs.git] / src / WINNT / client_osi / osifd.h
1 /* 
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 /* Copyright (C) 1994 Cazamar Systems, Inc. */
11
12 #ifndef _OSIFD_H_ENV_
13 #define _OSIFD_H_ENV_ 1
14
15 #ifndef DJGPP
16 #include "dbrpc.h"
17 #endif /* !DJGPP */
18 #include "osiqueue.h"
19
20 struct osi_fd;
21 struct osi_fdType;
22
23 /* operations on a file descriptor */
24 typedef struct osi_fdOps {
25         /* create an object, passed in the type info and returns
26          * the newly created fd.  This is the only function not passed
27          * in the object, since it creates it.
28          */
29         long (*Create)(struct osi_fdType *, struct osi_fd **);
30
31 #ifndef DJGPP
32         /* gets info about the object; fields are type specific, and eventually
33          * self-labelling
34          */
35         long (*GetInfo)(struct osi_fd *, osi_remGetInfoParms_t *);
36 #endif
37
38         /* close an object; frees the storage associated with it */
39         long (*Close)(struct osi_fd *);
40 } osi_fdOps_t;
41
42 /* header structure that must be at the start of all FDs so that we can find
43  * them generically from the network layer by fd number.
44  */
45 typedef struct osi_fd {
46         osi_queue_t q;
47         osi_fdOps_t *opsp;
48         long fd;
49 } osi_fd_t;
50
51 /* represents a specific file descriptor for iterating over all file
52  * descriptor types.
53  */
54 typedef struct osi_typeFD {
55         osi_fd_t fd;                    /* header */
56         struct osi_fdType *curp;        /* type scan is about to return next */
57 } osi_typeFD_t;
58
59 typedef struct osi_fdTypeFormat {
60         struct osi_fdTypeFormat *nextp;
61         char *labelp;
62         long region;
63         long index;
64         long format;
65 } osi_fdTypeFormat_t;
66
67 /* describes type of file descriptor; anyone can register a new one */
68 typedef struct osi_fdType {
69         osi_queue_t q;          /* for threading together so we can find by name */
70         char *namep;            /* name */
71         void *rockp;            /* opaque for type owner */
72         osi_fdOps_t *opsp;      /* operations */
73         osi_fdTypeFormat_t *formatListp;        /* list of formatting info */
74 } osi_fdType_t;
75
76 extern osi_fdType_t *osi_FindFDType(char *);
77
78 extern osi_fdType_t *osi_RegisterFDType(char *, osi_fdOps_t *, void *);
79
80 extern long osi_UnregisterFDType(char *);
81
82 extern osi_AddFDFormatInfo(osi_fdType_t *typep, long region, long index,
83         char *labelp, long format);
84
85 extern osi_InitFD(void);
86
87 extern osi_fd_t *osi_AllocFD(char *);
88
89 extern osi_fd_t *osi_FindFD(long);
90
91 extern osi_CloseFD(osi_fd_t *);
92
93 extern long osi_FDTypeCreate(osi_fdType_t *, osi_fd_t **);
94
95 #ifndef DJGPP
96 extern long osi_FDTypeGetInfo(osi_fd_t *, osi_remGetInfoParms_t *);
97 #endif
98
99 extern long osi_FDTypeClose(osi_fd_t *);
100
101 #endif /* _OSIFD_H_ENV_ */
102