]> git.lizzy.rs Git - plan9front.git/blob - sys/man/3/loopback
merge
[plan9front.git] / sys / man / 3 / loopback
1 .TH LOOPBACK 3 
2 .SH NAME
3 loopback \- network link simulation
4 .SH SYNOPSIS
5 .nf
6 .B bind -a #X /net
7
8 .BI /net/loopback n /[0-1]
9 .BI /net/loopback n /[0-1]/data
10 .BI /net/loopback n /[0-1]/ctl
11 .BI /net/loopback n /[0-1]/status
12 .BI /net/loopback n /[0-1]/stats
13
14 .fi
15 .SH DESCRIPTION
16 The loopback interface,
17 .BI /net/loopback n\f1,
18 is a directory containing two subdirectories,
19 one for each end of a simulated network link.
20 The number
21 .I n
22 is the device number of the link, permitting multiple links to be used on a single machine.
23 .PP
24 Each directory contains files to control the associated connection,
25 receive and send data,
26 monitor the simulation parameters,
27 and supply statistics.
28 .PP
29 The
30 .B data
31 files for the two directories are cross-connected.
32 Writes to one are divided into packets of at most a certain size,
33 typically 32768 bytes,
34 written to a flow-controlled output queue,
35 transferred across the link,
36 and put into an input queue where it is readable from the other
37 .B data
38 file.
39 .PP
40 Options are set by writing to the
41 .B ctl
42 file for the receiving end of the link,
43 and are reported in the same format by reading
44 .BR status .
45 The following options are supported.
46 .TP
47 .BI delay \ latency\ bytedelay
48 Control the time a packet takes in the link.
49 A packet
50 .B n
51 bytes long takes
52 .I bytedelay
53 .B *
54 .B n
55 nanoseconds to exit the output queue and
56 is available for reading
57 .I latency
58 nanoseconds later.
59 .TP
60 .BI droprate \ n
61 Randomly drop approximately one out of
62 .B n
63 packets.
64 If zero drop no packets.
65 .TP
66 .BR indrop \ [01]
67 Disallow or allow packets to be dropped if the input queue overflows.
68 .TP
69 .BI limit \ n
70 Set the input and output queues to hold at most
71 .I n
72 bytes.
73 .TP
74 .B reset
75 Clear all of the statistics recorded for the link.
76 .PP
77 Reading
78 .B stats
79 returns a list of 4 tagged numbers representing:
80 .EX
81 .ft 1
82         packets sent to this receiver
83         bytes sent to this receiver
84         packets dropped due to droprate
85         packets dropped due to input queue overflows
86 .EE
87 .SH SOURCE
88 .B /sys/src/9/port/devloopback.c