Initial revision
[nfs-utils.git] / support / include / exportfs.h
1 /*
2  * support/include/exportfs.h
3  *
4  * Declarations for exportfs and mountd
5  *
6  * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
7  */
8
9 #ifndef EXPORTFS_H
10 #define EXPORTFS_H
11
12 #include <netdb.h>
13 #include "nfslib.h"
14
15 enum {
16         MCL_FQDN = 0,
17         MCL_SUBNETWORK,
18         MCL_IPADDR = MCL_SUBNETWORK,
19         MCL_WILDCARD,
20         MCL_NETGROUP,
21         MCL_ANONYMOUS,
22         MCL_MAXTYPES
23 };
24
25 typedef struct mclient {
26         struct mclient *        m_next;
27         char                    m_hostname[NFSCLNT_IDMAX+1];
28         int                     m_type;
29         int                     m_naddr;
30         struct in_addr          m_addrlist[NFSCLNT_ADDRMAX];
31         int                     m_exported;     /* exported to nfsd */
32         int                     m_count;
33 } nfs_client;
34
35 typedef struct mexport {
36         struct mexport *        m_next;
37         struct mclient *        m_client;
38         struct exportent        m_export;
39         int                     m_exported : 1, /* known to knfsd */
40                                 m_xtabent  : 1, /* xtab entry exists */
41                                 m_mayexport: 1, /* derived from xtabbed */
42                                 m_changed  : 1; /* options (may) have changed */
43 } nfs_export;
44
45 extern nfs_client *             clientlist[MCL_MAXTYPES];
46 extern nfs_export *             exportlist[MCL_MAXTYPES];
47
48 nfs_client *                    client_lookup(char *hname);
49 nfs_client *                    client_find(struct hostent *);
50 void                            client_add(nfs_client *);
51 nfs_client *                    client_dup(nfs_client *, struct hostent *);
52 int                             client_gettype(char *hname);
53 int                             client_check(nfs_client *, struct hostent *);
54 int                             client_match(nfs_client *, char *hname);
55 void                            client_release(nfs_client *);
56 void                            client_freeall(void);
57
58 int                             export_read(char *fname);
59 void                            export_add(nfs_export *);
60 void                            export_reset(nfs_export *);
61 nfs_export *                    export_lookup(char *hname, char *path);
62 nfs_export *                    export_find(struct hostent *, char *path);
63 struct exportent *              export_allowed(struct hostent *, char *path);
64 nfs_export *                    export_create(struct exportent *);
65 nfs_export *                    export_dup(nfs_export *, struct hostent *);
66 void                            export_freeall(void);
67 int                             export_export(nfs_export *);
68 int                             export_unexport(nfs_export *);
69
70 int                             xtab_mount_read(void);
71 int                             xtab_export_read(void);
72 int                             xtab_mount_write(void);
73 int                             xtab_export_write(void);
74 void                            xtab_append(nfs_export *);
75
76 int                             rmtab_read(void);
77
78 struct nfskey *                 key_lookup(char *hname);
79
80 #endif /* EXPORTFS_H */