chiark / gitweb /
7ce5dc7f671bfcf61842961ba4169843c996d077
[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 addrmapv:                  AddrMap_Var @
11 Init addrmapv                   @.am=0; init_somethingv(&@.sth);
12 Fini addrmapv                   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 addrmap AddrMap_SubCommand
78         lookup
79                 map     constv(&addrmap_type)
80                 addr    hb
81                 ?def    obj
82                 =>      obj
83         amend-range
84                 map     addrmapv
85                 start   hb
86                 end     hb
87                 data    obj
88         amend-mask
89                 map     addrmapv
90                 prefix  hb
91                 preflen obj
92                 data    obj
93
94 Table ulong ULong_SubCommand
95         ul2int
96                 v       ulong
97                 =>      int
98         int2ul
99                 v       int
100                 =>      ulong
101         mask
102                 a       ulong
103                 b       ulong
104                 =>      ulong
105         add
106                 a       ulong
107                 b       ulong
108                 =>      ulong
109         multiply
110                 a       ulong
111                 b       ulong
112                 =>      ulong
113         subtract
114                 a       ulong
115                 b       ulong
116                 =>      ulong
117         compare
118                 a       ulong
119                 b       ulong
120                 =>      int
121         shift
122                 right   charfrom("lr", "shift direction")
123                 v       ulong
124                 bits    int
125                 =>      ulong
126         ul2bitfields
127                 value   ulong
128                 ...     obj
129                 =>      int
130         bitfields2ul
131                 base    ulong
132                 ...     obj
133                 =>      ulong
134
135 Table hbytes HBytes_SubCommand
136         raw2h
137                 binary  obj
138                 =>      hb
139         h2raw
140                 hex     hb
141                 =>      obj
142         ushort2h
143                 value   long
144                 =>      hb
145         h2ushort
146                 hex     hb
147                 =>      long
148         length
149                 v       hb
150                 =>      int
151         compare
152                 a       hb
153                 b       hb
154                 =>      int
155         range
156                 v       hb
157                 start   int
158                 size    int
159                 =>      hb
160         prepend
161                 v       hbv
162                 ...     str
163         append
164                 v       hbv
165                 ...     str
166         rep-info
167                 v       obj
168                 =>      obj
169         concat
170                 ...     str
171                 =>      hb
172         unprepend
173                 v       hbv
174                 length  int
175                 =>      hb
176         unappend
177                 v       hbv
178                 length  int
179                 =>      hb
180         chopto
181                 v       hbv
182                 length  int
183                 =>      hb
184         overwrite
185                 v       hbv
186                 start   int
187                 sub     hb
188         trimleft
189                 v       hbv
190         zeroes
191                 length  int
192                 =>      hb
193         repeat
194                 v       hb
195                 count   int
196                 =>      hb
197         xor
198                 v       hbv
199                 d       hb
200         random
201                 length  int
202                 =>      hb
203         pad
204                 op      enum(PadOp, "hbytes pad subcommand")
205                 v       hbv
206                 blocksz obj
207                 meth    enum(PadMethodInfo, "pad method")
208                 ...     methargs
209         blockcipher
210                 op      enum(BlockCipherOp, "op")
211                 ...     obj
212         hash
213                 alg     enum(HashAlgInfo, "hash alg")
214                 message hb
215                 =>      hb
216         hmac
217                 alg     enum(HashAlgInfo, "hash alg for hmac")
218                 message hb
219                 key     obj
220                 ?maclen obj
221                 =>      hb
222         hash-prop
223                 prop    enum(HashAlgPropInfo, "prop")
224                 alg     enum(HashAlgInfo, "alg")
225                 =>      int
226         addr-map
227                 subcmd  enum(AddrMap_SubCommand, "hbytes addr-map subcommand")
228                 ...     obj
229
230 Table padmethodinfo PadMethodInfo
231         pkcs5
232                 =>      int
233         rfc2406
234                 nxthdr  obj
235                 =>      int
236
237 Table dgram_socket DgramSocket_SubCommand
238         create
239                 local   sockaddr
240                 =>      iddata(&dgram_socks)
241         close
242                 sock    iddata(&dgram_socks)
243         transmit
244                 sock    iddata(&dgram_socks)
245                 data    hb
246                 remote  sockaddr
247         on-receive
248                 sock    iddata(&dgram_socks)
249                 ?script obj
250
251 Table tuntap_socket_raw TunSocket_SubCommand
252         create
253                 ?ifname string
254                 =>      iddata(&tuntap_socks)
255         close
256                 sock    iddata(&tuntap_socks)
257         ifname
258                 sock    iddata(&tuntap_socks)
259                 =>      string
260         receive
261                 sock    iddata(&tuntap_socks)
262                 data    hb
263         on-transmit
264                 sock    iddata(&tuntap_socks)
265                 mtu     long
266                 ?script obj
267
268 Table blockcipherop BlockCipherOp
269         e       1
270                 v       hbv
271                 alg     enum(BlockCipherAlgInfo, "alg")
272                 key     obj
273                 mode    enum(BlockCipherModeInfo, "mode")
274                 ?iv     hb
275                 =>      hb
276         d       0
277                 v       hbv
278                 alg     enum(BlockCipherAlgInfo, "alg")
279                 key     obj
280                 mode    enum(BlockCipherModeInfo, "mode")
281                 ?iv     hb
282                 =>      hb
283         mac     -1
284                 msg     hb
285                 alg     enum(BlockCipherAlgInfo, "alg")
286                 key     obj
287                 mode    enum(BlockCipherModeInfo, "mode")
288                 iv      hb
289                 =>      hb
290         prop    -1
291                 prop    enum(BlockCipherPropInfo, "prop")
292                 alg     enum(BlockCipherAlgInfo, "alg")
293                 =>      int
294
295 EntryExtra BlockCipherOp
296         int encrypt;