chiark / gitweb /
8a28c4fe1d13cd11b8c471237bff84dc5cc9bdde
[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; init_somethingv(&@.sth);
6 Fini hbv                        fini_somethingv(ip, rc, &@.sth);
7
8 Type constv(Tcl_ObjType*):      Tcl_Obj *@
9
10 Type maskmapv:                  MaskMap_Var @
11 Init maskmapv                   @.mm=0; init_somethingv(&@.sth);
12 Fini maskmapv                   fini_somethingv(ip, rc, &@.sth);
13
14 Type sockaddr:                  SockAddr_Value @
15 Init sockaddr                   sockaddr_clear(&@);
16
17 Type iddata(const IdDataSpec *idds):    void *@
18 Type ulong:                     uint32_t @
19 Type long:                      long @
20 Type string:                    const char *@
21
22 Type adnsresults:               adns_answer *@
23 Init adnsresults                @=0;
24 Fini adnsresults                free(@);
25
26 Type charfrom(const char *opts, const char *what):      int
27
28 H-Include       "hbytes.h"
29
30 Table toplevel TopLevel_Command
31         hbytes
32                 subcmd  enum(HBytes_SubCommand, "hbytes subcommand")
33                 ...     obj
34         dgram-socket
35                 subcmd  enum(DgramSocket_SubCommand,"dgram-socket subcommand")
36                 ...     obj
37         tuntap-socket-raw
38             subcmd enum(TunSocket_SubCommand,"tuntap-socket-raw subcommand")
39             ... obj
40         ulong
41                 subcmd  enum(ULong_SubCommand,"ulong subcommand")
42                 ...     obj
43         adns
44                 subcmd  enum(Adns_SubCommand,"adns subcommand")
45                 ...     obj
46
47 Table adns Adns_SubCommand
48         lookup
49                 rrtype  enum(AdnsTclRRTypeInfo, "rrtype")
50                 domain  string
51                 ...     obj
52                 =>      obj
53         synch
54                 rrtype  enum(AdnsTclRRTypeInfo, "rrtype")
55                 domain  string
56                 ...     obj
57                 =>      obj
58         asynch
59                 on_yes  obj
60                 on_no   obj
61                 on_fail obj
62                 xargs   obj
63                 rrtype  enum(AdnsTclRRTypeInfo, "rrtype")
64                 domain  string
65                 ...     obj
66                 =>      iddata(&adnstcl_queries)
67         asynch-cancel
68                 query   iddata(&adnstcl_queries)
69         new-resolver
70                 ...     obj
71                 =>      iddata(&adnstcl_resolvers)
72         set-default-resolver
73                 res     iddata(&adnstcl_resolvers)
74         destroy-resolver
75                 res     iddata(&adnstcl_resolvers)
76
77 Table maskmap MaskMap_SubCommand
78         lookup
79                 map     constv(&maskmap_type)
80                 addr    hb
81                 ?def    obj
82                 =>      obj
83         amend
84                 map     maskmapv
85                 prefix  obj
86                 preflen obj
87                 data    obj
88
89 Table ulong ULong_SubCommand
90         ul2int
91                 v       ulong
92                 =>      int
93         int2ul
94                 v       int
95                 =>      ulong
96         mask
97                 a       ulong
98                 b       ulong
99                 =>      ulong
100         add
101                 a       ulong
102                 b       ulong
103                 =>      ulong
104         multiply
105                 a       ulong
106                 b       ulong
107                 =>      ulong
108         subtract
109                 a       ulong
110                 b       ulong
111                 =>      ulong
112         compare
113                 a       ulong
114                 b       ulong
115                 =>      int
116         shift
117                 right   charfrom("lr", "shift direction")
118                 v       ulong
119                 bits    int
120                 =>      ulong
121         ul2bitfields
122                 value   ulong
123                 ...     obj
124                 =>      int
125         bitfields2ul
126                 base    ulong
127                 ...     obj
128                 =>      ulong
129
130 Table hbytes HBytes_SubCommand
131         raw2h
132                 binary  obj
133                 =>      hb
134         h2raw
135                 hex     hb
136                 =>      obj
137         ushort2h
138                 value   long
139                 =>      hb
140         h2ushort
141                 hex     hb
142                 =>      long
143         length
144                 v       hb
145                 =>      int
146         compare
147                 a       hb
148                 b       hb
149                 =>      int
150         range
151                 v       hb
152                 start   int
153                 size    int
154                 =>      hb
155         prepend
156                 v       hbv
157                 ...     str
158         append
159                 v       hbv
160                 ...     str
161         rep-info
162                 v       obj
163                 =>      obj
164         concat
165                 ...     str
166                 =>      hb
167         unprepend
168                 v       hbv
169                 length  int
170                 =>      hb
171         unappend
172                 v       hbv
173                 length  int
174                 =>      hb
175         chopto
176                 v       hbv
177                 length  int
178                 =>      hb
179         overwrite
180                 v       hbv
181                 start   int
182                 sub     hb
183         trimleft
184                 v       hbv
185         zeroes
186                 length  int
187                 =>      hb
188         repeat
189                 v       hb
190                 count   int
191                 =>      hb
192         xor
193                 v       hbv
194                 d       hb
195         random
196                 length  int
197                 =>      hb
198         pad
199                 op      enum(PadOp, "hbytes pad subcommand")
200                 v       hbv
201                 blocksz obj
202                 meth    enum(PadMethodInfo, "pad method")
203                 ...     methargs
204         blockcipher
205                 op      enum(BlockCipherOp, "op")
206                 ...     obj
207         hash
208                 alg     enum(HashAlgInfo, "hash alg")
209                 message hb
210                 =>      hb
211         hmac
212                 alg     enum(HashAlgInfo, "hash alg for hmac")
213                 message hb
214                 key     obj
215                 ?maclen obj
216                 =>      hb
217         hash-prop
218                 prop    enum(HashAlgPropInfo, "prop")
219                 alg     enum(HashAlgInfo, "alg")
220                 =>      int
221         mask-map
222                 subcmd  enum(MaskMap_SubCommand, "hbytes mask-map subcommand")
223                 ...     obj
224
225 Table padmethodinfo PadMethodInfo
226         pkcs5
227                 =>      int
228         rfc2406
229                 nxthdr  obj
230                 =>      int
231
232 Table dgram_socket DgramSocket_SubCommand
233         create
234                 local   sockaddr
235                 =>      iddata(&dgram_socks)
236         close
237                 sock    iddata(&dgram_socks)
238         transmit
239                 sock    iddata(&dgram_socks)
240                 data    hb
241                 remote  sockaddr
242         on-receive
243                 sock    iddata(&dgram_socks)
244                 ?script obj
245
246 Table tuntap_socket_raw TunSocket_SubCommand
247         create
248                 ?ifname string
249                 =>      iddata(&tuntap_socks)
250         close
251                 sock    iddata(&tuntap_socks)
252         ifname
253                 sock    iddata(&tuntap_socks)
254                 =>      string
255         receive
256                 sock    iddata(&tuntap_socks)
257                 data    hb
258         on-transmit
259                 sock    iddata(&tuntap_socks)
260                 mtu     long
261                 ?script obj
262
263 Table blockcipherop BlockCipherOp
264         e       1
265                 v       hbv
266                 alg     enum(BlockCipherAlgInfo, "alg")
267                 key     obj
268                 mode    enum(BlockCipherModeInfo, "mode")
269                 ?iv     hb
270                 =>      hb
271         d       0
272                 v       hbv
273                 alg     enum(BlockCipherAlgInfo, "alg")
274                 key     obj
275                 mode    enum(BlockCipherModeInfo, "mode")
276                 ?iv     hb
277                 =>      hb
278         mac     -1
279                 msg     hb
280                 alg     enum(BlockCipherAlgInfo, "alg")
281                 key     obj
282                 mode    enum(BlockCipherModeInfo, "mode")
283                 iv      hb
284                 =>      hb
285         prop    -1
286                 prop    enum(BlockCipherPropInfo, "prop")
287                 alg     enum(BlockCipherAlgInfo, "alg")
288                 =>      int
289
290 EntryExtra BlockCipherOp
291         int encrypt;