2 * Copyright (c) 1999 Boris Popov
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 #ifndef _NETNCP_NCP_NCP_H_
29 #define _NETNCP_NCP_NCP_H_
31 #define NCP_ALLOC_SLOT 0x1111
32 #define NCP_REQUEST 0x2222
33 #define NCP_REPLY 0x3333
34 #define NCP_FREE_SLOT 0x5555
35 #define NCP_PACKET_BURST 0x7777
36 #define NCP_POSITIVE_ACK 0x9999
39 * Bits for connection state field in ncp_rphdr
41 #define NCP_CS_BAD_CONN 0x01 /* no such connection */
42 #define NCP_CS_NO_SLOTS 0x04 /* no connection slots available */
43 #define NCP_CS_SERVER_DOWN 0x10 /* server in down state */
44 #define NCP_CS_HAVE_BROADCAST 0x40 /* server holds broadcast for us */
46 #define NCP_RETRY_COUNT 5
47 #define NCP_RETRY_TIMEOUT 10
48 #define NCP_RESTORE_COUNT 2 /* how many times try to restore per
49 * single request, should be an _even_ */
68 u_int8_t completion_code;
69 u_int8_t connection_state;
92 u_long bh_seq; /* HL */
93 u_long bh_send_delay; /* HL */
94 u_short bh_bseq; /* HL */
95 u_short bh_aseq; /* HL */
96 u_long bh_blen; /* HL */
97 u_long bh_dofs; /* HL */
98 u_short bh_dlen; /* HL */
99 u_short bh_misfrags; /* HL */
103 struct ncp_conn_args;
107 int ncp_ncp_connect(struct ncp_conn *conn);
108 int ncp_ncp_disconnect(struct ncp_conn *conn);
109 int ncp_negotiate_buffersize(struct ncp_conn *conn, int size, int *target);
110 int ncp_renegotiate_connparam(struct ncp_conn *conn, int buffsize,
111 u_int8_t in_options);
112 int ncp_get_bindery_object_id(struct ncp_conn *conn,
113 u_int16_t object_type, char *object_name,
114 struct ncp_bindery_object *target,
115 struct thread *td,struct ucred *cred);
116 int ncp_get_encryption_key(struct ncp_conn *conn, char *target);
117 int ncp_login_encrypted(struct ncp_conn *conn,
118 struct ncp_bindery_object *object,
119 const u_char *key, const u_char *passwd,
120 struct thread *td, struct ucred *cred);
121 int ncp_login_unencrypted(struct ncp_conn *conn, u_int16_t object_type,
122 const char *object_name, const u_char *passwd,
123 struct thread *td, struct ucred *cred);
124 int ncp_read(struct ncp_conn *conn, ncp_fh *file, struct uio *uiop, struct ucred *cred);
125 int ncp_write(struct ncp_conn *conn, ncp_fh *file, struct uio *uiop, struct ucred *cred);
127 #endif /* _NCP_NCP_H_ */