proc->thread stage 4: rework the VFS and DEVICE subsystems to take thread
[dragonfly.git] / sys / netproto / ncp / ncp_ncp.h
CommitLineData
984263bc
MD
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_ncp.h,v 1.3 2000/01/14 19:54:38 bde Exp $
dadab5e9 33 * $DragonFly: src/sys/netproto/ncp/ncp_ncp.h,v 1.3 2003/06/25 03:56:05 dillon Exp $
984263bc
MD
34 */
35#ifndef _NETNCP_NCP_NCP_H_
36#define _NETNCP_NCP_NCP_H_
37
38#define NCP_ALLOC_SLOT 0x1111
39#define NCP_REQUEST 0x2222
40#define NCP_REPLY 0x3333
41#define NCP_FREE_SLOT 0x5555
42#define NCP_PACKET_BURST 0x7777
43#define NCP_POSITIVE_ACK 0x9999
44
45/*
46 * Bits for connection state field in ncp_rphdr
47 */
48#define NCP_CS_BAD_CONN 0x01 /* no such connection */
49#define NCP_CS_NO_SLOTS 0x04 /* no connection slots available */
50#define NCP_CS_SERVER_DOWN 0x10 /* server in down state */
51#define NCP_CS_HAVE_BROADCAST 0x40 /* server holds broadcast for us */
52
53#define NCP_RETRY_COUNT 5
54#define NCP_RETRY_TIMEOUT 10
55#define NCP_RESTORE_COUNT 2 /* how many times try to restore per
56 * single request, should be an _even_ */
57
58struct ncp_rqhdr {
59 u_int16_t type;
60 u_int8_t seq;
61 u_int8_t conn_low;
62 u_int8_t task;
63 u_int8_t conn_high;
64 u_int8_t fn;
65 u_int8_t data[0];
66} __attribute__((packed));
67
68
69struct ncp_rphdr {
70 u_int16_t type;
71 u_int8_t seq;
72 u_int8_t conn_low;
73 u_int8_t task;
74 u_int8_t conn_high;
75 u_int8_t completion_code;
76 u_int8_t connection_state;
77 u_int8_t data[0];
78}__attribute__((packed));
79
80#define BFL_ABT 0x04
81#define BFL_EOB 0x10
82#define BFL_SYS 0x80
83
84#define BOP_READ 1L
85#define BOP_WRITE 2L
86
87#define BERR_NONE 0
88#define BERR_INIT 1
89#define BERR_IO 2
90#define BERR_NODATA 3
91#define BERR_WRITE 4
92
93struct ncp_bursthdr {
94 u_short bh_type;
95 u_char bh_flags;
96 u_char bh_streamtype;
97 u_long bh_srcid;
98 u_long bh_dstid;
99 u_long bh_seq; /* HL */
100 u_long bh_send_delay; /* HL */
101 u_short bh_bseq; /* HL */
102 u_short bh_aseq; /* HL */
103 u_long bh_blen; /* HL */
104 u_long bh_dofs; /* HL */
105 u_short bh_dlen; /* HL */
106 u_short bh_misfrags; /* HL */
107} __attribute__((packed));
108
109struct ncp_conn;
110struct ncp_conn_args;
111struct ncp_rq;
112struct proc;
dadab5e9 113struct thread;
984263bc
MD
114struct ucred;
115
116int ncp_request(struct ncp_conn *conn,struct ncp_rq *rqp);
117int ncp_ncp_connect(struct ncp_conn *conn);
118int ncp_ncp_disconnect(struct ncp_conn *conn);
119int ncp_reconnect(struct ncp_conn *conn);
dadab5e9 120int ncp_connect(struct ncp_conn_args *li,struct thread *td, struct ucred *cred,struct ncp_conn **aconn);
984263bc
MD
121int ncp_disconnect(struct ncp_conn *conn);
122int ncp_login(struct ncp_conn *conn, char *user, int objtype, char *password,
dadab5e9 123 struct thread *td, struct ucred *cred);
984263bc
MD
124
125#endif /* _NCP_NCP_H_ */