Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/aienux/allen/session.om # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / aienux / allen / session.om` 187 lines ยท 3233 bytes Raw Blame History 1 note SPDX-License-Identifier: MIT 2 note One-request-per-connection GitHub driver over TCP, TLS 1.3 and HTTP framing. 3 note The platform supplies elapsed milliseconds, Unix time, packet results and 96 fresh 4 note random bytes in Gsrand before every gsstart: 64 for TLS, 32 for TCP/DHCP/DNS IDs. 5 global Gsrand uchar 96 6 global Gsrandn ulong 1 7 global Gs ulong 8 8 note Gdiag: last failure code, TCP state, TCP error, TLS state, TLS error. Shown on screen. 9 global Gdiag ulong 5 10 note Gs: state0 idle,1 connecting,2 TLS,3 HTTP,4 completed,5 failed; deadline; request kind; 11 note generation; send offset; failure code; pending close flag. 12 fn gsfail now ulong code ulong to void 13 if ne get Gs 0 0 14 kind = get Gs 2 15 gen = get Gs 3 16 put Gs 0 5 17 put Gs 5 code 18 put Gdiag 0 code 19 put Gdiag 1 get Tcpstate 0 20 put Gdiag 2 get Tcpstate 1 21 put Gdiag 3 get Ndrop 0 22 put Gdiag 4 get Ndropw 0 23 netclose now 24 tlsclose 25 tcwipe 26 ok = ghreply kind 0 0 gen 27 end 28 end 29 fn gsstart now ulong epoch ulong to bool 30 kind = get Ghreq 0 31 if or eq kind 0 ne get Gs 0 0 32 ret false 33 end 34 if ne get Gsrandn 0 len Gsrand 35 ok = ghreply kind 0 0 get Ghreq 2 36 ret false 37 end 38 for i ulong 64 39 put Tlsrand i get Gsrand i 40 end 41 for i ulong 32 42 put Nrand i get Gsrand add i 64 43 end 44 for i ulong len Gsrand 45 put Gsrand i 0 46 end 47 put Gsrandn 0 0 48 if not httpstart kind get Ghreq 2 get Ghreq 3 get Ghreq 4 get Ghreq 1 49 ok = ghreply kind 0 0 get Ghreq 2 50 ret false 51 end 52 for i ulong 8 53 put Gs i 0 54 end 55 put Gs 0 1 56 put Gs 1 add now 120000 57 put Gs 2 kind 58 put Gs 3 get Ghreq 2 59 ghtime epoch 60 tlsinit epoch 61 if eq get Tlsstate 0 4 62 gsfail now 9 63 ret false 64 end 65 netconnect now 66 ret true 67 end 68 fn gstlsout now ulong to void 69 if eq get Tlsoutn 0 0 70 ret 71 end 72 if gt get Tlsoutn 0 len Tcpout 73 gsfail now 2 74 ret 75 end 76 for i ulong get Tlsoutn 0 77 put Tcpout i get Tlsout i 78 end 79 if netwrite get Tlsoutn 0 now 80 tlssent 81 end 82 end 83 fn gstcpin now ulong to void 84 n = get Tcpn 0 85 if eq n 0 86 ret 87 end 88 if gt n len Tlsin 89 n = len Tlsin 90 end 91 for i ulong n 92 put Tlsin i get Tcpin i 93 end 94 tlsinput n 95 netconsume n 96 end 97 fn gshttp now ulong to void 98 while gt get Tlsappn 0 0 99 n = get Tlsappn 0 100 if gt n len Hchunk 101 n = len Hchunk 102 end 103 for i ulong n 104 put Hchunk i get Tlsapp i 105 end 106 if not httpfeed n 107 gsfail now 3 108 ret 109 end 110 tlsconsume n 111 end 112 if eq get Hstate 0 2 113 size = get Hstate 2 114 status = get Hstate 1 115 kind = get Gs 2 116 gen = get Gs 3 117 put Gs 0 4 118 netclose now 119 tlsclose 120 tcwipe 121 ok = ghreply kind status size gen 122 end 123 end 124 fn gsrequest now ulong to void 125 if or ne get Gs 4 0 ne get Tlsstate 0 2 126 ret 127 end 128 if gt get Httpreqn 0 len Tlsplain 129 gsfail now 4 130 ret 131 end 132 for i ulong get Httpreqn 0 133 put Tlsplain i get Httpreq i 134 end 135 if tlswrite get Httpreqn 0 136 put Gs 4 1 137 put Gs 0 3 138 end 139 end 140 fn gspoll now ulong to void 141 state = get Gs 0 142 if or eq state 0 ge state 4 143 ret 144 end 145 if gt now get Gs 1 146 gsfail now 5 147 ret 148 end 149 netstep now 150 if eq get Tcpstate 0 6 151 gsfail now 6 152 ret 153 end 154 if eq get Tcpstate 0 4 155 if eq state 1 156 put Gs 0 2 157 tlsinput 0 158 end 159 end 160 gstcpin now 161 if eq get Tlsstate 0 4 162 gsfail now 7 163 ret 164 end 165 gstlsout now 166 gsrequest now 167 gstlsout now 168 gshttp now 169 if ne get Gs 0 3 170 ret 171 end 172 if or eq get Tcpstate 0 5 eq get Tlsstate 0 3 173 if httpend eq get Tlsstate 2 1 174 gshttp now 175 else 176 gsfail now 8 177 end 178 end 179 end 180 fn gsnext now ulong epoch ulong to void 181 if ge get Gs 0 4 182 put Gs 0 0 183 end 184 if and eq get Gs 0 0 ne get Ghreq 0 0 185 ok = gsstart now epoch 186 end 187 end