Register keyword removal
[dragonfly.git] / sys / netproto / ncp / ncp_user.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: src/sys/netncp/ncp_user.h,v 1.2 1999/12/12 05:50:06 bp Exp $
33  * $DragonFly: src/sys/netproto/ncp/ncp_user.h,v 1.2 2003/06/17 04:28:53 dillon Exp $
34  */
35 #ifndef _NETNCP_NCP_USER_H_
36 #define _NETNCP_NCP_USER_H_
37
38 /* 
39  * "ncp" interface to kernel, this can be done via syscalls but may eat
40  * a lot of them, so we select internal code, define req's and replays
41  * as necessary. Structure for call is simple:
42  * byte=NCP_CONN
43  * byte=NCP_CONN_SUBFN
44  * ....=data
45  */
46 #define NCP_CONN                0xF5    /* change if that will occupied */
47 #define NCP_CONN_READ           0x01    /* read from file handle */
48 #define NCP_CONN_WRITE          0x02    /* write to file handle */
49 #define NCP_CONN_SETFLAGS       0x03    /* word mask, word flags */
50 #define NCP_CONN_LOGIN          0x04    /* bind login on handle */
51 #define NCP_CONN_GETINFO        0x05    /* get information about connection */
52 #define NCP_CONN_GETUSER        0x06    /* get user name for connection */
53 #define NCP_CONN_CONN2REF       0x07    /* convert handle to reference */
54 #define NCP_CONN_CONNCLOSE      0x08    /* release connection handle */
55 #define NCP_CONN_FRAG           0x09    /* ncp fragmented request */
56 #define NCP_CONN_DUP            0x0A    /* get an additional handle */
57 #define NCP_CONN_GETDATA        0x0B    /* retrieve NCP_CD_* vals */
58 #define NCP_CONN_SETDATA        0x0C    /* store NCP_CD_* vals */
59
60 /*
61  * Internal connection data can be set by owner or superuser and retrieved
62  * only by superuser
63  */
64 #define NCP_CD_NDSLOGINKEY      0x01
65 #define NCP_CD_NDSPRIVATEKEY    0x02
66 #define NCP_CD_NDSUFLAGS        0x03
67
68 /* user side structures to issue fragmented ncp calls */
69 typedef struct {
70         char    *fragAddress;
71         u_int32_t fragSize;
72 } NW_FRAGMENT;
73
74
75 struct ncp_rw {
76         ncp_fh  nrw_fh;
77         char    *nrw_base;
78         off_t   nrw_offset;
79         int     nrw_cnt;
80 };
81
82 struct ncp_conn_login {
83         char    *username;
84         int     objtype;
85         char    *password;
86 };
87
88 struct ncp_conn_frag {
89         int             cc;             /* completion code */
90         int             cs;             /* connection state */
91         int             fn;
92         int             rqfcnt;
93         NW_FRAGMENT     *rqf;
94         int             rpfcnt;
95         NW_FRAGMENT     *rpf;
96 };
97
98 #endif