chiark / gitweb /
transmits
[chiark-tcl.git] / base / tables-examples.tct
1 Type hb:                        HBytes_Value @
2 Init hb                         hbytes_sentinel(&@);
3
4 Type hbv:                       HBytes_Var @
5 Init hbv                        @.hb=0; @.obj=0; @.var=0;
6 Fini hbv                        fini_hbv(ip, rc, &@);
7
8 Type sockaddr:                  SockAddr_Value @
9 Init sockaddr                   sockaddr_clear(&@);
10
11 Type sockid:                    int @
12 Init sockid                     @=-1;
13
14 H-Include       "hbytes.h"
15
16 Untabled
17         hbytes
18                 subcmd  enum(HBytes_SubCommand, "hbytes subcommand")
19                 obj     ...
20         dgram-socket
21                 subcmd enum(DgramSocket_SubCommand,"dgram-socket subcommand")
22                 obj     ...
23
24 Table hbytes HBytes_SubCommand
25         raw2h
26                 binary  obj
27                 =>      hb
28         h2raw
29                 hex     hb
30                 =>      obj
31         length
32                 v       hb
33                 =>      int
34         prepend
35                 v       hbv
36                 str     ...
37         append
38                 v       hbv
39                 str     ...
40         rep-info
41                 v       obj
42                 =>      obj
43         concat
44                 str     ...
45                 =>      hb
46         unprepend
47                 v       hbv
48                 length  int
49                 =>      hb
50         unappend
51                 v       hbv
52                 length  int
53                 =>      hb
54         chopto
55                 v       hbv
56                 length  int
57                 =>      hb
58         pkcs5
59                 meth    enum(PadMethod, "hbytes pad subcommand")
60                 v       hbv
61                 block   obj
62                 =>      int
63         blockcipher
64                 encrypt charfrom("de","encrypt/decrypt")
65                 v       hbv
66                 alg     enum(BlockCipherAlgInfo, "alg")
67                 key     obj
68                 mode    enum(BlockCipherModeInfo, "mode")
69                 ?iv     hb
70                 =>      hb
71         hash
72                 alg     enum(HashAlgInfo, "hash alg")
73                 message hb
74                 =>      hb
75         hmac
76                 alg     enum(HashAlgInfo, "hash alg for hmac")
77                 message hb
78                 key     obj
79                 ?maclen obj
80                 =>      hb
81         zeroes
82                 length  int
83                 =>      hb
84         random
85                 length  int
86                 =>      hb
87
88 Table dgram_socket DgramSocket_SubCommand
89         create
90                 local   sockaddr
91                 =>      sockid
92         close
93                 sock    sockid
94         transmit
95                 sock    sockid
96                 data    hb
97                 remote  sockaddr