FreeBSD/Linux Kernel Cross Reference
sys/netncp/ncp_subr.h
1 /*-
2 * Copyright (c) 1999, Boris Popov
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by Boris Popov.
16 * 4. Neither the name of the author nor the names of any co-contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * $FreeBSD$
33 */
34 #ifndef _NETNCP_NCP_SUBR_H_
35 #define _NETNCP_NCP_SUBR_H_
36
37 #define NCP_TIMER_TICK 2*hz /* 1sec */
38 #define NCP_SIGMASK(set) \
39 (SIGISMEMBER(set, SIGINT) || SIGISMEMBER(set, SIGTERM) || \
40 SIGISMEMBER(set, SIGHUP) || SIGISMEMBER(set, SIGKILL) || \
41 SIGISMEMBER(set, SIGQUIT))
42
43
44 #define NCP_PRINT(format, args...) printf("FATAL: %s: "format, __func__ ,## args)
45 #define nwfs_printf NCP_PRINT
46 /* Maybe this should panic, but I dont like that */
47 #define NCPFATAL NCP_PRINT
48 #define NCPERROR NCP_PRINT
49
50 /* socket debugging */
51 #ifdef NCP_SOCKET_DEBUG
52 #define NCPSDEBUG(format, args...) printf("%s: "format, __func__ ,## args)
53 #else
54 #define NCPSDEBUG(format, args...)
55 #endif
56
57 /* NCP calls debug */
58 #ifdef NCP_NCP_DEBUG
59 #define NCPNDEBUG(format, args...) printf("%s: "format, __func__ ,## args)
60 #else
61 #define NCPNDEBUG(format, args...)
62 #endif
63
64 /* NCP data dump */
65 #ifdef NCP_DATA_DEBUG
66 #define NCPDDEBUG(m) m_dumpm(m)
67 #else
68 #define NCPDDEBUG(m)
69 #endif
70
71 /* FS VOPS debug */
72 #ifdef NWFS_VOPS_DEBUG
73 #define NCPVODEBUG(format, args...) printf("%s: "format, __func__ ,## args)
74 #else
75 #define NCPVODEBUG(format, args...)
76 #endif
77
78 /* FS VNOPS debug */
79 #ifdef NWFS_VNOPS_DEBUG
80 #define NCPVNDEBUG(format, args...) printf("%s: "format, __func__ ,## args)
81 #else
82 #define NCPVNDEBUG(format, args...)
83 #endif
84
85 #define checkbad(fn) {error=(fn);if(error) goto bad;}
86
87 #define ncp_suser(cred) priv_check_cred(cred, PRIV_NETNCP, 0)
88
89 #define ncp_isowner(conn,cred) ((cred)->cr_uid == (conn)->nc_owner->cr_uid)
90
91 struct ncp_conn;
92
93 struct nwmount;
94 struct vnode;
95 struct nwnode;
96 struct vattr;
97 struct uio;
98 struct ncp_nlstables;
99
100 struct ncp_open_info {
101 u_int32_t origfh;
102 ncp_fh fh;
103 u_int8_t action;
104 struct nw_entry_info fattr;
105 };
106
107 extern int ncp_debuglevel;
108
109 struct proc;
110 struct ucred;
111
112 int ncp_init(void);
113 int ncp_done(void);
114 int ncp_chkintr(struct ncp_conn *conn, struct thread *td);
115 char*ncp_str_dup(char *s);
116
117 /* ncp_crypt.c */
118 void nw_keyhash(const u_char *key, const u_char *buf, int buflen, u_char *target);
119 void nw_encrypt(const u_char *fra, const u_char *buf, u_char *target);
120 void ncp_sign(const u_int32_t *state, const char *x, u_int32_t *ostate);
121
122 #endif /* _NCP_SUBR_H_ */
Cache object: 10704ce79a9215e734f499a40b44af1f
|