2 * Copyright 2009 Oracle. All rights reserved.
4 * This file is part of nfs-utils.
6 * nfs-utils is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * nfs-utils is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with nfs-utils. If not, see <http://www.gnu.org/licenses/>.
24 #ifndef NFS_UTILS_SUPPORT_NSM_H
25 #define NFS_UTILS_SUPPORT_NSM_H
27 #include <sys/types.h>
28 #include <sys/socket.h>
37 (*nsm_populate_t)(const char *hostname,
38 const struct sockaddr *sap,
39 const struct mon *mon,
40 const time_t timestamp);
44 extern _Bool nsm_setup_pathnames(const char *progname,
45 const char *parentdir);
46 extern _Bool nsm_is_default_parentdir(void);
47 extern _Bool nsm_drop_privileges(const int pidfd);
49 extern int nsm_get_state(_Bool update);
50 extern void nsm_update_kernel_state(const int state);
53 nsm_retire_monitored_hosts(void);
55 nsm_load_monitor_list(nsm_populate_t func);
57 nsm_load_notify_list(nsm_populate_t func);
59 extern _Bool nsm_insert_monitored_host(const char *hostname,
60 const struct sockaddr *sap, const struct mon *m);
61 extern void nsm_delete_monitored_host(const char *hostname,
62 const char *mon_name, const char *my_name);
63 extern void nsm_delete_notified_host(const char *hostname,
64 const char *mon_name, const char *my_name);
65 extern size_t nsm_priv_to_hex(const char *priv, char *buf,
70 #define NSM_MAXMSGSIZE (2048u)
72 extern uint32_t nsm_xmit_getport(const int sock,
73 const struct sockaddr_in *sin,
74 const unsigned long program,
75 const unsigned long version);
76 extern uint32_t nsm_xmit_getaddr(const int sock,
77 const struct sockaddr_in6 *sin6,
78 const rpcprog_t program, const rpcvers_t version);
79 extern uint32_t nsm_xmit_rpcbind(const int sock, const struct sockaddr *sap,
80 const rpcprog_t program, const rpcvers_t version);
81 extern uint32_t nsm_xmit_notify(const int sock, const struct sockaddr *sap,
82 const socklen_t salen, const rpcprog_t program,
83 const char *mon_name, const int state);
84 extern uint32_t nsm_xmit_nlmcall(const int sock, const struct sockaddr *sap,
85 const socklen_t salen, const struct mon *m,
87 extern uint32_t nsm_parse_reply(XDR *xdrs);
89 nsm_recv_getport(XDR *xdrs);
90 extern uint16_t nsm_recv_getaddr(XDR *xdrs);
91 extern uint16_t nsm_recv_rpcbind(const sa_family_t family, XDR *xdrs);
93 #endif /* !NFS_UTILS_SUPPORT_NSM_H */