]> gitweb.factorcode.org Git - factor.git/blob - unmaintained/headers/bsd/bsd.factor
06634c28c853330177e2e31c0b4d363ffe3328d1
[factor.git] / unmaintained / headers / bsd / bsd.factor
1 ! Copyright (C) 2007 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien alien.c-types alien.syntax byte-arrays io
4 kernel math prettyprint ;
5 IN: io.sockets.headers.bsd
6
7 C-STRUCT: bpfh
8     { "timeval" "timestamp" }
9     { "ulong" "caplen" }
10     { "ulong" "datalen" }
11     { "ushort" "hdrlen" } ;
12
13 : bpfh. ( bpfh -- )
14     [
15         bpfh-timestamp "Timestamp: " write
16         "timeval" heap-size memory>byte-array .
17     ] keep
18     [ bpfh-caplen "caplen: " write . ] keep
19     [ bpfh-datalen "datalen: " write . ] keep
20     [ bpfh-hdrlen "hdrlen: " write . ] keep
21     drop ;
22