summaryrefslogtreecommitdiffstats
path: root/support/include/exportfs.h
blob: 470b2ec1cb74a0f4183ec326b9a95d48f5f10035 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
 * support/include/exportfs.h
 *
 * Declarations for exportfs and mountd
 *
 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
 */

#ifndef EXPORTFS_H
#define EXPORTFS_H

#include <netdb.h>
#include "nfslib.h"

enum {
	MCL_FQDN = 0,
	MCL_SUBNETWORK,
	MCL_IPADDR = MCL_SUBNETWORK,
	MCL_WILDCARD,
	MCL_NETGROUP,
	MCL_ANONYMOUS,
	MCL_GSS,
	MCL_MAXTYPES
};

enum {
	FSLOC_NONE = 0,
	FSLOC_REFER,
	FSLOC_REPLICA,
	FSLOC_STUB
};

typedef struct mclient {
	struct mclient *	m_next;
	char *			m_hostname;
	int			m_type;
	int			m_naddr;
	struct in_addr		m_addrlist[NFSCLNT_ADDRMAX];
	int			m_exported;	/* exported to nfsd */
	int			m_count;
} nfs_client;

typedef struct mexport {
	struct mexport *	m_next;
	struct mclient *	m_client;
	struct exportent	m_export;
	int			m_exported;	/* known to knfsd. -1 means not sure */
	int			m_xtabent  : 1,	/* xtab entry exists */
				m_mayexport: 1,	/* derived from xtabbed */
				m_changed  : 1, /* options (may) have changed */
				m_warned   : 1; /* warned about multiple exports
						 * matching one client */
} nfs_export;

#define HASH_TABLE_SIZE 1021

typedef struct _exp_hash_entry {
	nfs_export * p_first;
  	nfs_export * p_last;
} exp_hash_entry;

typedef struct _exp_hash_table {
	nfs_export * p_head;
	exp_hash_entry entries[HASH_TABLE_SIZE];
} exp_hash_table;

extern exp_hash_table exportlist[MCL_MAXTYPES];

extern nfs_client *		clientlist[MCL_MAXTYPES];

nfs_client *			client_lookup(char *hname, int canonical);
nfs_client *			client_find(struct hostent *);
void				client_add(nfs_client *);
nfs_client *			client_dup(nfs_client *, struct hostent *);
int				client_gettype(char *hname);
int				client_check(nfs_client *, struct hostent *);
int				client_match(nfs_client *, char *hname);
void				client_release(nfs_client *);
void				client_freeall(void);
char *				client_compose(struct hostent *he);
struct hostent *		client_resolve(struct in_addr addr);
int 				client_member(char *client, char *name);

int				export_read(char *fname);
void			export_add(nfs_export *);
void				export_reset(nfs_export *);
nfs_export *			export_lookup(char *hname, char *path, int caconical);
nfs_export *			export_find(struct hostent *, char *path);
nfs_export *			export_allowed(struct hostent *, char *path);
nfs_export *			export_create(struct exportent *, int canonical);
nfs_export *			export_dup(nfs_export *, struct hostent *);
void				export_freeall(void);
int				export_export(nfs_export *);
int				export_unexport(nfs_export *);

int				xtab_mount_read(void);
int				xtab_export_read(void);
int				xtab_mount_write(void);
int				xtab_export_write(void);
void				xtab_append(nfs_export *);

int				secinfo_addflavor(struct flav_info *, struct exportent *);

int				rmtab_read(void);

struct nfskey *			key_lookup(char *hname);

struct export_features {
	unsigned int flags;
	unsigned int secinfo_flags;
};

struct export_features *get_export_features(void);

/* Record export error.  */
extern int export_errno;

#endif /* EXPORTFS_H */