]> gitweb.factorcode.org Git - factor-unmaintained.git/commitdiff
headers: moving to io.sockets.headers to match IN: declaration.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 22 Jan 2018 22:17:20 +0000 (14:17 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 22 Jan 2018 22:17:20 +0000 (14:17 -0800)
headers/authors.txt [deleted file]
headers/bsd/authors.txt [deleted file]
headers/bsd/bsd.factor [deleted file]
headers/headers.factor [deleted file]
io/sockets/headers/authors.txt [new file with mode: 0644]
io/sockets/headers/bsd/authors.txt [new file with mode: 0644]
io/sockets/headers/bsd/bsd.factor [new file with mode: 0644]
io/sockets/headers/headers.factor [new file with mode: 0644]

diff --git a/headers/authors.txt b/headers/authors.txt
deleted file mode 100644 (file)
index 7c1b2f2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Doug Coleman
diff --git a/headers/bsd/authors.txt b/headers/bsd/authors.txt
deleted file mode 100644 (file)
index 7c1b2f2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Doug Coleman
diff --git a/headers/bsd/bsd.factor b/headers/bsd/bsd.factor
deleted file mode 100644 (file)
index 06634c2..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-! 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 ;
-
diff --git a/headers/headers.factor b/headers/headers.factor
deleted file mode 100644 (file)
index a228e77..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-! Copyright (C) 2007 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien alien.c-types alien.syntax byte-arrays io
-io.sockets kernel structs math math.parser
-prettyprint sequences ;
-IN: io.sockets.headers
-
-C-STRUCT: etherneth
-    { { "char" 6 } "dmac" }
-    { { "char" 6 } "smac" }
-    { "ushort" "type" } ;
-
-: >mac-address ( byte-array -- string )
-    6 memory>byte-array
-    [ >hex 2 48 pad-left ] { } map-as ":" join ;
-
-: etherneth. ( etherneth -- )
-    [ etherneth-dmac "Dest   MAC: " write >mac-address . ] keep
-    [ etherneth-smac "Source MAC: " write >mac-address . ] keep
-    [ etherneth-type "Type      : " write .h ] keep
-    drop ;
-
-C-STRUCT: iph
-    { "uchar" "hl|v" } ! hl is 4 bits, v is 4 bits
-    { "uchar" "tos" }
-    { "short" "len" }
-    { "short" "id" }
-    { "short" "off" }
-    { "uchar" "ttl" }
-    { "uchar" "p" }
-    { "ushort" "ip_sum" }
-    { "uint" "ip_src" }
-    { "uint" "ip_dst" } ;
-
-: iph-hl ( iph -- n )
-    iph-hl|v -4 shift ;
-
-: iph-v ( iph -- n )
-    iph-hl|v 0x0f bitand ;
-
-: set-iph-hl ( n iph -- )
-    [ iph-hl|v 0x0f bitand >r 4 shift r> bitor ] keep
-    set-iph-hl|v ;
-
-: set-iph-v ( n iph -- )
-    [ iph-hl|v 0xf0 bitand bitor ] keep
-    set-iph-hl|v ;
-
-C-STRUCT: icmph
-    { "uchar" "type" }
-    { "uchar" "code" }
-    { "short" "chksum" }
-    { "ushort" "id" }
-    { "ushort" "seq" } ;
-
-C-STRUCT: udph
-    { "ushort" "sport" }
-    { "ushort" "dport" }
-    { "ushort" "len" }
-    { "ushort" "check" } ;
-
-C-STRUCT: tcph
-    { "ushort" "sport" }
-    { "ushort" "dport" }
-    { "uint" "seq" }
-    { "uint" "ack" }
-    { "uchar" "x2|off" }
-    { "uchar" "flags" }
-    { "ushort" "win" }
-    { "ushort" "sum" }
-    { "ushort" "urp" } ;
-
-: tcph-x2 ( iph -- n )
-    tcph-x2|off -4 shift ;
-
-: tcph-off ( iph -- n )
-    tcph-x2|off 0x0f bitand ;
-
-: set-tcph-x2 ( n iph -- )
-    [ tcph-x2|off 0x0f bitand >r 4 shift r> bitor ] keep
-    set-tcph-x2|off ;
-
-: set-tcph-off ( n iph -- )
-    [ tcph-x2|off 0x0f bitand bitor ] keep
-    set-tcph-x2|off ;
-
diff --git a/io/sockets/headers/authors.txt b/io/sockets/headers/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/io/sockets/headers/bsd/authors.txt b/io/sockets/headers/bsd/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/io/sockets/headers/bsd/bsd.factor b/io/sockets/headers/bsd/bsd.factor
new file mode 100644 (file)
index 0000000..06634c2
--- /dev/null
@@ -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 ;
+
diff --git a/io/sockets/headers/headers.factor b/io/sockets/headers/headers.factor
new file mode 100644 (file)
index 0000000..a228e77
--- /dev/null
@@ -0,0 +1,86 @@
+! Copyright (C) 2007 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types alien.syntax byte-arrays io
+io.sockets kernel structs math math.parser
+prettyprint sequences ;
+IN: io.sockets.headers
+
+C-STRUCT: etherneth
+    { { "char" 6 } "dmac" }
+    { { "char" 6 } "smac" }
+    { "ushort" "type" } ;
+
+: >mac-address ( byte-array -- string )
+    6 memory>byte-array
+    [ >hex 2 48 pad-left ] { } map-as ":" join ;
+
+: etherneth. ( etherneth -- )
+    [ etherneth-dmac "Dest   MAC: " write >mac-address . ] keep
+    [ etherneth-smac "Source MAC: " write >mac-address . ] keep
+    [ etherneth-type "Type      : " write .h ] keep
+    drop ;
+
+C-STRUCT: iph
+    { "uchar" "hl|v" } ! hl is 4 bits, v is 4 bits
+    { "uchar" "tos" }
+    { "short" "len" }
+    { "short" "id" }
+    { "short" "off" }
+    { "uchar" "ttl" }
+    { "uchar" "p" }
+    { "ushort" "ip_sum" }
+    { "uint" "ip_src" }
+    { "uint" "ip_dst" } ;
+
+: iph-hl ( iph -- n )
+    iph-hl|v -4 shift ;
+
+: iph-v ( iph -- n )
+    iph-hl|v 0x0f bitand ;
+
+: set-iph-hl ( n iph -- )
+    [ iph-hl|v 0x0f bitand >r 4 shift r> bitor ] keep
+    set-iph-hl|v ;
+
+: set-iph-v ( n iph -- )
+    [ iph-hl|v 0xf0 bitand bitor ] keep
+    set-iph-hl|v ;
+
+C-STRUCT: icmph
+    { "uchar" "type" }
+    { "uchar" "code" }
+    { "short" "chksum" }
+    { "ushort" "id" }
+    { "ushort" "seq" } ;
+
+C-STRUCT: udph
+    { "ushort" "sport" }
+    { "ushort" "dport" }
+    { "ushort" "len" }
+    { "ushort" "check" } ;
+
+C-STRUCT: tcph
+    { "ushort" "sport" }
+    { "ushort" "dport" }
+    { "uint" "seq" }
+    { "uint" "ack" }
+    { "uchar" "x2|off" }
+    { "uchar" "flags" }
+    { "ushort" "win" }
+    { "ushort" "sum" }
+    { "ushort" "urp" } ;
+
+: tcph-x2 ( iph -- n )
+    tcph-x2|off -4 shift ;
+
+: tcph-off ( iph -- n )
+    tcph-x2|off 0x0f bitand ;
+
+: set-tcph-x2 ( n iph -- )
+    [ tcph-x2|off 0x0f bitand >r 4 shift r> bitor ] keep
+    set-tcph-x2|off ;
+
+: set-tcph-off ( n iph -- )
+    [ tcph-x2|off 0x0f bitand bitor ] keep
+    set-tcph-x2|off ;
+