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