14cf49a43SJulian Elischer.\" Copyright (c) 1996-1999 Whistle Communications, Inc. 24cf49a43SJulian Elischer.\" All rights reserved. 34cf49a43SJulian Elischer.\" 44cf49a43SJulian Elischer.\" Subject to the following obligations and disclaimer of warranty, use and 54cf49a43SJulian Elischer.\" redistribution of this software, in source or object code forms, with or 64cf49a43SJulian Elischer.\" without modifications are expressly permitted by Whistle Communications; 74cf49a43SJulian Elischer.\" provided, however, that: 84cf49a43SJulian Elischer.\" 1. Any and all reproductions of the source or object code must include the 94cf49a43SJulian Elischer.\" copyright notice above and the following disclaimer of warranties; and 104cf49a43SJulian Elischer.\" 2. No rights are granted, in any manner or form, to use Whistle 114cf49a43SJulian Elischer.\" Communications, Inc. trademarks, including the mark "WHISTLE 124cf49a43SJulian Elischer.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as 134cf49a43SJulian Elischer.\" such appears in the above copyright notice or in the software. 144cf49a43SJulian Elischer.\" 154cf49a43SJulian Elischer.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND 164cf49a43SJulian Elischer.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO 174cf49a43SJulian Elischer.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, 184cf49a43SJulian Elischer.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF 194cf49a43SJulian Elischer.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. 204cf49a43SJulian Elischer.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY 214cf49a43SJulian Elischer.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS 224cf49a43SJulian Elischer.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE. 234cf49a43SJulian Elischer.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES 244cf49a43SJulian Elischer.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING 254cf49a43SJulian Elischer.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 264cf49a43SJulian Elischer.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR 274cf49a43SJulian Elischer.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY 284cf49a43SJulian Elischer.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 294cf49a43SJulian Elischer.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 304cf49a43SJulian Elischer.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY 314cf49a43SJulian Elischer.\" OF SUCH DAMAGE. 324cf49a43SJulian Elischer.\" 33eddc45e7SJeroen Ruigrok van der Werven.\" Author: Archie Cobbs <archie@FreeBSD.org> 344cf49a43SJulian Elischer.\" 354cf49a43SJulian Elischer.\" $FreeBSD$ 364cf49a43SJulian Elischer.\" $Whistle: ng_tty.8,v 1.5 1999/01/25 23:46:28 archie Exp $ 374cf49a43SJulian Elischer.\" 384cf49a43SJulian Elischer.Dd January 19, 1999 39bec35b9aSArchie Cobbs.Dt NG_TTY 4 4051291597SJulian Elischer.Os FreeBSD 414cf49a43SJulian Elischer.Sh NAME 424cf49a43SJulian Elischer.Nm ng_tty 434cf49a43SJulian Elischer.Nd netgraph node type that is also a line discipline 444cf49a43SJulian Elischer.Sh SYNOPSIS 45b58a8a3bSJulian Elischer.Fd #include <sys/ttycom.h> 464cf49a43SJulian Elischer.Fd #include <netgraph/ng_message.h> 474cf49a43SJulian Elischer.Fd #include <netgraph/ng_tty.h> 484cf49a43SJulian Elischer.Sh DESCRIPTION 494cf49a43SJulian ElischerThe 504cf49a43SJulian Elischer.Nm tty 514cf49a43SJulian Elischernode type is both a netgraph node type and a line discipline. 52b58a8a3bSJulian ElischerA new node is created when the corresponding line discipline, 53b58a8a3bSJulian Elischer.Dv NETGRAPHDISC , 54b58a8a3bSJulian Elischeris registered on a tty device (see 5551291597SJulian Elischer.Xr tty 4 ) . 564cf49a43SJulian Elischer.Pp 574cf49a43SJulian ElischerThe node has a single hook called 584cf49a43SJulian Elischer.Dv hook . 594cf49a43SJulian ElischerIncoming bytes received on the tty device are sent out on this hook, 604cf49a43SJulian Elischerand frames received on 614cf49a43SJulian Elischer.Dv hook 624cf49a43SJulian Elischerare transmitted out on the tty device. 634cf49a43SJulian ElischerNo modification to the data is performed in either direction. 644cf49a43SJulian ElischerWhile the line discipline is installed on a tty, the normal 654cf49a43SJulian Elischerread and write operations are unavailable, returning 664cf49a43SJulian Elischer.Er EIO . 674cf49a43SJulian Elischer.Pp 6851291597SJulian ElischerThe node supports an optional 6951291597SJulian Elischer.Dq hot character . 7051291597SJulian ElischerIf set to non-zero, incoming 714cf49a43SJulian Elischerdata from the tty device is queued until this character is seen. 724cf49a43SJulian ElischerThis avoids sending lots of mbufs containing a small number of bytes, 734cf49a43SJulian Elischerbut introduces potentially infinite latency. 744cf49a43SJulian ElischerThe default hot character is 0x7e, consistent with 754cf49a43SJulian Elischer.Dv hook 764cf49a43SJulian Elischerbeing connected to a 77bec35b9aSArchie Cobbs.Xr ng_async 4 784cf49a43SJulian Elischertype node. The hot character has no effect on the transmission of data. 794cf49a43SJulian Elischer.Pp 804cf49a43SJulian ElischerThe node will attempt to give itself the same netgraph name as the name 814cf49a43SJulian Elischerof the tty device. 824cf49a43SJulian ElischerIn any case, information about the node is available via the netgraph 834cf49a43SJulian Elischer.Xr ioctl 2 844cf49a43SJulian Elischercommand 854cf49a43SJulian Elischer.Dv NGIOCGINFO . 864cf49a43SJulian ElischerThis command returns a 874cf49a43SJulian Elischer.Dv "struct nodeinfo" 884cf49a43SJulian Elischersimilar to the 894cf49a43SJulian Elischer.Dv NGM_NODEINFO 904cf49a43SJulian Elischernetgraph control message. 914cf49a43SJulian Elischer.Sh HOOKS 924cf49a43SJulian ElischerThis node type supports the following hooks: 934cf49a43SJulian Elischer.Pp 944cf49a43SJulian Elischer.Bl -tag -width foobar 954cf49a43SJulian Elischer.It Dv hook 964cf49a43SJulian Elischer.Xr tty 4 974cf49a43SJulian Elischerserial data contained in 984cf49a43SJulian Elischer.Dv mbuf 994cf49a43SJulian Elischerstructures, with arbitrary inter-frame boundaries. 1004cf49a43SJulian Elischer.El 1014cf49a43SJulian Elischer.Sh CONTROL MESSAGES 1024cf49a43SJulian ElischerThis node type supports the generic control messages, plus the following: 1034cf49a43SJulian Elischer.Bl -tag -width foo 1044cf49a43SJulian Elischer.It Dv NGM_TTY_SET_HOTCHAR 1054cf49a43SJulian ElischerThis command takes an integer argument and sets the hot character 1064cf49a43SJulian Elischerfrom the lower 8 bits. A hot character of zero disables queueing, 1074cf49a43SJulian Elischerso that all received data is forwarded immediately. 1084cf49a43SJulian Elischer.It Dv NGM_TTY_GET_HOTCHAR 1094cf49a43SJulian ElischerReturns an integer containing the current hot character in the lower 1104cf49a43SJulian Elischereight bits. 1113136363fSRuslan Ermilov.El 1124cf49a43SJulian Elischer.Sh SHUTDOWN 1134cf49a43SJulian ElischerThis node shuts down when the corresponding device is closed 1144cf49a43SJulian Elischer(or the line discipline is uninstalled on the device). 1154cf49a43SJulian ElischerThe 1164cf49a43SJulian Elischer.Dv NGM_SHUTDOWN 1174cf49a43SJulian Elischercontrol message is not valid, and always returns the error 1184cf49a43SJulian Elischer.Er EOPNOTSUPP . 1194cf49a43SJulian Elischer.Sh BUGS 12051291597SJulian ElischerThe serial driver code also has a notion of a 12151291597SJulian Elischer.Dq hot character . 1224cf49a43SJulian ElischerUnfortunately, this value is statically defined in terms of the 1234cf49a43SJulian Elischerline discipline and cannot be changed. 1244cf49a43SJulian ElischerTherefore, if a hot character other than 0x7e (the default) is set for the 12551291597SJulian Elischer.Nm 1264cf49a43SJulian Elischernode, the node has no way to convey this information to the 1274cf49a43SJulian Elischerserial driver, and sub-optimal performance may result. 1284cf49a43SJulian Elischer.Sh SEE ALSO 1294cf49a43SJulian Elischer.Xr ioctl 2 , 1304cf49a43SJulian Elischer.Xr netgraph 4 , 131bec35b9aSArchie Cobbs.Xr ng_async 4 , 1325521ff5aSRuslan Ermilov.Xr tty 4 , 133bec35b9aSArchie Cobbs.Xr ngctl 8 13451291597SJulian Elischer.Sh HISTORY 13551291597SJulian ElischerThe 13651291597SJulian Elischer.Nm 13751291597SJulian Elischernode type was implemented in 13851291597SJulian Elischer.Fx 4.0 . 13951291597SJulian Elischer.Sh AUTHORS 140eddc45e7SJeroen Ruigrok van der Werven.An Archie Cobbs Aq archie@FreeBSD.org 141