~kris/9p

9hist

ref: f606b0be00a8d31a01f0f7f6e4d83a40204f732e 9hist/port/netXXX.c -rw-r--r-- 1.5 KiB
f606b0be — David du Colombier Plan 9 from Bell Labs 1993-07-28 33 years ago
                                                                                
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#include	"u.h"
#include	"../port/lib.h"
#include	"mem.h"
#include	"dat.h"
#include	"fns.h"
#include	"../port/error.h"

static void nulloput(Queue*, Block*);
static void protooput(Queue*, Block*);
static void protoiput(Queue*, Block*);

static Qinfo XXXprotold =
{
	protoiput,
	protooput,
	0,
	0,
	"proto",
	0
};

static Qinfo XXXmuxld =
{
	0,
	nulloput,
	0,
	0,
	"mux"
};

static void
protooput(Queue *q, Block *bp)
{
	PUTNEXT(q, bp);
}

static void
protoiput(Queue *q, Block *bp)
{
	PUTNEXT(q, bp);
}

static void
nulloput(Queue *q, Block *bp)
{
	freeb(bp);
}

static void XXXaddr(Chan*, char*, int);
static void XXXother(Chan*, char*, int);
static void XXXraddr(Chan*, char*, int);
static void XXXruser(Chan*, char*, int);
static int XXXclone(Chan*);
static void XXXconnect(Chan*, char*);

Network netXXX =
{
	"XXX",
	4,
	32,			/* # conversations */
	&XXXmuxld,
	&XXXprotold,
	0,			/* no listener */
	XXXclone,
	XXXconnect,
	0,			/* no announces */
	4,			/* info files */
	{ { "addr",	XXXaddr, },
	  { "other",	XXXother, },
	  { "raddr",	XXXraddr, },
	  { "ruser",	XXXruser, },
	},
};

static void
XXXaddr(Chan *c, char *buf, int len)
{
	strncpy(buf, "my address", len-1);
}

static void
XXXother(Chan *c, char *buf, int len)
{
	strncpy(buf, "other stuff", len-1);
}

static void
XXXraddr(Chan *c, char *buf, int len)
{
	strncpy(buf, "remote address", len-1);
}

static void
XXXruser(Chan *c, char *buf, int len)
{
	strncpy(buf, "remote user", len-1);
}

static int
XXXclone(Chan *c)
{
	return 5;
}

static void
XXXconnect(Chan *c, char *dest)
{
}