|
|
1.1 root 1: .TH DK 3
2: .SH NAME
3: dk \- Datakit conversations
4: .SH SYNOPSIS
5: .B bind
6: .BI #k name
7: .B /net/dk
8: .br
9: .B bind
10: .BI #i name
11: .B /net/dk
12: .nf
13: .sp
14: .B
15: ctlfd = open(".../ctl", ORDWR);
16: .B
17: write(ctlfd, "push dkmux", 10);
18: .B
19: write(ctlfd, "config \fIcsc \fP[no]restart\fI name nvc window\fP", n);
20: .fi
21: .SH DESCRIPTION
22: A Datakit device\(emeither
23: .B k
24: for the regular Datakit or
25: .B i
26: for the Incon\(emis a directory containing up to 256
27: directories, one per virtual circuit, named
28: .B 0
29: through
30: .BR 255 ,
31: and a special file named
32: .BR clone .
33: The specifier
34: .I name
35: matches the Datakit device to a physical device that
36: its virtual circuits are multiplexed over (see
37: .IR dkmux
38: below).
39: .PP
40: Normally, the standard routines
41: .IR dial ,
42: .IR hangup ,
43: .IR listen ,
44: and
45: .I announce
46: (see
47: .IR dial (2))
48: are used to make, listen for, and control calls over
49: any network.
50: The routines expect the following properties of
51: any multiplexed network, not just Datakit.
52: .PP
53: Opening the
54: .I clone
55: file opens the
56: .B ctl
57: file of an unused virtual circuit.
58: Reading any
59: .I ctl
60: file returns the name of the
61: virtual circuit directory.
62: For example, reading
63: .B #k/17/ctl
64: will return the string
65: .BR 17 .
66: .PP
67: Each virtual circuit directory contains the files:
68: .TP 10
69: .B ctl
70: to control the virtual circuit: establish a connection, hang it up, etc.
71: .TP 10
72: .B data
73: to converse with the remote end (via read and write)
74: .TP 10
75: .B listen
76: to listen for calls (after announcing; see below)
77: .TP 10
78: .B other
79: information about the conversation
80: .TP 10
81: .B raddr
82: the address of the remote end
83: .TP 10
84: .B ruser
85: the id of the user at the remote end (when applicable)
86: .PP
87: To set up and tear down virtual circuits a process writes
88: textual commands to the
89: .B ctl
90: file:
91: .TP 18
92: .BI connect " addr
93: connect to address
94: .IR addr .
95: If the connection fails, the write returns an error.
96: .TP 18
97: .B hangup
98: tear down a connected virtual circuit.
99: .TP 18
100: .BI announce " name
101: announce the readiness to accept calls to
102: .IR name .
103: .TP 18
104: .BI accept " n
105: accept the call on virtual circuit
106: .IR n .
107: .TP 18
108: .BI reject " n e"
109: reject the call on virtual circuit
110: .I n
111: with error code
112: .IR e .
113: .I E
114: must be a number from 0 to 7.
115: .PP
116: Once a virtual circuit is set up,
117: a process can converse with the remote service
118: by reading and writing the
119: .B data
120: file.
121: Write boundaries are preserved.
122: .PP
123: Accepting calls to
124: .I name
125: requires the following dance:
126: .IP 1)
127: announce
128: .I name
129: on a virtual circuit.
130: .IP 2)
131: open the
132: .B listen
133: file in that virtual circuit's directory.
134: When a call comes in on a virtual circuit for
135: .IR name ,
136: the open will return with the file descriptor open to
137: the control file of the incoming virtual circuit.
138: .IP 3)
139: accept or reject the call by writing an
140: .B accept
141: or
142: .B reject
143: command to the
144: .B ctl
145: file of the announced virtual circuit.
146: .PP
147: A
148: .I dkmux
149: module pushed onto a stream makes that stream a multiplexed
150: connection to a Datakit.
151: The subsequent
152: .B config
153: control message configures the multiplexer and matches it to a
154: .I dk
155: device.
156: The parameters to the
157: .B config
158: message are
159: .TP
160: .I csc
161: the line number of the common signaling channel (must be > 0)
162: .TP
163: .I nvc
164: the number of virtual circuits (optional; default chosen by Datakit)
165: .TP
166: .RB [ no ] restart
167: the word
168: .B restart
169: or
170: .B norestart
171: (optional; default is
172: .BR restart ).
173: .B Restart
174: tells the Datakit to forget all previous connections and
175: authentications for this machine.
176: .TP
177: .I name
178: The name used in binding
179: .I dk
180: device.
181: .TP
182: .I window
183: the default URP window size for virtual circuits on this Datakit line (default is 2048).
184: .LP
185: .SH FILES
186: .B #k/clone
187: .br
188: .B #k/[0-255]
189: .br
190: .B #k/[0-255]/data
191: .br
192: .B #k/[0-255]/ctl
193: .br
194: .B #k/[0-255]/listen
195: .br
196: .B #k/[0-255]/ruser
197: .br
198: .B #k/[0-255]/raddr
199: .SH SEE ALSO
200: .IR stream (3),
201: .IR dkconfig (8),
202: .IR datakit (3)
203: .SH SOURCE
204: .B /sys/src/9/*/devdk.c
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.