aboutsummaryrefslogtreecommitdiff
path: root/include/plumb.h
blob: 484042e36e93dee953d1cf489385caa5e9e2ea04 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef _LIBPLUMB_H_
#define _LIBPLUMB_H_ 1
#if defined(__cplusplus)
extern "C" { 
#endif

AUTOLIB(plumb)
/*
#pragma	lib	"libplumb.a"
#pragma	src	"/sys/src/libplumb"
*/

/*
 * Message format:
 *	source application\n
 *	destination port\n
 *	working directory\n
 *	type\n
 *	attributes\n
 *	nbytes\n
 *	n bytes of data
 */

typedef struct Plumbattr Plumbattr;
typedef struct Plumbmsg Plumbmsg;

struct Plumbmsg
{
	char		*src;
	char		*dst;
	char		*wdir;
	char		*type;
	Plumbattr	*attr;
	int		ndata;
	char		*data;
};

struct Plumbattr
{
	char		*name;
	char		*value;
	Plumbattr	*next;
};

int			plumbsend(int, Plumbmsg*);
Plumbmsg*	plumbrecv(int);
char*		plumbpack(Plumbmsg*, int*);
Plumbmsg*	plumbunpack(char*, int);
Plumbmsg*	plumbunpackpartial(char*, int, int*);
char*		plumbpackattr(Plumbattr*);
Plumbattr*	plumbunpackattr(char*);
Plumbattr*	plumbaddattr(Plumbattr*, Plumbattr*);
Plumbattr*	plumbdelattr(Plumbattr*, char*);
void			plumbfree(Plumbmsg*);
char*		plumblookup(Plumbattr*, char*);
int			plumbopen(char*, int);
int			eplumb(int, char*);
int			plumbunmount(void);

#ifdef _9PCLIENT_H_
CFid*		plumbopenfid(char*, int);
Plumbmsg*	plumbrecvfid(CFid*);
Plumbmsg*	threadplumbrecvfid(CFid*);
int		plumbsendtofid(CFid*, Plumbmsg*);
#endif

#if defined(__cplusplus)
}
#endif
#endif