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