chiark / gitweb /
New blockcipher mac stuff. New hbytes clockincrement.
[chiark-tcl.git] / base / tables-examples.tct
index 13a3e5d68a05ab9629c4b254c538eb3e3fab6e51..c130136bc094ba3079aa276d07cd5ce824fb0fb5 100644 (file)
@@ -1,15 +1,57 @@
 Type hb:                       HBytes_Value @
 Init hb                                hbytes_sentinel(&@);
+
 Type hbv:                      HBytes_Var @
 Init hbv                       @.hb=0; @.obj=0; @.var=0;
 Fini hbv                       fini_hbv(ip, rc, &@);
 
+Type sockaddr:                 SockAddr_Value @
+Init sockaddr                  sockaddr_clear(&@);
+
+Type sockid:                   DgramSockID @
+Type ulong:                    unsigned long @
+
 H-Include      "hbytes.h"
 
-Untabled
+Table toplevel TopLevel_Command
        hbytes
                subcmd  enum(HBytes_SubCommand, "hbytes subcommand")
-               obj     ...
+               ...     obj
+       dgram-socket
+               subcmd  enum(DgramSocket_SubCommand,"dgram-socket subcommand")
+               ...     obj
+       ulong
+               subcmd  enum(ULong_SubCommand,"ulong subcommand")
+               ...     obj
+
+Table ulong ULong_SubCommand
+       shift
+               right   charfrom("lr", "shift direction")
+               v       ulong
+               bits    int
+               =>      ulong
+       mask
+               a       ulong
+               b       ulong
+               =>      ulong
+       compare
+               a       ulong
+               b       ulong
+               =>      int
+       ul2int
+               v       ulong
+               =>      int
+       int2ul
+               v       int
+               =>      ulong
+       ul2bitfields
+               value   ulong
+               ...     obj
+               =>      int
+       bitfields2ul
+               base    ulong
+               ...     obj
+               =>      ulong
 
 Table hbytes HBytes_SubCommand
        raw2h
@@ -18,17 +60,41 @@ Table hbytes HBytes_SubCommand
        h2raw
                hex     hb
                =>      obj
+       ulong2h
+               value   ulong
+               =>      hb
+       h2ulong
+               hex     hb
+               =>      ulong
+       ushort2h
+               value   ulong
+               =>      hb
+       h2ushort
+               hex     hb
+               =>      ulong
+       length
+               v       hb
+               =>      int
+       compare
+               a       hb
+               b       hb
+               =>      int
+       range
+               v       hb
+               start   int
+               size    int
+               =>      hb
        prepend
                v       hbv
-               str     ...
+               ...     str
        append
                v       hbv
-               str     ...
+               ...     str
        rep-info
-               v       hb
+               v       obj
                =>      obj
        concat
-               str     ...
+               ...     str
                =>      hb
        unprepend
                v       hbv
@@ -42,40 +108,81 @@ Table hbytes HBytes_SubCommand
                v       hbv
                length  int
                =>      hb
-       pkcs5
-               meth    enum(PadMethod, "hbytes pad subcommand")
-               obj     ...
-#      blockcipher
-#              encrypt charfrom("de","encrypt/decrypt")
-#              v       hbv
-#              alg     enum(BlockCipherAlgInfo, "alg")
-#              mode    enum(BlockCipherModeInfo, "mode")
-#              ?iv     hb
-#              =>      hb
-#      hash
-#              alg     enum(HashAlgInfo, "hash alg")
-#              message hb
-#              =>      hb
-#      hmac
-#              alg     enum(HashAlgInfo, "hash alg for hmac")
-#              message hb
-#              key     hb
-#              maclen  int
-#              =>      hb
-
-Table padmethod PadMethod
-       pa      1
-               v       hbv
-               alg     enum(BlockCipherAlgInfo, "pad alg")
-       ua      0
+       overwrite
                v       hbv
-               alg     enum(BlockCipherAlgInfo, "pad alg")
-       pn      1
+               start   int
+               sub     hb
+       trimleft
                v       hbv
-               block   int
-       un      0
+       zeroes
+               length  int
+               =>      hb
+       repeat
+               v       hb
+               count   int
+               =>      hb
+       clockincrement
+               value   hbv
+               change  int
+               =>      int
+       random
+               length  int
+               =>      hb
+       pkcs5
+               meth    enum(PadMethod, "hbytes pad subcommand")
                v       hbv
-               block   int
+               block   obj
+               =>      int
+       blockcipher
+               op      enum(BlockCipherOp, "op")
+               ...     obj
+       hash
+               alg     enum(HashAlgInfo, "hash alg")
+               message hb
+               =>      hb
+       hmac
+               alg     enum(HashAlgInfo, "hash alg for hmac")
+               message hb
+               key     obj
+               ?maclen obj
+               =>      hb
+
+Table dgram_socket DgramSocket_SubCommand
+       create
+               local   sockaddr
+               =>      sockid
+       close
+               sock    sockid
+       transmit
+               sock    sockid
+               data    hb
+               remote  sockaddr
+       on-receive
+               sock    sockid
+               ?script obj
+
+Table blockcipherop BlockCipherOp
+       e       1
+               v       hbv
+               alg     enum(BlockCipherAlgInfo, "alg")
+               key     obj
+               mode    enum(BlockCipherModeInfo, "mode")
+               ?iv     hb
+               =>      hb
+       d       0
+               v       hbv
+               alg     enum(BlockCipherAlgInfo, "alg")
+               key     obj
+               mode    enum(BlockCipherModeInfo, "mode")
+               ?iv     hb
+               =>      hb
+       mac     -1
+               msg     hb
+               alg     enum(BlockCipherAlgInfo, "alg")
+               key     obj
+               mode    enum(BlockCipherModeInfo, "mode")
+               iv      hb
+               =>      hb
 
-EntryExtra PadMethod
-       int pad;
+EntryExtra BlockCipherOp
+       int encrypt;