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