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