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