Clarify that the input hook requires binary packet data. Instead of

referencing an omitted example, include a short (Perl) example that
queues an ICMP Echo message.
This commit is contained in:
Ed Maste 2006-10-22 21:33:57 +00:00
parent 2a53696fb8
commit 58b1cfde0d

View File

@ -1,4 +1,4 @@
.\" Copyright 2002 Sandvine Inc.
.\" Copyright 2002-2006 Sandvine Inc.
.\" All rights reserved.
.\"
.\" Subject to the following obligations and disclaimer of warranty, use and
@ -32,7 +32,7 @@
.\" Author: Dave Chapeskie <dchapeskie@sandvine.com>
.\" $FreeBSD$
.\"
.Dd December 5, 2005
.Dd October 22, 2006
.Dt NG_SOURCE 4
.Os
.Sh NAME
@ -223,19 +223,27 @@ node can be given its own name like this:
After which it can be referred to as
.Dq Li src0: .
.Pp
Once created, packets need to be sent to the node, the TCL net package
can be used to generate these packets:
Once created, packets can be sent to the node as raw binary data.
Each packet must be delivered in a separate netgraph message.
.Pp
[Sandvine specific TCL code example omitted]
.Pp
To feed the output of the above TCL script to the
The following example uses a short Perl script to convert the hex
representation of an ICMP packet to binary and deliver it to the
.Nm source
node's
.Va input
hook via
.Xr nghook 8 :
.Pp
.Dl "tcl genPacket | nghook bge0:orphans input"
.Bd -literal -offset indent
perl -pe 's/(..)[ \et\en]*/chr(hex($1))/ge' <<EOF | nghook src0: input
ff ff ff ff ff ff 00 00 00 00 00 00 08 00 45 00
00 54 cb 13 00 00 40 01 b9 87 c0 a8 2b 65 0a 00
00 01 08 00 f8 d0 c9 76 00 00 45 37 01 73 00 01
04 0a 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15
16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25
26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35
36 37
EOF
.Ed
.Pp
To check that the node has queued these packets you can get the node
statistics: