1 1.2 ozaki /* $NetBSD: nineproto.h,v 1.2 2019/05/17 08:48:04 ozaki-r Exp $ */ 2 1.1 pooka 3 1.1 pooka /* 4 1.1 pooka * Copyright (c) 2007 Antti Kantee. All Rights Reserved. 5 1.1 pooka * 6 1.1 pooka * Redistribution and use in source and binary forms, with or without 7 1.1 pooka * modification, are permitted provided that the following conditions 8 1.1 pooka * are met: 9 1.1 pooka * 1. Redistributions of source code must retain the above copyright 10 1.1 pooka * notice, this list of conditions and the following disclaimer. 11 1.1 pooka * 2. Redistributions in binary form must reproduce the above copyright 12 1.1 pooka * notice, this list of conditions and the following disclaimer in the 13 1.1 pooka * documentation and/or other materials provided with the distribution. 14 1.1 pooka * 15 1.1 pooka * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 16 1.1 pooka * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 1.1 pooka * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 1.1 pooka * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19 1.1 pooka * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 1.1 pooka * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 1.1 pooka * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 1.1 pooka * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 1.1 pooka * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 1.1 pooka * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 1.1 pooka * SUCH DAMAGE. 26 1.1 pooka */ 27 1.1 pooka 28 1.1 pooka #ifndef PUFFS9P_9PROTO_H_ 29 1.1 pooka #define PUFFS9P_9PROTO_H_ 30 1.1 pooka 31 1.1 pooka #include <stdint.h> 32 1.1 pooka 33 1.2 ozaki #define P9PROTO_VERSION 0 34 1.2 ozaki #define P9PROTO_VERSION_U 1 35 1.2 ozaki 36 1.2 ozaki #define P9PROTO_VERSTR "9P2000" 37 1.2 ozaki #define P9PROTO_VERSTR_U "9P2000.u" 38 1.2 ozaki #define P9PROTO_VERSTR_MAXLEN (sizeof(P9PROTO_VERSTR_U)) 39 1.1 pooka 40 1.1 pooka #define P9PROTO_T_VERSION 100 41 1.1 pooka #define P9PROTO_R_VERSION 101 42 1.1 pooka #define P9PROTO_T_AUTH 102 43 1.1 pooka #define P9PROTO_R_AUTH 103 44 1.1 pooka #define P9PROTO_T_ATTACH 104 45 1.1 pooka #define P9PROTO_R_ATTACH 105 46 1.1 pooka #define P9PROTO_T_ERROR 106 47 1.1 pooka #define P9PROTO_R_ERROR 107 48 1.1 pooka #define P9PROTO_T_FLUSH 108 49 1.1 pooka #define P9PROTO_R_FLUSH 109 50 1.1 pooka #define P9PROTO_T_WALK 110 51 1.1 pooka #define P9PROTO_R_WALK 111 52 1.1 pooka #define P9PROTO_T_OPEN 112 53 1.1 pooka #define P9PROTO_R_OPEN 113 54 1.1 pooka #define P9PROTO_T_CREATE 114 55 1.1 pooka #define P9PROTO_R_CREATE 115 56 1.1 pooka #define P9PROTO_T_READ 116 57 1.1 pooka #define P9PROTO_R_READ 117 58 1.1 pooka #define P9PROTO_T_WRITE 118 59 1.1 pooka #define P9PROTO_R_WRITE 119 60 1.1 pooka #define P9PROTO_T_CLUNK 120 61 1.1 pooka #define P9PROTO_R_CLUNK 121 62 1.1 pooka #define P9PROTO_T_REMOVE 122 63 1.1 pooka #define P9PROTO_R_REMOVE 123 64 1.1 pooka #define P9PROTO_T_STAT 124 65 1.1 pooka #define P9PROTO_R_STAT 125 66 1.1 pooka #define P9PROTO_T_WSTAT 126 67 1.1 pooka #define P9PROTO_R_WSTAT 127 68 1.1 pooka #define P9PROTO_MIN 9PROTO_T_VERSION 69 1.1 pooka #define P9PROTO_MAX 9PROTO_R_MAX 70 1.1 pooka 71 1.1 pooka #define P9PROTO_NOFID (uint32_t)~0 72 1.1 pooka #define P9PROTO_NOTAG (uint16_t)~0 73 1.1 pooka 74 1.2 ozaki #define P9PROTO_NUNAME_UNSPECIFIED (uint16_t)~0 75 1.2 ozaki 76 1.1 pooka /* type field in a qid */ 77 1.1 pooka #define P9PROTO_QID_TYPE_DIR 0x80 78 1.1 pooka #define P9PROTO_QID_TYPE_APPEND 0x40 79 1.1 pooka #define P9PROTO_QID_TYPE_EXCL 0x20 80 1.1 pooka #define P9PROTO_QID_TYPE_MOUNT 0x10 81 1.1 pooka #define P9PROTO_QID_TYPE_AUTH 0x08 82 1.2 ozaki /* P92000.u extensions */ 83 1.2 ozaki #define P9PROTO_QID_TYPE_TMP 0x04 84 1.2 ozaki #define P9PROTO_QID_TYPE_LINK 0x02 85 1.2 ozaki #define P9PROTO_QID_TYPE_FILE 0x00 86 1.1 pooka 87 1.1 pooka /* mode in open */ 88 1.1 pooka #define P9PROTO_OMODE_READ 0x00 89 1.1 pooka #define P9PROTO_OMODE_WRITE 0x01 90 1.1 pooka #define P9PROTO_OMODE_RDWR 0x02 91 1.1 pooka #define P9PROTO_OMODE_EXEC 0x03 92 1.1 pooka #define P9PROTO_OMODE_TRUNC 0x10 93 1.1 pooka #define P9PROTO_OMODE_RMCLOSE 0x40 94 1.1 pooka 95 1.1 pooka /* for creating directories */ 96 1.1 pooka #define P9PROTO_CPERM_DIR 0x80000000 97 1.2 ozaki #define P9PROTO_CPERM_APPEND 0x40000000 98 1.2 ozaki #define P9PROTO_CPERM_EXCL 0x20000000 99 1.2 ozaki #define P9PROTO_CPERM_MOUNT 0x10000000 100 1.2 ozaki #define P9PROTO_CPERM_AUTH 0x08000000 101 1.2 ozaki #define P9PROTO_CPERM_TMP 0x04000000 102 1.2 ozaki #define P9PROTO_CPERM_SYMLINK 0x02000000 103 1.2 ozaki /* P92000.u extensions */ 104 1.2 ozaki #define P9PROTO_CPERM_DEVICE 0x00800000 105 1.2 ozaki #define P9PROTO_CPERM_NAMEDPIPE 0x00200000 106 1.2 ozaki #define P9PROTO_CPERM_SOCKET 0x00100000 107 1.2 ozaki #define P9PROTO_CPERM_SETUID 0x00080000 108 1.2 ozaki #define P9PROTO_CPERM_SETGID 0x00040000 109 1.1 pooka 110 1.1 pooka /* stat non-values */ 111 1.1 pooka #define P9PROTO_STAT_NOVAL1 (uint8_t)~0 112 1.1 pooka #define P9PROTO_STAT_NOVAL2 (uint16_t)~0 113 1.1 pooka #define P9PROTO_STAT_NOVAL4 (uint32_t)~0 114 1.1 pooka #define P9PROTO_STAT_NOVAL8 (uint64_t)~0 115 1.2 ozaki #define P9PROTO_STAT_NOSTR "" 116 1.1 pooka 117 1.1 pooka #endif /* PUFFS9P_PROTO_H_ */ 118