nineproto.h revision 1.1 1 1.1 pooka /* $NetBSD: nineproto.h,v 1.1 2007/04/21 14:21:43 pooka 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.1 pooka #define P9PROTO_VERSION "9P2000"
34 1.1 pooka
35 1.1 pooka #define P9PROTO_T_VERSION 100
36 1.1 pooka #define P9PROTO_R_VERSION 101
37 1.1 pooka #define P9PROTO_T_AUTH 102
38 1.1 pooka #define P9PROTO_R_AUTH 103
39 1.1 pooka #define P9PROTO_T_ATTACH 104
40 1.1 pooka #define P9PROTO_R_ATTACH 105
41 1.1 pooka #define P9PROTO_T_ERROR 106
42 1.1 pooka #define P9PROTO_R_ERROR 107
43 1.1 pooka #define P9PROTO_T_FLUSH 108
44 1.1 pooka #define P9PROTO_R_FLUSH 109
45 1.1 pooka #define P9PROTO_T_WALK 110
46 1.1 pooka #define P9PROTO_R_WALK 111
47 1.1 pooka #define P9PROTO_T_OPEN 112
48 1.1 pooka #define P9PROTO_R_OPEN 113
49 1.1 pooka #define P9PROTO_T_CREATE 114
50 1.1 pooka #define P9PROTO_R_CREATE 115
51 1.1 pooka #define P9PROTO_T_READ 116
52 1.1 pooka #define P9PROTO_R_READ 117
53 1.1 pooka #define P9PROTO_T_WRITE 118
54 1.1 pooka #define P9PROTO_R_WRITE 119
55 1.1 pooka #define P9PROTO_T_CLUNK 120
56 1.1 pooka #define P9PROTO_R_CLUNK 121
57 1.1 pooka #define P9PROTO_T_REMOVE 122
58 1.1 pooka #define P9PROTO_R_REMOVE 123
59 1.1 pooka #define P9PROTO_T_STAT 124
60 1.1 pooka #define P9PROTO_R_STAT 125
61 1.1 pooka #define P9PROTO_T_WSTAT 126
62 1.1 pooka #define P9PROTO_R_WSTAT 127
63 1.1 pooka #define P9PROTO_MIN 9PROTO_T_VERSION
64 1.1 pooka #define P9PROTO_MAX 9PROTO_R_MAX
65 1.1 pooka
66 1.1 pooka #define P9PROTO_NOFID (uint32_t)~0
67 1.1 pooka #define P9PROTO_NOTAG (uint16_t)~0
68 1.1 pooka
69 1.1 pooka /* type field in a qid */
70 1.1 pooka #define P9PROTO_QID_TYPE_DIR 0x80
71 1.1 pooka #define P9PROTO_QID_TYPE_APPEND 0x40
72 1.1 pooka #define P9PROTO_QID_TYPE_EXCL 0x20
73 1.1 pooka #define P9PROTO_QID_TYPE_MOUNT 0x10
74 1.1 pooka #define P9PROTO_QID_TYPE_AUTH 0x08
75 1.1 pooka
76 1.1 pooka /* mode in open */
77 1.1 pooka #define P9PROTO_OMODE_READ 0x00
78 1.1 pooka #define P9PROTO_OMODE_WRITE 0x01
79 1.1 pooka #define P9PROTO_OMODE_RDWR 0x02
80 1.1 pooka #define P9PROTO_OMODE_EXEC 0x03
81 1.1 pooka #define P9PROTO_OMODE_TRUNC 0x10
82 1.1 pooka #define P9PROTO_OMODE_RMCLOSE 0x40
83 1.1 pooka
84 1.1 pooka /* for creating directories */
85 1.1 pooka #define P9PROTO_CPERM_DIR 0x80000000
86 1.1 pooka
87 1.1 pooka /* stat non-values */
88 1.1 pooka #define P9PROTO_STAT_NOVAL1 (uint8_t)~0
89 1.1 pooka #define P9PROTO_STAT_NOVAL2 (uint16_t)~0
90 1.1 pooka #define P9PROTO_STAT_NOVAL4 (uint32_t)~0
91 1.1 pooka #define P9PROTO_STAT_NOVAL8 (uint64_t)~0
92 1.1 pooka
93 1.1 pooka #endif /* PUFFS9P_PROTO_H_ */
94