Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Jan 2002 21:17:55 +0200
From:      "Radoslav Vasilev" <rvasilev@uni-svishtov.bg>
To:        <freebsd-net@freebsd.org>
Subject:   Re Netgraph
Message-ID:  <003301c1a5d4$fe2c4b10$52ad44c1@deckland>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

------=_NextPart_000_0030_01C1A5E5.C19FBE50
Content-Type: text/plain;
	charset="koi8-r"
Content-Transfer-Encoding: quoted-printable

rtfm# more ngdisc.c=20
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>

int main(void)
{
        int d;
        int ldisc;
        ldisc =3D NETGRAPHDISC;
       =20
        if ((d =3D open("/dev/ttyd1", O_NONBLOCK)) =3D=3D -1) {
                perror("open");
        } else {
            printf("descripto # %d\n", d);=20
            if ((ioctl(d, TIOCSETD, &ldisc)) =3D=3D -1) {
                perror("ioctl");
            }
        }
        printf("Netgraph TTY node initialized successfully\nPress any =
key to destroy it");
        getc(stdin);
        close(d);
        exit;
}
rtfm#=20

------=_NextPart_000_0030_01C1A5E5.C19FBE50
Content-Type: text/html;
	charset="koi8-r"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Dkoi8-r" http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2920.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>rtfm# more ngdisc.c <BR>#include=20
&lt;sys/ioctl.h&gt;<BR>#include &lt;stdio.h&gt;<BR>#include=20
&lt;stdlib.h&gt;<BR>#include &lt;fcntl.h&gt;<BR>#include=20
&lt;unistd.h&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>int=20
main(void)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int=20
d;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int=20
ldisc;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ldisc =3D=20
NETGRAPHDISC;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ((d =3D =
open("/dev/ttyd1",=20
O_NONBLOCK)) =3D=3D -1)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;=20
perror("open");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
printf("descripto # %d\n", d);=20
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
if=20
((ioctl(d, TIOCSETD, &amp;ldisc)) =3D=3D -1)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;=20
perror("ioctl");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("Netgraph TTY =
node=20
initialized successfully\nPress any key to destroy=20
it");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
getc(stdin);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
close(d);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
exit;<BR>}<BR>rtfm#=20
</FONT></DIV></BODY></HTML>

------=_NextPart_000_0030_01C1A5E5.C19FBE50--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?003301c1a5d4$fe2c4b10$52ad44c1>