: ip->ba ( ip -- ba ) "." split [ string>number ] map >byte-array ;
-: ipv6->ba ( ip -- ba ) ":" split [ 16 base> ] map [ 2 >be ] map concat ;
+: ipv6->ba ( ip -- ba ) ":" split [ hex> ] map [ 2 >be ] map concat ;
: label->ba ( label -- ba ) [ >byte-array ] [ length ] bi prefix ;
: bit-test ( a b -- ? ) bitand 0 = not ;
-: pointer? ( ba i -- ? ) get-single BIN: 11000000 bit-test ;
+: pointer? ( ba i -- ? ) get-single 0b11000000 bit-test ;
-: pointer ( ba i -- val ) get-double BIN: 0011111111111111 bitand ;
+: pointer ( ba i -- val ) get-double 0b0011111111111111 bitand ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: get-ipv6 ( ba i -- ip )
- dup 16 + subseq 2 group [ be> 16 >base ] map ":" join ;
+ dup 16 + subseq 2 group [ be> >hex ] map ":" join ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: get-header-bits ( ba i -- qr opcode aa tc rd ra z rcode )
get-double
{
- [ 15 >> BIN: 1 bitand ]
- [ 11 >> BIN: 111 bitand opcode-table value-at ]
- [ 10 >> BIN: 1 bitand ]
- [ 9 >> BIN: 1 bitand ]
- [ 8 >> BIN: 1 bitand ]
- [ 7 >> BIN: 1 bitand ]
- [ 4 >> BIN: 111 bitand ]
- [ BIN: 1111 bitand rcode-table value-at ]
+ [ 15 >> 0b1 bitand ]
+ [ 11 >> 0b111 bitand opcode-table value-at ]
+ [ 10 >> 0b1 bitand ]
+ [ 9 >> 0b1 bitand ]
+ [ 8 >> 0b1 bitand ]
+ [ 7 >> 0b1 bitand ]
+ [ 4 >> 0b111 bitand ]
+ [ 0b1111 bitand rcode-table value-at ]
}
cleave ;