2 * Copyright (c) 2008 Isilon Inc http://www.isilon.com/
3 * Authors: Doug Rabson <dfr@rabson.org>
4 * Developed with Red Inc: Alfred Perlstein <alfred@freebsd.org>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 MALLOC_DECLARE(M_NLM);
42 * Copy a struct netobj.
44 extern void nlm_copy_netobj(struct netobj *dst, struct netobj *src,
45 struct malloc_type *type);
48 * Search for an existing NLM host that matches the given name
49 * (typically the caller_name element of an nlm4_lock). If none is
50 * found, create a new host. If 'rqstp' is non-NULL, record the remote
51 * address of the host so that we can call it back for async
54 extern struct nlm_host *nlm_find_host_by_name(const char *name,
55 struct svc_req *rqstp);
58 * Search for an existing NLM host that matches the given remote
59 * address. If none is found, create a new host with the requested
60 * address and remember 'vers' as the NLM protocol version to use for
63 extern struct nlm_host *nlm_find_host_by_addr(const struct sockaddr *addr,
67 * Return an RPC client handle that can be used to talk to the NLM
68 * running on the given host.
70 extern CLIENT *nlm_host_get_rpc(struct nlm_host *host);
73 * Called when a host restarts.
75 extern void nlm_sm_notify(nlm_sm_status *argp);
78 * Implementation for lock testing RPCs. Returns the NLM host that
79 * matches the RPC arguments.
81 extern struct nlm_host *nlm_do_test(nlm4_testargs *argp,
82 nlm4_testres *result, struct svc_req *rqstp);
85 * Implementation for lock setting RPCs. Returns the NLM host that
86 * matches the RPC arguments. If monitor is TRUE, set up an NSM
87 * monitor for this host.
89 extern struct nlm_host *nlm_do_lock(nlm4_lockargs *argp,
90 nlm4_res *result, struct svc_req *rqstp, bool_t monitor);
93 * Implementation for cancelling a pending lock request. Returns the
94 * NLM host that matches the RPC arguments.
96 extern struct nlm_host *nlm_do_cancel(nlm4_cancargs *argp,
97 nlm4_res *result, struct svc_req *rqstp);
100 * Implementation for unlocking RPCs. Returns the NLM host that
101 * matches the RPC arguments.
103 extern struct nlm_host *nlm_do_unlock(nlm4_unlockargs *argp,
104 nlm4_res *result, struct svc_req *rqstp);
107 * Free all locks associated with the hostname argp->name.
109 extern void nlm_do_free_all(nlm4_notify *argp);
112 * Find an RPC transport that can be used to communicate with the
113 * userland part of lockd.
115 extern CLIENT *nlm_user_lockd(void);