chiark / gitweb /
mask-map amend implemented, but untested
[chiark-tcl.git] / base / tables-examples.tct
index 9a19c5a7676467fb401baebdc431c1b4f79e3fc9..9165827456f282900c00e23fafc350860a70cfd6 100644 (file)
@@ -2,14 +2,24 @@ Type hb:                      HBytes_Value @
 Init hb                                hbytes_sentinel(&@);
 
 Type hbv:                      HBytes_Var @
 Init hb                                hbytes_sentinel(&@);
 
 Type hbv:                      HBytes_Var @
-Init hbv                       @.hb=0; @.obj=0; @.var=0; @.copied=0;
-Fini hbv                       fini_hbv(ip, rc, &@);
+Init hbv                       @.hb=0; init_somethingv(&@.sth);
+Fini hbv                       fini_somethingv(ip, rc, &@.sth);
+
+Type constv(Tcl_ObjType*):     Tcl_Obj *@
+
+Type maskmapv:                 MaskMap_Var @
+Init maskmapv                  @.mm=0; init_somethingv(&@.sth);
+Fini maskmapv                  fini_somethingv(ip, rc, &@.sth);
 
 Type sockaddr:                 SockAddr_Value @
 Init sockaddr                  sockaddr_clear(&@);
 
 
 Type sockaddr:                 SockAddr_Value @
 Init sockaddr                  sockaddr_clear(&@);
 
-Type sockid:                   DgramSockID @
-Type ulong:                    unsigned long @
+Type iddata(IdDataTable *tab): void *@
+Type ulong:                    uint32_t @
+Type long:                     long @
+Type string:                   const char *@
+
+Type charfrom(const char *opts, const char *what):     int
 
 H-Include      "hbytes.h"
 
 
 H-Include      "hbytes.h"
 
@@ -20,29 +30,56 @@ Table toplevel TopLevel_Command
        dgram-socket
                subcmd  enum(DgramSocket_SubCommand,"dgram-socket subcommand")
                ...     obj
        dgram-socket
                subcmd  enum(DgramSocket_SubCommand,"dgram-socket subcommand")
                ...     obj
+       tuntap-socket-raw
+           subcmd enum(TunSocket_SubCommand,"tuntap-socket-raw subcommand")
+           ... obj
        ulong
                subcmd  enum(ULong_SubCommand,"ulong subcommand")
                ...     obj
 
        ulong
                subcmd  enum(ULong_SubCommand,"ulong subcommand")
                ...     obj
 
+Table maskmap MaskMap_SubCommand
+       lookup
+               map     constv(&maskmap_type)
+               addr    hb
+               ?def    obj
+               =>      obj
+       amend
+               map     maskmapv
+               prefix  obj
+               preflen obj
+               data    obj
+
 Table ulong ULong_SubCommand
 Table ulong ULong_SubCommand
-       shift
-               right   charfrom("lr", "shift direction")
+       ul2int
                v       ulong
                v       ulong
-               bits    int
+               =>      int
+       int2ul
+               v       int
                =>      ulong
        mask
                a       ulong
                b       ulong
                =>      ulong
                =>      ulong
        mask
                a       ulong
                b       ulong
                =>      ulong
+       add
+               a       ulong
+               b       ulong
+               =>      ulong
+       multiply
+               a       ulong
+               b       ulong
+               =>      ulong
+       subtract
+               a       ulong
+               b       ulong
+               =>      ulong
        compare
                a       ulong
                b       ulong
                =>      int
        compare
                a       ulong
                b       ulong
                =>      int
-       ul2int
+       shift
+               right   charfrom("lr", "shift direction")
                v       ulong
                v       ulong
-               =>      int
-       int2ul
-               v       int
+               bits    int
                =>      ulong
        ul2bitfields
                value   ulong
                =>      ulong
        ul2bitfields
                value   ulong
@@ -60,18 +97,12 @@ Table hbytes HBytes_SubCommand
        h2raw
                hex     hb
                =>      obj
        h2raw
                hex     hb
                =>      obj
-       ulong2h
-               value   ulong
-               =>      hb
-       h2ulong
-               hex     hb
-               =>      ulong
        ushort2h
        ushort2h
-               value   ulong
+               value   long
                =>      hb
        h2ushort
                hex     hb
                =>      hb
        h2ushort
                hex     hb
-               =>      ulong
+               =>      long
        length
                v       hb
                =>      int
        length
                v       hb
                =>      int
@@ -121,18 +152,18 @@ Table hbytes HBytes_SubCommand
                v       hb
                count   int
                =>      hb
                v       hb
                count   int
                =>      hb
-       clockincrement
-               value   hbv
-               change  int
-               =>      int
+       xor
+               v       hbv
+               d       hb
        random
                length  int
                =>      hb
        random
                length  int
                =>      hb
-       pkcs5
-               meth    enum(PadMethod, "hbytes pad subcommand")
+       pad
+               op      enum(PadOp, "hbytes pad subcommand")
                v       hbv
                v       hbv
-               block   obj
-               =>      int
+               blocksz obj
+               meth    enum(PadMethodInfo, "pad method")
+               ...     methargs
        blockcipher
                op      enum(BlockCipherOp, "op")
                ...     obj
        blockcipher
                op      enum(BlockCipherOp, "op")
                ...     obj
@@ -146,19 +177,50 @@ Table hbytes HBytes_SubCommand
                key     obj
                ?maclen obj
                =>      hb
                key     obj
                ?maclen obj
                =>      hb
+       hash-prop
+               prop    enum(HashAlgPropInfo, "prop")
+               alg     enum(HashAlgInfo, "alg")
+               =>      int
+       mask-map
+               subcmd  enum(MaskMap_SubCommand, "hbytes mask-map subcommand")
+               ...     obj
+
+Table padmethodinfo PadMethodInfo
+       pkcs5
+               =>      int
+       rfc2406
+               nxthdr  obj
+               =>      int
 
 Table dgram_socket DgramSocket_SubCommand
        create
                local   sockaddr
 
 Table dgram_socket DgramSocket_SubCommand
        create
                local   sockaddr
-               =>      sockid
+               =>      iddata(&dgram_socks)
        close
        close
-               sock    sockid
+               sock    iddata(&dgram_socks)
        transmit
        transmit
-               sock    sockid
+               sock    iddata(&dgram_socks)
                data    hb
                remote  sockaddr
        on-receive
                data    hb
                remote  sockaddr
        on-receive
-               sock    sockid
+               sock    iddata(&dgram_socks)
+               ?script obj
+
+Table tuntap_socket_raw TunSocket_SubCommand
+       create
+               ?ifname string
+               =>      iddata(&tuntap_socks)
+       close
+               sock    iddata(&tuntap_socks)
+       ifname
+               sock    iddata(&tuntap_socks)
+               =>      string
+       receive
+               sock    iddata(&tuntap_socks)
+               data    hb
+       on-transmit
+               sock    iddata(&tuntap_socks)
+               mtu     long
                ?script obj
 
 Table blockcipherop BlockCipherOp
                ?script obj
 
 Table blockcipherop BlockCipherOp
@@ -183,6 +245,10 @@ Table blockcipherop BlockCipherOp
                mode    enum(BlockCipherModeInfo, "mode")
                iv      hb
                =>      hb
                mode    enum(BlockCipherModeInfo, "mode")
                iv      hb
                =>      hb
+       prop    -1
+               prop    enum(BlockCipherPropInfo, "prop")
+               alg     enum(BlockCipherAlgInfo, "alg")
+               =>      int
 
 EntryExtra BlockCipherOp
        int encrypt;
 
 EntryExtra BlockCipherOp
        int encrypt;