Prepare to support gss authentication and idmap looks for nfsv4
[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_GSS,
23         MCL_MAXTYPES
24 };
25
26 typedef struct mclient {
27         struct mclient *        m_next;
28         char                    m_hostname[NFSCLNT_IDMAX+1];
29         int                     m_type;
30         int                     m_naddr;
31         struct in_addr          m_addrlist[NFSCLNT_ADDRMAX];
32         int                     m_exported;     /* exported to nfsd */
33         int                     m_count;
34 } nfs_client;
35
36 typedef struct mexport {
37         struct mexport *        m_next;
38         struct mclient *        m_client;
39         struct exportent        m_export;
40         int                     m_exported;     /* known to knfsd. -1 means not sure */
41         int                     m_xtabent  : 1, /* xtab entry exists */
42                                 m_mayexport: 1, /* derived from xtabbed */
43                                 m_changed  : 1; /* options (may) have changed */
44 } nfs_export;
45
46 extern nfs_client *             clientlist[MCL_MAXTYPES];
47 extern nfs_export *             exportlist[MCL_MAXTYPES];
48
49 nfs_client *                    client_lookup(char *hname, int canonical);
50 nfs_client *                    client_find(struct hostent *);
51 void                            client_add(nfs_client *);
52 nfs_client *                    client_dup(nfs_client *, struct hostent *);
53 int                             client_gettype(char *hname);
54 int                             client_check(nfs_client *, struct hostent *);
55 int                             client_match(nfs_client *, char *hname);
56 void                            client_release(nfs_client *);
57 void                            client_freeall(void);
58 char *                          client_compose(struct in_addr addr);
59 int                             client_member(char *client, char *name);
60
61 int                             export_read(char *fname);
62 void                            export_add(nfs_export *);
63 void                            export_reset(nfs_export *);
64 nfs_export *                    export_lookup(char *hname, char *path, int caconical);
65 nfs_export *                    export_find(struct hostent *, char *path);
66 nfs_export *                    export_allowed(struct hostent *, char *path);
67 nfs_export *                    export_create(struct exportent *, int canonical);
68 nfs_export *                    export_dup(nfs_export *, struct hostent *);
69 void                            export_freeall(void);
70 int                             export_export(nfs_export *);
71 int                             export_unexport(nfs_export *);
72
73 int                             xtab_mount_read(void);
74 int                             xtab_export_read(void);
75 int                             xtab_mount_write(void);
76 int                             xtab_export_write(void);
77 void                            xtab_append(nfs_export *);
78
79 int                             rmtab_read(void);
80
81 struct nfskey *                 key_lookup(char *hname);
82
83 /* Record export error.  */
84 extern int export_errno;
85
86 #endif /* EXPORTFS_H */