Slirp can be configured in 3 different ways: the command line, the
configuration files, and "on-the-fly" configuration by telneting to 10.0.2.0
and entering the commands there.

Options which can appear in a configuration file can also be given on the
command line.  eg:

If your .slirprc file looks like:
redir 5022 21
socket

is the same as running slirp as:
slirp "redir 5022 21" "socket"

The reverse is also true.  eg:

If you run slirp as:
slirp -P -b 14400

you can create your .slirprc file too look like:
-P
-b 14400
[Only ONE command per line is allowed in configuration files]

The 2 types of options can also be mixed. eg:

.slirprc:
-P
-b 14400
redir 5022 21

command line:
slirp -P -b 14400 "redir 5022 21"

Notice that on the command line, any command/option that does not begin with
a '-' or '+', and has spaces in it, MUST be enclosed in quotes.  For example:

The following are all legal:
slirp -P "redir udp 5022 25" -vj -b 14400
slirp "ppp" "baudrate 14400"
slirp ppp "baudrate 14400"
[Notice that even though "ppp" does not begin with a '-' or '+', it does not
need to be enclosed in quotes because it has no spaces in it]

The following are NOT legal:
slirp baudrate 14400
slirp "-b 14400"
[Because "-b" starts with a '-' you must NOT enclose it in quotes]

Easy, eh?

Any option/command that can appear in both .slirprc and telnet 10.0.2.0 is
treated as if it appeared in a configuration file, with the only difference
being that when an address is not given, .slirprc will assume a default IP
of 10.0.2.15 whereas in telnet the source address is used.

A few notes:

* You should have "ppp" or "-P" before any PPP options (because when slirp
parses -P or ppp, it will initialise all related fields, hence clearing
anything that was parsed before it).

* Upon startup, the configuration is done in this order:
	
	1) ~/.slirprc-0
	2) ~/.slirprc
	3) command-line options

This is important because, eg: if you have "initiate-options" in ~/.slirprc-0, and
you run slirp with -P, "initiate-options" will not be valid, because -P will
clear the fact that you want options initiated by slirp (remember, -P should
always come before any PPP options).



And finally, here are all the commands:
Key:
    all options within [] are optional
    usable: refers to where it can be used, ie: "command-line/config-file",
            "telnet", or "anywhere" (which means it can appear in either
            command-line/config-file or telnet).
    command-line: gives the command-line equivalent
    XXX etc.


redir X [start RDISP] [ADDR][:DISPLAY[.SCREEN]]
    redirect a port for use with X
    
    usable: anywhere
    command-line: -X
    options:
	start RDISP	tell slirp to start looking for free ports starting
			from N.  eg: if N = 2, slirp will try to grab port
			6002 then 6003 etc.  this is useful for sites which
			sometimes run their own X server and you don't want
			to nab their port 6000, which they would naturally expect.
    	ADDR		our home ip address, or the address where the x server is
			(if you have a LAN at home to connect more than one machine
			to the net) (default 10.0.2.15 when in ~/.slirprc, the
			source IP address when in command-line)
	DISPLAY		which display to redirect to (default :0)
	SCREEN		which screen to redirect to (default .0)
    Example:
        redir X 10.0.2.15:0.0
    Note:
        this will print the command needed to enter into each shell from
        where you launch your X apps
    See also:
    	show X
    
show X
    show the command that needs to be given to your shell for any X port
    that has been redirected (in case you forget).
    
    usable: telnet
    command-line: NONE
    options:
    	NONE
    Example:
    	show X
    Note:
    	this is useful if you forget the command to give to your shell for
    	X redirection.
    See also:
    	redir X, log start
    
redir [once|time] [udp|tcp] PORT [to] [ADDRESS:]LPORT
    redirect host port to local port using a selected protocol.
    
    usable: anywhere
    command-line: NONE
    Options:
    	once	only allow one redirection [TCP only]
	time	allow redirection to time out [UDP only]
	udp	redirect a UDP port
	tcp	redirect a TCP port [default]
        PORT    port to use on host system
	ADDRESS address of your home machine [default 10.0.2.15]
        LPORT   port to redirect host port to on local system
    Example:
        redir tcp 5021 to 21
                allow users to ftp to your local machine using
                your host's port 21. (ftp your.hosts.name 5021)
    Note:
        if this command is in your .slirprc file and no address is
        specified, it will assume  that your local IP address is 10.0.2.15.
        If you enter the command from the slirp control telnet IP it will
        use the IP address you are accessing with.

baudrate N
    controls the allocation of time to communications across 
    your serial link.  Higher values generally use more of
    the available bandwidth to your modem.  This is _only_
    an internal control value and does _not_ change the physical
    settings for the host port or modem.
    
    usable: anywhere
    command-line: -b
    Options:
        N	change baudrate to N
    Example:
        baudrate 14400
    Note:
        higher numbers generally allow better transfer rates
        for ftp sessions, but interactive sessions could become less
	responsive.  the optimum value is *JUST* when ftp sessions reach
	maximum throughput, but this can be hard to find (especially on
	compressing modems) so you should choose the maximum throughput
	you would expect from your modem.

special|control|host addr ADDRESS
    set ip address aliases and others for slirp.
    
    usable: anywhere
    command-line: none
    Options:
        special address     set the network ip alias for slirp
        control address     only allow access to slirp control 
                            address from ADDRESS.
	host address	    tell slirp the IP address of the host it's
	                    running on.  use this only if slirp can't
			    properly find the host's IP address
    Example:
        special address 10.0.3.0
    Note:
        the ADDRESS for special must end in 0 (zero) and other 
        addresses are classed from this.  The default special
        address is 10.0.2.0 giving the following defined IP's
            10.0.2.0        slirp control telnet IP
            10.0.2.1        slirp exec IP
            10.0.2.2        slirp host alias
	    10.0.2.x        add [pty]exec optional address

add [pty]exec PROGRAM:[ADDRESS:]PORT
    Set program to execute on host  when local machine attempts
    to connect to ADDRESS at port PORT.
    
    usable: anywhere
    command-line: none
    Options:
        exec	establish binary connection to program
	        in the style of inetd.
        ptyexec	establish telnet connection to program
                using telnetd helper application under a
		pseudo-terminal
        PROGRAM	program to exec
	ADDRESS optional address
	PORT	port
    Example:
        add ptyexec csh:55
                A telnet connection to the slirp exec IP 
		(default 10.0.2.1) will start and connect you 
		directly to the csh program on the host. 
		(telnet 10.0.2.1 55)
        add exec nntpd:10.0.2.3:119
                A program that attempts to open port 119 at
                address 10.0.2.3 will be connected to the 
                nntpd program.
    Note:
        the use of the ptyexec form requires the slirp.telnetd
        helper application be available on your path.  also note that
	ADDRESS must be of the form SPECIAL_ADDRESS.xx (10.0.2.xx by default)

[no]compress
    force startup mode for slirp to SLIP or CSLIP.  This 
    overrides the default automatic mode determination.
    Command:
        nocompress    start in SLIP mode
        compress      start in CSLIP mode
    Options:
        NONE
    Note:
        the default method of operation generally performs
        well.  You should only have to use this command if
        you find that your host and local system are failing
        synchronize the connection type.

mtu N
    controls the size of the IP packets sent across the serial
    IP link.  Valid values are <= 1500.
    Options:
        NONE
    Example:
        mtu 1500
                set the mtu to its largest allowable size.
    Note:
        larger values generally improve the performance of
        graphics web browsers and ftp transfers across the
        serial link, at the expense of interactive performance.
        The default value of 552 seems to be a reasonable 
        compromise for connections at 14400 baud.


shell PROGRAM
    set program to execute on EXEC IP default telnet port (23).
    It is the same as
        add ptyexec PROGRAM:23
    Options:
        NONE
    Note:
        by default slirp connects /bin/sh to the exec IP telnet
        port.

help [COMMAND]
    show a brief list of available commands, or more information on
    the named command
    
    
remove [pty]exec PROGRAM:[ADDRESS/]PORT
    reverse the effect of "add [pty]exec".  see "add [pty]exec" for the
    options etc.
    Note:
        you must enter the options exactly as you entered it in add [pty]exec.
    XXX incomplete
    
echo [on|off]
    turn echo on or off, depending on how your client behaves.  "echo" by
    itself will show whether echo is currently on or off.

kill N
    kill the session which has a Socket no. of N.  to find the Socket no. of a particular
    session, use the "stats socket" commands.  see
    "stats" below.
    Note:
        it is recommended you use "close N" instead, as this merely wipes
        out the session, whereas "close N" closes it properly, as a good
        little tcpip-emulator should :)
	
	"kill -1" shouldn't be used, it will kill the first session it finds
        with -1, which usually is the command-line connection.

close N
    close the session which has a Socket no. of N.  same as "kill N", but
    closes it session gracefully.  see "kill N"
    

stats [ip | socket | tcp | vj | udp | mbuf | tty | alltty | others? ]
    show statistics on the given argument
    Options:
        ip	show ip statistics
	socket  show statistics on the currently active sockets.  use this
                to find out which sessions to close/kill as it will also
		show the FD of the session
	tcp     show tcp statistics (packets sent/received/etc)
	udp     same as tcp but for udp
	mbuf    show how many mbufs were allocated, are in use, etc.
	        if the modem is idle, and there are more than 1 mbufs on
		the used list, it suggests an mbuf leak

[pty]exec PROGRAM
    this will execute PROGRAM, and the current command-line session will
    cease to exist, taken over by the PROGRAM. ie: when the program exits,
    you will not get the command-line back, the session will (should) close.

socket
    create a Unix-domain socket and listen() for more interfaces to connect.
    This is also needed for restarting.

log start
    log all the startup output to the file .slirp_start.

add emu SERVICE[:TYPE_OF_SERVICE] [lport:]fport
    Tell slirp to emulate SERVICE when on port lport/fport.
    
    service can be: ftp, ksh, irc, none
    type_of_service can be: throughput, lowdelay
    
    lport can be given if that service needs emulation for, say, servers.
    
    examples:
        if you wish to ftp to somewhere on port 8021, do:
	
	add emu ftp 8021
	
	if your home ftp server is on port 8021, do:
	
	add emu ftp 8021:0
	
	[NOTE: this does NOT mean if you redirect port 8021 for your ftp
	daemon, it refers the the port AT HOME at which ftpd is listening to]
	
	if you telnet somewhere on port 8000, and you wish those packets to
	go on the fastq (ie: so they have a higher priority than, say, ftp
	packets), do:
	
	add emu none:lowdelay 8000
	
	this tells slirp that any packets destined for port 8000 will not
	have any emulation, but it will be set IPTOS_LOWDELAY.

dns DNS_IP
	Give this to slirp if you want to use 10.0.2.3 as an alias for DNS,
        AND slirp guesses wrong for the DNS on startup.

: On a slightly related note, is there a way to set up slirp to open
: a shell when you telnet to 10.0.2.3 (or some other variant) like
: tia would?

Yes, either edit the source and change the defaults (CTL_*), or use the
optional ADDRESS in the add exec and add ptyexec commands.  ie:

add ptyexec /path/to/your/shell:10.0.2.3/23


As an aside, and once again here are the default slirp IP's.
    10.0.2.0    command control telnet IP
    10.0.2.1    exec IP
    10.0.2.2    host alias
    10.0.2.15   default local system IP.

