summaryrefslogtreecommitdiff
path: root/9p/srv.h
blob: 32a2e307b5eb5bd1de67b88d086eecd4fb271532 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef _NET9P_H_
#define _NET9P_H_

#include "coroutine.h"

#define 9P_DEFAULT_PORT         564

/**
 * The default here is the same as in Plan 9 4e's lib9p.  It's sized
 * so that a Twrite message can return 8KiB of data; it uses the
 * default (1024*8)+24 with the comment that "24" is "ample room for
 * Twrite/Rread header (iounit)".  In fact, the Twrite header is only
 * 23 bytes ("size[4] Twrite[1] tag[2] fid[4] offset[8] count[4]") and
 * the Rread header is even shorter at 11 bytes ("size[4] Rread[1]
 * tag[2] count[4]"), so "24" appears to be the size of the Twrite
 * header rounded up to a nice round number.
 *
 * In older versions of 9P ("9P1"), the max message size was defined
 * as part of the protocol specification rather than negotiated.  In
 * Plan 9 1e it was (1024*8)+128, and was bumped to (1024*8)+160 in 2e
 * and 3e.
 */
#define 9P_DEFAULT_MAX_MSG_SIZE ((1024*8)+24)

COROUTINE net9p_cr(void *);

#endif /* _NET9P_H_ */