X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=chiark-tcl.git;a=blobdiff_plain;f=base%2Ftables-examples.tct;h=37286adb6bcf5597d479aaa4dfbcb9534b59cedd;hp=d74353098edf625ecbacc7d411539fdc32044eb1;hb=bc152fdba00b88a09a1c263bc8ff8490099b7027;hpb=bc4e7d2673e44826dd768ad7f91c393349da24de diff --git a/base/tables-examples.tct b/base/tables-examples.tct index d743530..37286ad 100644 --- a/base/tables-examples.tct +++ b/base/tables-examples.tct @@ -1,15 +1,25 @@ Type hb: HBytes_Value @ Init hb hbytes_sentinel(&@); + Type hbv: HBytes_Var @ Init hbv @.hb=0; @.obj=0; @.var=0; Fini hbv fini_hbv(ip, rc, &@); +Type sockaddr: SockAddr_Value @ +Init sockaddr sockaddr_clear(&@); + +Type sockid: DgramSockID @ +Type ulong: unsigned long @ + H-Include "hbytes.h" Untabled hbytes subcmd enum(HBytes_SubCommand, "hbytes subcommand") obj ... + dgram-socket + subcmd enum(DgramSocket_SubCommand,"dgram-socket subcommand") + obj ... Table hbytes HBytes_SubCommand raw2h @@ -18,6 +28,18 @@ Table hbytes HBytes_SubCommand h2raw hex hb => obj + ulong2h + value ulong + => hb + h2ulong + hex hb + => ulong + ushort2h + value ulong + => hb + h2ushort + hex hb + => ulong length v hb => int @@ -28,7 +50,7 @@ Table hbytes HBytes_SubCommand v hbv str ... rep-info - v hb + v obj => obj concat str ... @@ -50,20 +72,41 @@ Table hbytes HBytes_SubCommand v hbv block obj => int -# blockcipher -# encrypt charfrom("de","encrypt/decrypt") -# v hbv -# alg enum(BlockCipherAlgInfo, "alg") -# mode enum(BlockCipherModeInfo, "mode") -# ?iv hb -# => hb -# hash -# alg enum(HashAlgInfo, "hash alg") -# message hb -# => hb -# hmac -# alg enum(HashAlgInfo, "hash alg for hmac") -# message hb -# key hb -# maclen int -# => hb + blockcipher + encrypt charfrom("de","encrypt/decrypt") + v hbv + alg enum(BlockCipherAlgInfo, "alg") + key obj + mode enum(BlockCipherModeInfo, "mode") + ?iv hb + => hb + hash + alg enum(HashAlgInfo, "hash alg") + message hb + => hb + hmac + alg enum(HashAlgInfo, "hash alg for hmac") + message hb + key obj + ?maclen obj + => hb + zeroes + length int + => hb + random + length int + => hb + +Table dgram_socket DgramSocket_SubCommand + create + local sockaddr + => sockid + close + sock sockid + transmit + sock sockid + data hb + remote sockaddr + on-receive + sock sockid + ?script obj