diff options
Diffstat (limited to 'io/sockets/headers/bsd/bsd.factor')
-rw-r--r-- | io/sockets/headers/bsd/bsd.factor | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/io/sockets/headers/bsd/bsd.factor b/io/sockets/headers/bsd/bsd.factor new file mode 100644 index 0000000..06634c2 --- /dev/null +++ b/io/sockets/headers/bsd/bsd.factor @@ -0,0 +1,22 @@ +! Copyright (C) 2007 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: alien alien.c-types alien.syntax byte-arrays io +kernel math prettyprint ; +IN: io.sockets.headers.bsd + +C-STRUCT: bpfh + { "timeval" "timestamp" } + { "ulong" "caplen" } + { "ulong" "datalen" } + { "ushort" "hdrlen" } ; + +: bpfh. ( bpfh -- ) + [ + bpfh-timestamp "Timestamp: " write + "timeval" heap-size memory>byte-array . + ] keep + [ bpfh-caplen "caplen: " write . ] keep + [ bpfh-datalen "datalen: " write . ] keep + [ bpfh-hdrlen "hdrlen: " write . ] keep + drop ; + |