# $Id: tits.conf,v 1.17 2011/01/15 12:35:38 steve Exp $

# Each `service' is defined using the service keyword. The `name'
# parameter is optional and will be printed when clients connect.

service "Bart's Console" {

	# A service can have one or more clients. These clients will receive
	# all output from the `server' and can optionally send character *to*
	# the server.
	#
	# In order to enable telnet(1) (or any other network-based) access,
	# at least one `listener' client must be declared to manage setting
	# up the connections.
	#
	# Any number of listeners can be specified, although each must bind
	# to a unique address/port pair.

	client "listener" {

		# A listener needs to know what address to listen on. This can
		# be a wildcard ("any" | "all" | "*.*"), an IPv4/v6 address or
		# domain name which resolves to the address of a local
		# interface.
		#
		# The port number specifies the TCP port number on which to
		# listen.

		address "oor-wullie.mctavish.co.uk";
		port 4002;

		# You can restrict the number of network clients which can
		# connect to this listener at any one time. Any connections
		# over this limit will see a `service full' message before
		# being disconnected.

		maxclients 4;

		# It may be desirable to filter incoming connections using
		# the hosts_access(5) database; aka TCP Wrappers.
		# Enable the feature on a per address/port basis using
		# the following boolean.
		# If you specified the `port' as a symbolic service name from
		# /etc/services, this will be used as the `daemon' part of
		# the `daemon,client' pair documented in hosts_access(5).
		# If you specified the `port' as an integer, the default
		# daemon of `tits' will be used.

		tcpwrappers no;

		# Allow connections to this listener using the telnet protocol

		protocol "telnet" {

			# You can specify that clients can only establish
			# `readonly' telnet sessions via this listener. These
			# clients will be able to see all server output, but
			# will not be able to pass input *to* the server.

			readonly yes;

			# `allowbreak' defaults to `no' anyway if `readonly'
			# is set. This permits/denies telnet clients to send
			# serial line BREAKs to the server.

			allowbreak no;
		}
	}

	client "listener" {
		address localhost;
		port 4002;

		# By default, this will set `readonly' to `no' and `allowbreak'
		# to `yes'.

		protocol "telnet";
	}

	client "listener" {
		# This listener provides "raw" access to the server, which
		# basically provides an 8-bit clean binary interface to the
		# service. This can be used to upload files using xmodem,
		# for example.

		port 5002;

		protocol "raw" {
			suppressbanner yes;
		}
	}

	# The `logger' client writes all server output to the specified
	# log file.

	client "logger" {

		file "/var/log/barts-console.log";
		trunc yes;
		mode 0644;
	}

	# The "masterpty" client provides pseudo-terminal access to
	# a server. A symbolic link, specified by "symlinkname", will
	# be created, the target of which is the slave device associated
	# with the client.
	client "masterpty" {
		symlinkname "/var/run/tty.bart";

		# Specify readonly, and all data *from* the application
		# connected to the slave device will be discarded.
		#readonly yes;
	}


	# The server itself.

	server "tty" {
		device "/dev/tty01";
		ispeed 9600;
		ospeed 9600;
		clocal yes;

		# You can also specify the following:
		# crtscts on;
		# xonxoff on;
		# closeidle yes;
	}
}


# This server provides reverse telnet access to the above service
# via a pseudotty.

service "Reverse Telnet to Bart's Console" {

	# The "masterpty" client provides pseudo-terminal access to
	# a server. A symbolic link, specified by "symlinkname", will
	# be created, the target of which is the slave device associated
	# with the client.
	client "masterpty" {
		symlinkname "/var/run/tty.bart2";

		# Specify readonly, and all data *from* the application
		# connected to the slave device will be discarded.
		#readonly yes;
	}

	# The "rtelnet" server will initiate a network connection to
	# the specified host/port. Data to/from the server will be
	# available to any clients specified for this service.
	# This is most useful with the "masterpty" client whereby the
	# local pseudo-tty device can be associated with a remote
	# terminal server, for example. The "closeidle yes" directive
	# can be used to ensure the connection is only established
	# when a program opens the slave pseudo-tty.
	server "rtelnet" {
		host localhost;
		port 5002;
		closeidle yes;
	}
}


# This server provides reverse telnet access to some other terminal server

service "Reverse Telnet to Annex" {

	# Clients connecting to port localhost:8001 will be connected
	# via tits to the telnet server specified in the "server" section.
	# This way you can support multiple connections to what would
	# otherwise be a single-session terminal server.
	client "listener" {
		address localhost;
		port 8001;
		protocol telnet;
	}

	# The "rtelnet" server will initiate a network connection to
	# the specified host/port. Data to/from the server will be
	# available to any clients specified for this service.
	server "rtelnet" {
		host 192.168.10.1;
		port 5002;
		closeidle no;
	}
}


# This server demonstrates a hot-pluggable tty device

service "USB Modem" {
	client "listener" {
		port 4003;
		protocol "telnet";
	}

	server "tty" {
		device "/dev/ttyU0";
		speed 115200;
		clocal yes;
		pluggable yes;
	}
}
