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