chiark / gitweb /
b98ba5ff19bd1a89a950c40e5a240750f60ebd42
[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; @.copied=0;
6 Fini hbv                        fini_hbv(ip, rc, &@);
7
8 Type sockaddr:                  SockAddr_Value @
9 Init sockaddr                   sockaddr_clear(&@);
10
11 Type iddata(IdDataTable *tab):  void *@
12 Type ulong:                     uint32_t @
13 Type long:                      long @
14 Type string:                    const char *@
15
16 H-Include       "hbytes.h"
17
18 Table toplevel TopLevel_Command
19         hbytes
20                 subcmd  enum(HBytes_SubCommand, "hbytes subcommand")
21                 ...     obj
22         dgram-socket
23                 subcmd  enum(DgramSocket_SubCommand,"dgram-socket subcommand")
24                 ...     obj
25         tuntap-socket
26                 subcmd  enum(TunSocket_SubCommand,"tuntap-socket subcommand")
27                 ...     obj
28         ulong
29                 subcmd  enum(ULong_SubCommand,"ulong subcommand")
30                 ...     obj
31
32 Table ulong ULong_SubCommand
33         ul2int
34                 v       ulong
35                 =>      int
36         int2ul
37                 v       int
38                 =>      ulong
39         mask
40                 a       ulong
41                 b       ulong
42                 =>      ulong
43         add
44                 a       ulong
45                 b       ulong
46                 =>      ulong
47         multiply
48                 a       ulong
49                 b       ulong
50                 =>      ulong
51         subtract
52                 a       ulong
53                 b       ulong
54                 =>      ulong
55         compare
56                 a       ulong
57                 b       ulong
58                 =>      int
59         shift
60                 right   charfrom("lr", "shift direction")
61                 v       ulong
62                 bits    int
63                 =>      ulong
64         ul2bitfields
65                 value   ulong
66                 ...     obj
67                 =>      int
68         bitfields2ul
69                 base    ulong
70                 ...     obj
71                 =>      ulong
72
73 Table hbytes HBytes_SubCommand
74         raw2h
75                 binary  obj
76                 =>      hb
77         h2raw
78                 hex     hb
79                 =>      obj
80         ushort2h
81                 value   long
82                 =>      hb
83         h2ushort
84                 hex     hb
85                 =>      long
86         length
87                 v       hb
88                 =>      int
89         compare
90                 a       hb
91                 b       hb
92                 =>      int
93         range
94                 v       hb
95                 start   int
96                 size    int
97                 =>      hb
98         prepend
99                 v       hbv
100                 ...     str
101         append
102                 v       hbv
103                 ...     str
104         rep-info
105                 v       obj
106                 =>      obj
107         concat
108                 ...     str
109                 =>      hb
110         unprepend
111                 v       hbv
112                 length  int
113                 =>      hb
114         unappend
115                 v       hbv
116                 length  int
117                 =>      hb
118         chopto
119                 v       hbv
120                 length  int
121                 =>      hb
122         overwrite
123                 v       hbv
124                 start   int
125                 sub     hb
126         trimleft
127                 v       hbv
128         zeroes
129                 length  int
130                 =>      hb
131         repeat
132                 v       hb
133                 count   int
134                 =>      hb
135         xor
136                 v       hbv
137                 d       hb
138         random
139                 length  int
140                 =>      hb
141         pad
142                 op      enum(PadOp, "hbytes pad subcommand")
143                 v       hbv
144                 blocksz obj
145                 meth    enum(PadMethodInfo, "pad method")
146                 ...     methargs
147         blockcipher
148                 op      enum(BlockCipherOp, "op")
149                 ...     obj
150         hash
151                 alg     enum(HashAlgInfo, "hash alg")
152                 message hb
153                 =>      hb
154         hmac
155                 alg     enum(HashAlgInfo, "hash alg for hmac")
156                 message hb
157                 key     obj
158                 ?maclen obj
159                 =>      hb
160         hash-prop
161                 prop    enum(HashAlgPropInfo, "prop")
162                 alg     enum(HashAlgInfo, "alg")
163                 =>      int
164
165 Table padmethodinfo PadMethodInfo
166         pkcs5
167                 =>      int
168         rfc2406
169                 nxthdr  obj
170                 =>      int
171
172 Table dgram_socket DgramSocket_SubCommand
173         create
174                 local   sockaddr
175                 =>      iddata(&dgram_socks)
176         close
177                 sock    iddata(&dgram_socks)
178         transmit
179                 sock    iddata(&dgram_socks)
180                 data    hb
181                 remote  sockaddr
182         on-receive
183                 sock    iddata(&dgram_socks)
184                 ?script obj
185
186 Table tuntap_socket TunSocket_SubCommand
187         create
188                 ?ifname string
189                 =>      iddata(&tuntap_socks)
190         close
191                 sock    iddata(&tuntap_socks)
192         ifname
193                 sock    iddata(&tuntap_socks)
194                 =>      string
195         receive
196                 sock    iddata(&tuntap_socks)
197                 mtu     long
198                 data    hb
199         on-transmit
200                 sock    iddata(&tuntap_socks)
201                 ?script obj
202
203 Table blockcipherop BlockCipherOp
204         e       1
205                 v       hbv
206                 alg     enum(BlockCipherAlgInfo, "alg")
207                 key     obj
208                 mode    enum(BlockCipherModeInfo, "mode")
209                 ?iv     hb
210                 =>      hb
211         d       0
212                 v       hbv
213                 alg     enum(BlockCipherAlgInfo, "alg")
214                 key     obj
215                 mode    enum(BlockCipherModeInfo, "mode")
216                 ?iv     hb
217                 =>      hb
218         mac     -1
219                 msg     hb
220                 alg     enum(BlockCipherAlgInfo, "alg")
221                 key     obj
222                 mode    enum(BlockCipherModeInfo, "mode")
223                 iv      hb
224                 =>      hb
225         prop    -1
226                 prop    enum(BlockCipherPropInfo, "prop")
227                 alg     enum(BlockCipherAlgInfo, "alg")
228                 =>      int
229
230 EntryExtra BlockCipherOp
231         int encrypt;