2 * support/include/exportfs.h
4 * Declarations for exportfs and mountd
6 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
20 MCL_IPADDR = MCL_SUBNETWORK,
35 typedef struct mclient {
36 struct mclient * m_next;
40 union nfs_sockaddr m_addrlist[NFSCLNT_ADDRMAX];
41 int m_exported; /* exported to nfsd */
45 static inline const struct sockaddr *
46 get_addrlist(const nfs_client *clp, const int i)
48 return &clp->m_addrlist[i].sa;
51 static inline const struct sockaddr_in *
52 get_addrlist_in(const nfs_client *clp, const int i)
54 return &clp->m_addrlist[i].s4;
57 static inline const struct sockaddr_in6 *
58 get_addrlist_in6(const nfs_client *clp, const int i)
60 return &clp->m_addrlist[i].s6;
64 set_addrlist_in(nfs_client *clp, const int i, const struct sockaddr_in *sin)
66 memcpy(&clp->m_addrlist[i].s4, sin, sizeof(*sin));
70 set_addrlist_in6(nfs_client *clp, const int i, const struct sockaddr_in6 *sin6)
72 memcpy(&clp->m_addrlist[i].s6, sin6, sizeof(*sin6));
76 set_addrlist(nfs_client *clp, const int i, const struct sockaddr *sap)
78 switch (sap->sa_family) {
80 memcpy(&clp->m_addrlist[i].s4, sap, sizeof(struct sockaddr_in));
84 memcpy(&clp->m_addrlist[i].s6, sap, sizeof(struct sockaddr_in6));
90 typedef struct mexport {
91 struct mexport * m_next;
92 struct mclient * m_client;
93 struct exportent m_export;
94 int m_exported; /* known to knfsd. -1 means not sure */
95 int m_xtabent : 1, /* xtab entry exists */
96 m_mayexport: 1, /* derived from xtabbed */
97 m_changed : 1, /* options (may) have changed */
98 m_warned : 1; /* warned about multiple exports
99 * matching one client */
102 #define HASH_TABLE_SIZE 1021
103 #define DEFAULT_TTL (30 * 60)
105 typedef struct _exp_hash_entry {
106 nfs_export * p_first;
110 typedef struct _exp_hash_table {
112 exp_hash_entry entries[HASH_TABLE_SIZE];
115 extern exp_hash_table exportlist[MCL_MAXTYPES];
117 extern nfs_client * clientlist[MCL_MAXTYPES];
119 nfs_client * client_lookup(char *hname, int canonical);
120 nfs_client * client_dup(const nfs_client *clp,
121 const struct addrinfo *ai);
122 int client_gettype(char *hname);
123 int client_check(const nfs_client *clp,
124 const struct addrinfo *ai);
125 void client_release(nfs_client *);
126 void client_freeall(void);
127 char * client_compose(const struct addrinfo *ai);
128 struct addrinfo * client_resolve(const struct sockaddr *sap);
129 int client_member(const char *client,
132 void export_read(char *fname);
133 void export_reset(nfs_export *);
134 nfs_export * export_lookup(char *hname, char *path, int caconical);
135 nfs_export * export_find(const struct addrinfo *ai,
137 nfs_export * export_allowed(const struct addrinfo *ai,
139 nfs_export * export_create(struct exportent *, int canonical);
140 void export_freeall(void);
141 int export_export(nfs_export *);
142 int export_unexport(nfs_export *);
144 int xtab_mount_read(void);
145 int xtab_export_read(void);
146 int xtab_mount_write(void);
147 int xtab_export_write(void);
148 void xtab_append(nfs_export *);
150 int secinfo_addflavor(struct flav_info *, struct exportent *);
152 char * host_ntop(const struct sockaddr *sap,
153 char *buf, const size_t buflen);
155 struct addrinfo * host_pton(const char *paddr);
157 struct addrinfo * host_addrinfo(const char *hostname);
159 char * host_canonname(const struct sockaddr *sap);
161 struct addrinfo * host_reliable_addrinfo(const struct sockaddr *sap);
163 struct addrinfo * host_numeric_addrinfo(const struct sockaddr *sap);
165 int rmtab_read(void);
167 struct nfskey * key_lookup(char *hname);
169 struct export_features {
171 unsigned int secinfo_flags;
174 struct export_features *get_export_features(void);
176 /* Record export error. */
177 extern int export_errno;
179 #endif /* EXPORTFS_H */