1/*
2 * Copyright (c) 2002-2005 Apple Computer, Inc.  All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*	$NetBSD: lockd_lock.h,v 1.2 2000/06/09 14:00:54 fvdl Exp $	*/
24/*	$FreeBSD: src/usr.sbin/rpc.lockd/lockd_lock.h,v 1.4 2002/03/21 22:52:45 alfred Exp $ */
25
26/* Headers and function declarations for file-locking utilities */
27
28#ifndef LOCKD_LOCK_H
29#define LOCKD_LOCK_H
30struct nlm4_holder * testlock(struct nlm4_lock *lock, bool_t exclusive, int flags);
31enum nlm4_stats getlock(nlm4_lockargs *lckarg, struct svc_req *rqstp, const int flags);
32enum nlm4_stats unlock(nlm4_lock *lock, const int flags);
33enum nlm4_stats cancellock(nlm4_cancargs *args, const int flags);
34int lock_answer(int version, netobj *netcookie, nlm4_lock *lock, int flags, int result);
35enum nlm4_stats getshare(nlm_shareargs *shrarg, struct svc_req *rqstp, const int flags);
36enum nlm4_stats unshare(nlm_shareargs *shrarg, struct svc_req *rqstp, const int flags);
37void do_free_all(const char *hostname);
38void granted_failed(nlm4_res *arg);
39void do_notify_mounts(const char *hostname);
40
41void notify(const char *hostname, const int state);
42
43void monitor_lock_host_by_name(const char *, const struct sockaddr *);
44void monitor_lock_host_by_addr(const struct sockaddr *addr);
45void unmonitor_lock_host(const char *hostname);
46
47/* flags for testlock, getlock & unlock */
48#define LOCK_ASYNC	0x01 /* async version (getlock only) */
49#define LOCK_V4 	0x02 /* v4 version */
50#define LOCK_MON 	0x04 /* monitored lock (getlock only) */
51
52/* flags for lock_answer */
53#define LOCK_ANSWER_GRANTED	0x0001	/* NLM_GRANTED request */
54#define LOCK_ANSWER_LOCK_EXCL	0x0004	/* lock is exclusive */
55
56/* callbacks from lock_proc.c */
57int	transmit_result(int, nlm_res *, struct sockaddr *, int);
58int	transmit4_result(int, nlm4_res *, struct sockaddr *, int);
59CLIENT  *get_client(struct sockaddr *, rpcvers_t, int, int);
60int	addrcmp(const struct sockaddr *, const struct sockaddr *);
61
62extern time_t currsec;
63
64#endif /* !LOCKD_LOCK_H */
65