2013-09-29 00:21:18 +04:00
|
|
|
/* include/v/vere.h
|
|
|
|
**
|
|
|
|
** This file is in the public domain.
|
|
|
|
*/
|
|
|
|
/** Quasi-tunable parameters.
|
|
|
|
**/
|
|
|
|
/* First kernel this executable can boot.
|
|
|
|
*/
|
2014-01-07 00:37:42 +04:00
|
|
|
# define FirstKernel 164
|
|
|
|
# define DefaultKernel 164
|
2014-03-14 21:47:17 +04:00
|
|
|
|
2013-09-29 00:21:18 +04:00
|
|
|
#define RECK
|
|
|
|
|
|
|
|
/** Data types.
|
|
|
|
**/
|
2014-09-10 20:06:30 +04:00
|
|
|
struct _u3_http;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_hhed: http header.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
typedef struct _u3_hhed {
|
|
|
|
struct _u3_hhed* nex_u;
|
2013-09-29 00:21:18 +04:00
|
|
|
c3_c* nam_c;
|
|
|
|
c3_c* val_c;
|
2014-09-10 20:06:30 +04:00
|
|
|
} u3_hhed;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_hbod: http body block. Also used for responses.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
typedef struct _u3_hbod {
|
|
|
|
struct _u3_hbod* nex_u;
|
2013-09-29 00:21:18 +04:00
|
|
|
c3_w len_w;
|
|
|
|
c3_y hun_y[0];
|
2014-09-10 20:06:30 +04:00
|
|
|
} u3_hbod;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_hrat: http parser state.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
typedef enum {
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_hreq_non,
|
|
|
|
u3_hreq_nam,
|
|
|
|
u3_hreq_val
|
|
|
|
} u3_hrat;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_csat: client connection state.
|
2014-02-27 04:37:47 +04:00
|
|
|
*/
|
|
|
|
typedef enum {
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_csat_dead = 0, // connection dead
|
|
|
|
u3_csat_addr = 1, // connection addressed
|
|
|
|
u3_csat_clyr = 2, // connection open in cleartext
|
|
|
|
u3_csat_crop = 3, // connection open, ssl needs hs
|
|
|
|
u3_csat_sing = 4, // connection handshaking ssl
|
|
|
|
u3_csat_cryp = 5, // connection open, ssl open
|
|
|
|
} u3_csat;
|
|
|
|
|
|
|
|
/* u3_hmet: http method. Matches jhttp encoding.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
typedef enum {
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_hmet_delete,
|
|
|
|
u3_hmet_get,
|
|
|
|
u3_hmet_head,
|
|
|
|
u3_hmet_post,
|
|
|
|
u3_hmet_put,
|
|
|
|
u3_hmet_nop, // virtual method
|
|
|
|
u3_hmet_other // ie, unsupported
|
|
|
|
} u3_hmet;
|
|
|
|
|
|
|
|
/* u3_hreq: incoming http request.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
typedef struct _u3_hreq {
|
|
|
|
struct _u3_hcon* hon_u; // connection
|
2013-09-29 00:21:18 +04:00
|
|
|
c3_w seq_l; // sequence within connection
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_hmet met_e; // method
|
|
|
|
u3_hrat rat_e; // parser state
|
2013-09-29 00:21:18 +04:00
|
|
|
c3_c* url_c; // url
|
2014-03-22 01:46:14 +04:00
|
|
|
c3_w ipf_w; // ipv4
|
2014-11-06 06:10:22 +03:00
|
|
|
c3_o liv; // keepalive
|
|
|
|
c3_o end; // all responses added
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_hhed* hed_u; // headers
|
|
|
|
u3_hbod* bod_u; // body parts (exit)
|
|
|
|
u3_hbod* dob_u; // body parts (entry)
|
|
|
|
struct _u3_hreq* nex_u; // next in request queue
|
|
|
|
u3_hbod* rub_u; // exit of write queue
|
|
|
|
u3_hbod* bur_u; // entry of write queue
|
|
|
|
} u3_hreq;
|
|
|
|
|
|
|
|
/* u3_hrep: outgoing http response.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
typedef struct _u3_hrep {
|
2014-03-20 02:40:40 +04:00
|
|
|
c3_w sev_l; // server number
|
2013-09-29 00:21:18 +04:00
|
|
|
c3_w coq_l; // connection number
|
|
|
|
c3_w seq_l; // request number
|
|
|
|
c3_w sas_w; // status
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_hhed* hed_u; // headers
|
|
|
|
u3_hbod* bod_u; // body (one part)
|
|
|
|
} u3_hrep;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_hcon: incoming http connection.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
typedef struct _u3_hcon {
|
2013-09-29 00:21:18 +04:00
|
|
|
uv_tcp_t wax_u; // event handler state
|
|
|
|
c3_w coq_l; // connection number
|
|
|
|
c3_w seq_l; // next request number
|
2014-09-10 20:06:30 +04:00
|
|
|
struct _u3_http* htp_u; // backlink to server
|
|
|
|
struct _u3_hcon* nex_u; // next in server's list
|
|
|
|
struct _u3_hreq* ruc_u; // request under construction
|
|
|
|
struct _u3_hreq* req_u; // exit of request queue
|
|
|
|
struct _u3_hreq* qer_u; // entry of request queue
|
2016-04-07 21:27:53 +03:00
|
|
|
void* par_u; // struct http_parser *
|
2014-09-10 20:06:30 +04:00
|
|
|
} u3_hcon;
|
|
|
|
|
|
|
|
/* u3_http: http server.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
typedef struct _u3_http {
|
2013-09-29 00:21:18 +04:00
|
|
|
uv_tcp_t wax_u; // event handler state
|
|
|
|
c3_w sev_l; // server number
|
|
|
|
c3_w coq_l; // next connection number
|
|
|
|
c3_w por_w; // running port
|
2014-11-06 06:10:22 +03:00
|
|
|
c3_o sec; // logically secure
|
2016-02-11 22:44:28 +03:00
|
|
|
c3_o lop; // loopback-only
|
2014-09-10 20:06:30 +04:00
|
|
|
struct _u3_hcon* hon_u; // connection list
|
|
|
|
struct _u3_http* nex_u; // next in list
|
|
|
|
} u3_http;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_cres: response to http client.
|
2014-02-27 04:37:47 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
typedef struct _u3_cres {
|
|
|
|
u3_hrat rat_e; // parser state
|
2014-02-27 04:37:47 +04:00
|
|
|
void* par_u; // struct http_parser *
|
|
|
|
c3_w sas_w; // status code
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_hhed* hed_u; // headers
|
|
|
|
u3_hbod* bod_u; // exit of body queue
|
|
|
|
u3_hbod* dob_u; // entry of body queue
|
|
|
|
} u3_cres;
|
2014-02-27 04:37:47 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_creq: outgoing http request.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
typedef struct _u3_creq { // client request
|
2014-02-27 04:37:47 +04:00
|
|
|
c3_l num_l; // request number
|
2014-03-03 02:31:03 +04:00
|
|
|
c3_c* hot_c; // host
|
|
|
|
c3_s por_s; // port
|
2013-09-29 00:21:18 +04:00
|
|
|
c3_c* url_c; // url
|
2014-11-06 06:10:22 +03:00
|
|
|
c3_o sec; // yes == https
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_hmet met_e; // method
|
|
|
|
u3_hhed* hed_u; // headers
|
|
|
|
u3_hbod* bod_u; // body
|
|
|
|
u3_cres* res_u; // nascent response
|
|
|
|
struct _u3_ccon* coc_u; // parent connection
|
|
|
|
struct _u3_creq* nex_u; // next in queue
|
|
|
|
} u3_creq;
|
|
|
|
|
|
|
|
/* u3_sslx: per-connection ssl context.
|
2014-03-14 05:52:03 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
typedef struct _u3_sslx {
|
2014-03-14 05:52:03 +04:00
|
|
|
void* ssl_u; // struct SSL*
|
|
|
|
void* rio_u; // struct BIO* for read
|
|
|
|
void* wio_u; // struct BIO* for write
|
2014-09-10 20:06:30 +04:00
|
|
|
} u3_sslx;
|
2014-03-14 05:52:03 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_ccon: outgoing http connection.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
typedef struct _u3_ccon { // client connection
|
2013-09-29 00:21:18 +04:00
|
|
|
uv_tcp_t wax_u; // i/o handler state
|
2014-03-14 21:47:17 +04:00
|
|
|
uv_connect_t cot_u; // connection handler state
|
2014-02-27 04:37:47 +04:00
|
|
|
uv_getaddrinfo_t adr_u; // resolver state
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_sslx ssl; // ssl state
|
|
|
|
u3_csat sat_e; // connection state
|
2014-03-03 02:31:03 +04:00
|
|
|
c3_c* hot_c; // hostname
|
2013-10-30 22:26:51 +04:00
|
|
|
c3_s por_s; // port
|
2014-02-27 04:37:47 +04:00
|
|
|
c3_w ipf_w; // IP
|
2014-11-06 06:10:22 +03:00
|
|
|
c3_o sec; // yes == https
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_hbod* rub_u; // exit of send queue
|
|
|
|
u3_hbod* bur_u; // entry of send queue
|
|
|
|
u3_creq* ceq_u; // exit of request queue
|
|
|
|
u3_creq* qec_u; // entry of request queue
|
|
|
|
struct _u3_ccon* pre_u; // previous in list
|
|
|
|
struct _u3_ccon* nex_u; // next in list
|
|
|
|
} u3_ccon;
|
|
|
|
|
|
|
|
/* u3_chot: foreign host (not yet used).
|
2014-02-27 04:37:47 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
typedef struct _u3_chot {
|
2014-02-27 04:37:47 +04:00
|
|
|
c3_w ipf_w; // ip address (or 0)
|
2014-03-03 02:31:03 +04:00
|
|
|
c3_c* hot_c; // hostname (no port) (or 0)
|
2014-09-10 20:06:30 +04:00
|
|
|
struct _u3_ccon* ins_u; // insecure connection (or 0)
|
|
|
|
struct _u3_ccon* sec_u; // secure connection (or 0)
|
|
|
|
} u3_chot;
|
2014-02-27 04:37:47 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_cttp: http client.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
typedef struct _u3_cttp {
|
|
|
|
struct _u3_ccon* coc_u; // connection list
|
|
|
|
} u3_cttp;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_apac: ames packet, coming or going.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
typedef struct _u3_apac {
|
|
|
|
struct _u3_apac* nex_u; // next in queue
|
2013-09-29 00:21:18 +04:00
|
|
|
c3_w pip_w; // IPv4 address, to
|
|
|
|
c3_s por_s; // IPv4 port, to
|
|
|
|
c3_w len_w; // length in bytes
|
|
|
|
c3_y hun_y[0]; // data
|
2014-09-10 20:06:30 +04:00
|
|
|
} u3_apac;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2016-12-30 21:26:59 +03:00
|
|
|
/* u3_poke: poke callback function.
|
|
|
|
*/
|
|
|
|
typedef void (*u3_poke)(void*, u3_noun);
|
|
|
|
|
|
|
|
/* u3_bail: bailout callback function.
|
|
|
|
*/
|
|
|
|
typedef void (*u3_bail)(void*, const c3_c* err_c);
|
|
|
|
|
|
|
|
/* u3_done: completion function.
|
|
|
|
*/
|
|
|
|
typedef void (*u3_done)(void *);
|
|
|
|
|
|
|
|
/* u3_mess: blob message in process.
|
|
|
|
*/
|
|
|
|
typedef struct _u3_mess {
|
|
|
|
c3_d len_d; // blob length in bytes
|
|
|
|
c3_d has_d; // currently held
|
|
|
|
struct _u3_meat* meq_u; // exit of message queue
|
|
|
|
struct _u3_meat* qem_u; // entry of message queue
|
|
|
|
} u3_mess;
|
|
|
|
|
|
|
|
/* u3_meat: blob message block.
|
|
|
|
*/
|
|
|
|
typedef struct _u3_meat {
|
|
|
|
struct _u3_meat* nex_u;
|
|
|
|
c3_d len_d;
|
|
|
|
c3_y hun_y[0];
|
|
|
|
} u3_meat;
|
|
|
|
|
|
|
|
/* u3_moat: inbound message stream.
|
|
|
|
*/
|
|
|
|
typedef struct _u3_moat {
|
|
|
|
uv_pipe_t pyp_u; // input stream
|
2017-02-20 19:49:58 +03:00
|
|
|
u3_bail bal_f; // error response function
|
2016-12-30 21:26:59 +03:00
|
|
|
void* vod_p; // callback pointer
|
|
|
|
u3_poke pok_f; // action function
|
|
|
|
struct _u3_mess* mes_u; // message in progress
|
|
|
|
c3_d len_d; // length of stray bytes
|
|
|
|
c3_y* rag_y; // stray bytes
|
|
|
|
} u3_moat;
|
|
|
|
|
|
|
|
/* u3_mojo: outbound message stream.
|
|
|
|
*/
|
|
|
|
typedef struct _u3_mojo {
|
|
|
|
uv_pipe_t pyp_u; // output stream
|
|
|
|
u3_bail bal_f; // error response function
|
|
|
|
} u3_mojo;
|
|
|
|
|
2017-02-20 19:49:58 +03:00
|
|
|
/* u3_moor: two-way message stream, linked list */
|
|
|
|
typedef struct _u3_moor {
|
|
|
|
uv_pipe_t pyp_u;
|
|
|
|
u3_bail bal_f;
|
|
|
|
void* vod_p;
|
|
|
|
u3_poke pok_f;
|
|
|
|
struct _u3_mess* mes_u;
|
|
|
|
c3_d len_d;
|
|
|
|
c3_y* rag_y;
|
|
|
|
struct _u3_moor* nex_u;
|
|
|
|
} u3_moor;
|
|
|
|
|
2016-12-30 21:26:59 +03:00
|
|
|
/* u3_foil: abstract chub-addressed file.
|
|
|
|
*/
|
|
|
|
typedef struct _u3_foil {
|
|
|
|
uv_file fil_u; // libuv file handle
|
|
|
|
struct _u3_dire* dir_u; // parent directory
|
|
|
|
c3_c* nam_c; // name within parent
|
|
|
|
c3_d end_d; // end of file
|
|
|
|
} u3_foil;
|
|
|
|
|
|
|
|
/* u3_dent: directory entry.
|
|
|
|
*/
|
|
|
|
typedef struct _u3_dent {
|
|
|
|
c3_c* nam_c;
|
|
|
|
struct _u3_dent* nex_u;
|
|
|
|
} u3_dent;
|
|
|
|
|
|
|
|
/* u3_dire: simple directory state.
|
|
|
|
*/
|
|
|
|
typedef struct _u3_dire {
|
|
|
|
c3_c* pax_c; // path of directory
|
|
|
|
uv_file fil_u; // file, opened read-only to fsync
|
|
|
|
u3_dent* all_u; // file list
|
|
|
|
} u3_dire;
|
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_ames: ames networking.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
typedef struct _u3_ames { // packet network state
|
2015-02-23 03:11:46 +03:00
|
|
|
union {
|
|
|
|
uv_udp_t wax_u;
|
|
|
|
uv_handle_t had_u;
|
|
|
|
};
|
|
|
|
uv_timer_t tim_u; // network timer
|
|
|
|
c3_o alm; // alarm on
|
|
|
|
c3_w law_w; // last wakeup, unix time
|
|
|
|
c3_s por_s; // public IPv4 port
|
|
|
|
c3_w imp_w[256]; // imperial IPs
|
2016-10-25 17:51:10 +03:00
|
|
|
time_t imp_t[256]; // imperial IP timestamps
|
2014-09-10 20:06:30 +04:00
|
|
|
} u3_ames;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_save: checkpoint control.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
typedef struct _u3_save {
|
2013-10-14 22:23:55 +04:00
|
|
|
uv_timer_t tim_u; // checkpoint timer
|
|
|
|
uv_signal_t sil_u; // child signal
|
2014-04-08 20:25:49 +04:00
|
|
|
c3_d ent_d; // event number
|
2013-10-14 22:23:55 +04:00
|
|
|
c3_w pid_w; // pid of checkpoint process
|
2014-09-10 20:06:30 +04:00
|
|
|
} u3_save;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_ubuf: unix tty i/o buffer.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
typedef struct _u3_ubuf {
|
|
|
|
struct _u3_ubuf* nex_u;
|
2013-09-29 00:21:18 +04:00
|
|
|
c3_w len_w;
|
|
|
|
c3_y hun_y[0]; // bytes to send
|
2014-09-10 20:06:30 +04:00
|
|
|
} u3_ubuf;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_utat: unix terminal state.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
struct {
|
|
|
|
c3_l col_l; // columns
|
|
|
|
c3_l row_l; // rows
|
|
|
|
} siz;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
c3_w* lin_w; // current line (utf32)
|
|
|
|
c3_w len_w; // length of current line
|
|
|
|
c3_w cus_w; // cursor position
|
|
|
|
} mir;
|
|
|
|
|
|
|
|
struct { // escape code control
|
2014-11-06 06:10:22 +03:00
|
|
|
c3_o ape; // escape received
|
|
|
|
c3_o bra; // bracket or O received
|
2013-09-29 00:21:18 +04:00
|
|
|
} esc;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
c3_y syb_y[5]; // utf8 code buffer
|
|
|
|
c3_w len_w; // present length
|
|
|
|
c3_w wid_w; // total width
|
|
|
|
} fut;
|
2015-12-13 06:53:02 +03:00
|
|
|
|
|
|
|
struct {
|
|
|
|
uv_thread_t* sit_u; // spinner thread
|
|
|
|
c3_o diz_o; // spinner activated
|
|
|
|
c3_d eve_d; // spinner start tick (unix μs)
|
2016-02-21 01:35:06 +03:00
|
|
|
c3_d end_d; // spinner end tick (unix μs)
|
2015-12-13 06:53:02 +03:00
|
|
|
c3_c* why_c; // spinner event wire (root only)
|
|
|
|
} sun;
|
|
|
|
|
|
|
|
uv_mutex_t mex_u; // mutex for non-daemon term state
|
2014-09-10 20:06:30 +04:00
|
|
|
} u3_utat;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2015-06-06 02:35:41 +03:00
|
|
|
struct _u3_umon;
|
2014-09-10 20:06:30 +04:00
|
|
|
struct _u3_udir;
|
|
|
|
struct _u3_ufil;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2015-06-09 23:55:07 +03:00
|
|
|
/* u3_unod: file or directory.
|
|
|
|
*/
|
2015-06-05 05:47:27 +03:00
|
|
|
typedef struct _u3_unod {
|
|
|
|
c3_o dir; // c3y if dir, c3n if file
|
|
|
|
c3_o dry; // ie, unmodified
|
|
|
|
c3_c* pax_c; // absolute path
|
2015-06-09 01:51:11 +03:00
|
|
|
struct _u3_udir* par_u; // parent
|
2015-06-06 02:35:41 +03:00
|
|
|
struct _u3_unod* nex_u; // internal list
|
2015-06-05 05:47:27 +03:00
|
|
|
} u3_unod;
|
|
|
|
|
2015-06-09 23:55:07 +03:00
|
|
|
/* u3_ufil: synchronized file.
|
|
|
|
*/
|
2015-06-05 05:47:27 +03:00
|
|
|
typedef struct _u3_ufil {
|
|
|
|
c3_o dir; // c3y if dir, c3n if file
|
|
|
|
c3_o dry; // ie, unmodified
|
|
|
|
c3_c* pax_c; // absolute path
|
2015-06-09 01:51:11 +03:00
|
|
|
struct _u3_udir* par_u; // parent
|
2015-06-05 05:47:27 +03:00
|
|
|
struct _u3_unod* nex_u; // internal list
|
2015-06-09 01:51:11 +03:00
|
|
|
c3_w mug_w; // mug of last %into
|
|
|
|
c3_w gum_w; // mug of last %ergo
|
2015-06-05 05:47:27 +03:00
|
|
|
} u3_ufil;
|
|
|
|
|
2015-06-09 23:55:07 +03:00
|
|
|
/* u3_ufil: synchronized directory.
|
|
|
|
*/
|
2015-06-05 05:47:27 +03:00
|
|
|
typedef struct _u3_udir {
|
|
|
|
c3_o dir; // c3y if dir, c3n if file
|
|
|
|
c3_o dry; // ie, unmodified
|
|
|
|
c3_c* pax_c; // absolute path
|
2015-06-09 01:51:11 +03:00
|
|
|
struct _u3_udir* par_u; // parent
|
2015-06-05 05:47:27 +03:00
|
|
|
struct _u3_unod* nex_u; // internal list
|
2015-06-06 02:35:41 +03:00
|
|
|
u3_unod* kid_u; // subnodes
|
2015-06-05 05:47:27 +03:00
|
|
|
} u3_udir;
|
|
|
|
|
2015-06-09 23:55:07 +03:00
|
|
|
/* u3_ufil: synchronized mount point.
|
|
|
|
*/
|
2015-06-05 05:47:27 +03:00
|
|
|
typedef struct _u3_umon {
|
2015-06-18 02:44:00 +03:00
|
|
|
u3_udir dir_u; // root directory, must be first
|
2015-06-09 01:51:11 +03:00
|
|
|
c3_c* nam_c; // mount point name
|
2015-06-12 06:52:42 +03:00
|
|
|
struct _u3_umon* nex_u; // internal list
|
2015-06-05 05:47:27 +03:00
|
|
|
} u3_umon;
|
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_usig: receive signals.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
typedef struct _u3_usig {
|
2013-09-29 00:21:18 +04:00
|
|
|
uv_signal_t sil_u;
|
|
|
|
c3_i num_i;
|
2014-09-10 20:06:30 +04:00
|
|
|
struct _u3_usig* nex_u;
|
|
|
|
} u3_usig;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_unix: clay support system, also
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
typedef struct _u3_unix {
|
2015-06-12 06:52:42 +03:00
|
|
|
u3_umon* mon_u; // mount points
|
|
|
|
c3_o alm; // timer set
|
|
|
|
c3_o dyr; // ready to update
|
2014-06-01 07:26:18 +04:00
|
|
|
#ifdef SYNCLOG
|
|
|
|
c3_w lot_w; // sync-slot
|
2014-09-10 20:06:30 +04:00
|
|
|
struct _u3_sylo {
|
2014-11-06 06:10:22 +03:00
|
|
|
c3_o unx; // from unix
|
2014-06-01 07:26:18 +04:00
|
|
|
c3_m wer_m; // mote saying where
|
|
|
|
c3_m wot_m; // mote saying what
|
|
|
|
c3_c* pax_c; // path
|
|
|
|
} sylo[1024];
|
|
|
|
#endif
|
2014-09-10 20:06:30 +04:00
|
|
|
} u3_unix;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2015-06-24 22:50:30 +03:00
|
|
|
/* u3_behn: just a timer for ever
|
2014-10-15 06:25:23 +04:00
|
|
|
*/
|
2015-06-24 22:50:30 +03:00
|
|
|
typedef struct _u3_behn {
|
|
|
|
uv_timer_t tim_u; // behn timer
|
2014-10-15 06:25:23 +04:00
|
|
|
c3_w run_w; // run of consecutive alarms
|
2014-11-06 06:10:22 +03:00
|
|
|
c3_o alm; // alarm
|
2015-06-24 22:50:30 +03:00
|
|
|
} u3_behn;
|
2014-10-15 06:25:23 +04:00
|
|
|
|
2013-09-29 00:21:18 +04:00
|
|
|
/* u2_utfo: unix terminfo strings.
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
struct {
|
|
|
|
const c3_y* kcuu1_y; // key_up
|
2014-03-14 21:47:17 +04:00
|
|
|
const c3_y* kcud1_y; // key_down
|
2013-09-29 00:21:18 +04:00
|
|
|
const c3_y* kcub1_y; // key_back
|
|
|
|
const c3_y* kcuf1_y; // key_forward
|
|
|
|
c3_w max_w; // maximum input sequence length
|
|
|
|
} inn;
|
|
|
|
struct {
|
|
|
|
const c3_y* clear_y; // clear_screen
|
2014-03-14 21:47:17 +04:00
|
|
|
const c3_y* el_y; // clr_bol clear to beginning
|
2013-09-29 00:21:18 +04:00
|
|
|
// const c3_y* el1_y; // clr_eol clear to end
|
|
|
|
const c3_y* ed_y; // clear to end of screen
|
|
|
|
const c3_y* bel_y; // bel sound bell
|
|
|
|
const c3_y* cub1_y; // parm_left
|
|
|
|
const c3_y* cuf1_y; // parm_right
|
|
|
|
const c3_y* cuu1_y; // parm_up
|
|
|
|
const c3_y* cud1_y; // parm_down
|
|
|
|
// const c3_y* cub_y; // parm_left_cursor #num
|
2014-03-14 21:47:17 +04:00
|
|
|
// const c3_y* cuf_y; // parm_right_cursor #num
|
2013-09-29 00:21:18 +04:00
|
|
|
} out;
|
2014-09-10 20:06:30 +04:00
|
|
|
} u3_utfo;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
|
|
|
#if 0
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_uwen: unix alarm.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
typedef struct _u3_uwen {
|
2013-09-29 00:21:18 +04:00
|
|
|
c3_y* pax_y; // printed path
|
|
|
|
c3_d wen_d[2]; // timer expire
|
|
|
|
};
|
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_utim: unix timer control.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
typedef struct _u3_utim {
|
2014-05-26 06:08:07 +04:00
|
|
|
uv_timer_t wat_u; // timer control
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_uwen* wen_u; // timers in ascending order
|
2013-09-29 00:21:18 +04:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_utty: unix tty.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
typedef struct _u3_utty {
|
2014-05-26 06:08:07 +04:00
|
|
|
union {
|
|
|
|
uv_pipe_t pop_u;
|
|
|
|
uv_tcp_t wax_u;
|
|
|
|
};
|
2014-09-10 20:06:30 +04:00
|
|
|
struct _u3_utty* nex_u; // next in host list
|
2013-09-29 00:21:18 +04:00
|
|
|
c3_i fid_i; // file descriptor
|
|
|
|
c3_w tid_l; // terminal identity number
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_utfo ufo_u; // terminfo strings
|
2014-05-28 01:56:14 +04:00
|
|
|
c3_i cug_i; // blocking fcntl flags
|
|
|
|
c3_i nob_i; // nonblocking fcntl flags
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_utat tat_u; // control state
|
2014-05-28 01:56:14 +04:00
|
|
|
struct termios bak_u; // cooked terminal state
|
|
|
|
struct termios raw_u; // raw terminal state
|
2014-09-10 20:06:30 +04:00
|
|
|
} u3_utty;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_opts: command line configuration.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
typedef struct _u3_opts {
|
2016-12-30 21:26:59 +03:00
|
|
|
c3_o abo; // -a, abort aggressively
|
2018-11-17 03:28:29 +03:00
|
|
|
c3_c* pil_c; // -B, bootstrap from
|
2014-11-06 06:10:22 +03:00
|
|
|
c3_o bat; // -b, batch create
|
2018-11-17 03:28:29 +03:00
|
|
|
c3_o nuu; // -c, new pier
|
|
|
|
c3_o dry; // -D, dry compute, no checkpoint
|
2014-12-01 03:06:08 +03:00
|
|
|
c3_o dem; // -d, daemon
|
2014-11-06 06:10:22 +03:00
|
|
|
c3_o fak; // -F, fake carrier
|
2018-11-17 03:28:29 +03:00
|
|
|
c3_w fuz_w; // -f, fuzz testing
|
|
|
|
c3_o gab; // -g, test garbage collection
|
|
|
|
c3_c* lit_c; // -J, ivory (fastboot) kernel
|
|
|
|
c3_w kno_w; // -K, kernel version
|
2018-11-17 03:18:24 +03:00
|
|
|
c3_o net; // -L, local-only networking
|
2014-12-01 03:06:08 +03:00
|
|
|
c3_o pro; // -P, profile
|
2018-11-17 03:28:29 +03:00
|
|
|
c3_s por_s; // -p, ames port
|
2015-05-20 03:04:08 +03:00
|
|
|
c3_o qui; // -q, quiet
|
2015-10-31 15:17:04 +03:00
|
|
|
c3_o rep; // -R, report build info
|
2018-11-17 03:28:29 +03:00
|
|
|
c3_o vno; // -V, replay without reboots
|
|
|
|
c3_o veb; // -v, verbose (inverse of -q)
|
|
|
|
c3_c* who_c; // -w, begin with ticket
|
|
|
|
c3_o tex; // -x, exit after loading
|
2014-09-10 20:06:30 +04:00
|
|
|
} u3_opts;
|
|
|
|
|
|
|
|
/* u3_host: entire host.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
typedef struct _u3_host {
|
2013-09-29 00:21:18 +04:00
|
|
|
c3_w kno_w; // current executing stage
|
2015-06-06 02:35:41 +03:00
|
|
|
c3_c* dir_c; // pier path (no trailing /)
|
2013-09-29 00:21:18 +04:00
|
|
|
c3_d now_d; // event tick
|
|
|
|
uv_loop_t* lup_u; // libuv event loop
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_usig* sig_u; // signal list
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_http* htp_u; // http servers
|
|
|
|
u3_cttp ctp_u; // http clients
|
|
|
|
u3_utty* uty_u; // linked terminal list
|
|
|
|
u3_opts ops_u; // commandline options
|
2014-11-06 06:10:22 +03:00
|
|
|
c3_o liv; // if u3_no, shut down
|
2014-05-13 02:42:43 +04:00
|
|
|
c3_i xit_i; // exit code for shutdown
|
2014-03-14 05:52:03 +04:00
|
|
|
void* ssl_u; // struct SSL_CTX*
|
2014-09-10 20:06:30 +04:00
|
|
|
} u3_host; // host == computer == process
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2016-12-30 21:26:59 +03:00
|
|
|
/** New pier system.
|
|
|
|
**/
|
|
|
|
/* u3_writ: inbound event.
|
|
|
|
*/
|
|
|
|
typedef struct _u3_writ {
|
|
|
|
struct _u3_pier* pir_u; // backpointer to pier
|
|
|
|
u3_noun job; // (pair date ovum)
|
|
|
|
c3_d evt_d; // event number
|
|
|
|
u3_noun now; // event time
|
|
|
|
c3_l msc_l; // ms to timeout
|
|
|
|
c3_l mug_l; // hash before executing
|
|
|
|
u3_foil* fol_u; // precommit file
|
|
|
|
u3_atom mat; // jammed $work, or 0
|
|
|
|
u3_noun act; // action list
|
|
|
|
struct _u3_writ* nex_u; // next in queue, or 0
|
|
|
|
} u3_writ;
|
|
|
|
|
|
|
|
/* u3_lord: working process controller.
|
|
|
|
*/
|
|
|
|
typedef struct _u3_lord {
|
|
|
|
uv_process_t cub_u; // process handle
|
|
|
|
uv_process_options_t ops_u; // process configuration
|
|
|
|
uv_stdio_container_t cod_u[3]; // process options
|
|
|
|
time_t wen_t; // process creation time
|
|
|
|
u3_mojo inn_u; // client's stdin
|
|
|
|
u3_moat out_u; // client's stdout
|
|
|
|
c3_d sen_d; // last event dispatched
|
|
|
|
c3_d dun_d; // last event completed
|
|
|
|
c3_d rel_d; // last event released
|
|
|
|
c3_l mug_l; // mug after last completion
|
|
|
|
struct _u3_pier* pir_u; // pier backpointer
|
|
|
|
} u3_lord;
|
|
|
|
|
|
|
|
/* u3_disk: manage events on disk.
|
|
|
|
**
|
|
|
|
** any event once discovered should be in one of these sets.
|
|
|
|
** at present, all sets are ordered and can be defined by a
|
|
|
|
** simple counter. any events <= the counter is in the set.
|
|
|
|
*/
|
|
|
|
typedef struct _u3_disk {
|
|
|
|
u3_dire* dir_u; // main pier directory
|
|
|
|
u3_dire* urb_u; // urbit system data
|
|
|
|
u3_dire* com_u; // log directory
|
|
|
|
u3_dire* pre_u; // precommit directory
|
|
|
|
u3_foil* fol_u; // logfile
|
|
|
|
c3_d end_d; // byte end of file
|
|
|
|
c3_d rep_d; // precommit requested
|
|
|
|
c3_d pre_d; // precommitted
|
|
|
|
c3_d moc_d; // commit requested
|
|
|
|
c3_d com_d; // committed
|
|
|
|
struct _u3_pier* pir_u; // pier backpointer
|
|
|
|
} u3_disk;
|
|
|
|
|
|
|
|
/* u3_boot: startup controller.
|
|
|
|
*/
|
|
|
|
typedef struct _u3_boot {
|
|
|
|
|
|
|
|
} u3_boot;
|
|
|
|
|
|
|
|
/* u3_pier: ship controller.
|
|
|
|
*/
|
|
|
|
typedef struct _u3_pier {
|
|
|
|
c3_c* pax_c; // pier directory
|
2017-02-23 02:11:04 +03:00
|
|
|
c3_c* sys_c; // pill file
|
2016-12-30 21:26:59 +03:00
|
|
|
c3_d gen_d; // last event discovered
|
|
|
|
c3_d but_d; // boot barrier
|
2017-06-11 08:30:49 +03:00
|
|
|
c3_d tic_d[1]; // ticket (unstretched)
|
|
|
|
c3_d sec_d[1]; // generator (unstretched)
|
2017-06-03 23:34:37 +03:00
|
|
|
c3_d key_d[4]; // secret (stretched)
|
|
|
|
c3_d who_d[2]; // identity
|
|
|
|
c3_c* who_c; // identity as C string
|
2017-06-04 07:53:34 +03:00
|
|
|
c3_s por_s; // UDP port
|
|
|
|
c3_o fak_o; // yes iff fake security
|
2016-12-30 21:26:59 +03:00
|
|
|
u3_disk* log_u; // event log
|
|
|
|
u3_lord* god_u; // computer
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_ames* sam_u; // packet interface
|
|
|
|
u3_behn* teh_u; // behn timer
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_unix* unx_u; // sync and clay
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_save* sav_u; // autosave
|
2016-12-30 21:26:59 +03:00
|
|
|
u3_writ* ent_u; // entry of queue
|
|
|
|
u3_writ* ext_u; // exit of queue
|
2017-06-03 23:34:37 +03:00
|
|
|
uv_prepare_t pep_u; // preloop registration
|
2016-12-30 21:26:59 +03:00
|
|
|
} u3_pier;
|
|
|
|
|
|
|
|
/* u3_king: all executing piers.
|
|
|
|
*/
|
|
|
|
typedef struct _u3_king {
|
2017-06-01 20:54:28 +03:00
|
|
|
c3_c* soc_c; // socket name
|
|
|
|
c3_w len_w; // number of lords used
|
|
|
|
c3_w all_w; // number of lords allocated
|
|
|
|
u3_pier** tab_u; // lord table
|
|
|
|
uv_pipe_t cmd_u; // command socket
|
|
|
|
u3_moor* cli_u; // connected clients
|
2016-12-30 21:26:59 +03:00
|
|
|
} u3_king;
|
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
# define u3L u3_Host.lup_u // global event loop
|
2014-09-11 04:01:32 +04:00
|
|
|
# define u3Z (&(u3_Raft))
|
2014-09-10 20:06:30 +04:00
|
|
|
# define u3S u3_Host.ssl_u
|
2016-12-30 21:26:59 +03:00
|
|
|
# define u3K u3_King
|
2013-09-29 00:21:18 +04:00
|
|
|
|
|
|
|
/** Global variables.
|
|
|
|
**/
|
2014-09-10 20:06:30 +04:00
|
|
|
c3_global u3_host u3_Host;
|
|
|
|
c3_global c3_c* u3_Local;
|
2016-12-30 21:26:59 +03:00
|
|
|
c3_global u3_king u3_King;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
|
|
|
/** Functions.
|
|
|
|
**/
|
|
|
|
/* Urbit time: 128 bits, leap-free.
|
|
|
|
**
|
|
|
|
** High 64 bits: 0x8000.000c.cea3.5380 + Unix time at leap 25 (Jul 2012)
|
|
|
|
** Low 64 bits: 1/2^64 of a second.
|
|
|
|
**
|
|
|
|
** Seconds per Gregorian 400-block: 12.622.780.800
|
|
|
|
** 400-blocks from 0 to 0AD: 730.692.561
|
|
|
|
** Years from 0 to 0AD: 292.277.024.400
|
|
|
|
** Seconds from 0 to 0AD: 9.223.372.029.693.628.800
|
|
|
|
** Seconds between 0A and Unix epoch: 62.167.219.200
|
|
|
|
** Seconds before Unix epoch: 9.223.372.091.860.848.000
|
|
|
|
** The same, in C hex notation: 0x8000000cce9e0d80ULL
|
|
|
|
**
|
2017-06-04 07:53:34 +03:00
|
|
|
** XX: needs to be adjusted to implement Google leap-smear time.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_time_sec_in(): urbit seconds from unix time.
|
2013-09-29 00:21:18 +04:00
|
|
|
**
|
|
|
|
** Adjust (externally) for future leap secs!
|
|
|
|
*/
|
|
|
|
c3_d
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_time_sec_in(c3_w unx_w);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_time_sec_out(): unix time from urbit seconds.
|
2013-09-29 00:21:18 +04:00
|
|
|
**
|
|
|
|
** Adjust (externally) for future leap secs!
|
|
|
|
*/
|
|
|
|
c3_w
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_time_sec_out(c3_d urs_d);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_time_fsc_in(): urbit fracto-seconds from unix microseconds.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
c3_d
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_time_fsc_in(c3_w usc_w);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_time_fsc_out: unix microseconds from urbit fracto-seconds.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
c3_w
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_time_fsc_out(c3_d ufc_d);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_time_in_tv(): urbit time from struct timeval.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_atom
|
|
|
|
u3_time_in_tv(struct timeval* tim_tv);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_time_out_tv(): struct timeval from urbit time.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_time_out_tv(struct timeval* tim_tv, u3_noun now);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_time_in_ts(): urbit time from struct timespec.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_atom
|
|
|
|
u3_time_in_ts(struct timespec* tim_ts);
|
2014-11-05 03:29:08 +03:00
|
|
|
#if defined(U3_OS_linux)
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_time_t_in_ts(): urbit time from time_t.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_atom
|
|
|
|
u3_time_t_in_ts(time_t tim);
|
2013-09-29 00:21:18 +04:00
|
|
|
#endif
|
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_time_out_ts(): struct timespec from urbit time.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_time_out_ts(struct timespec* tim_ts, u3_noun now);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_time_gap_ms(): (wen - now) in ms.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
c3_d
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_time_gap_ms(u3_noun now, u3_noun wen);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
|
|
|
/** Filesystem (new api).
|
|
|
|
**/
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_walk_load(): load file or bail.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_noun
|
|
|
|
u3_walk_load(c3_c* pas_c);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_walk_safe(): load file or 0.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_noun
|
|
|
|
u3_walk_safe(c3_c* pas_c);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_walk_save(): save file or bail.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_walk_save(c3_c* pas_c, u3_noun tim, u3_atom pad);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_sync_reck(): traverse filesystem for changes -> lamb
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_noun
|
2014-09-11 04:01:32 +04:00
|
|
|
u3_sync_reck(void);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_walk(): traverse `dir_c` to produce an arch, updating `old`.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_noun
|
2014-09-11 04:01:32 +04:00
|
|
|
u3_walk(const c3_c* dir_c, u3_noun old);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_path(): C unix path in computer for file or directory.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
c3_c*
|
2014-11-06 06:10:22 +03:00
|
|
|
u3_path(c3_o fyl, u3_noun pax);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
|
|
|
/** Filesystem (old api).
|
|
|
|
**/
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_ve_file(): load internal file as atom from local or system.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_weak
|
|
|
|
u3_ve_file(c3_c* ext_c, u3_noun tah);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_ve_frep(): load [.~ %rep myp {now} tah].
|
2013-09-29 00:21:18 +04:00
|
|
|
**
|
|
|
|
** File is either ~ or [nbytes mdate atom].
|
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_noun
|
|
|
|
u3_ve_frep(u3_noun myp, u3_noun tah);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_ve_date(): date internal file.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
c3_d
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_ve_date(c3_c* ext_c, u3_noun tah);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_ve_save(): save internal file as atom.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-11-06 06:10:22 +03:00
|
|
|
c3_o
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_ve_save(c3_c* ext_c, u3_noun tah, u3_noun dat);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_ve_zeus(): prayer to internal file path. Return unit.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_noun
|
|
|
|
u3_ve_zeus(u3_noun hap);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2016-12-30 21:26:59 +03:00
|
|
|
/** Filesystem (async)
|
|
|
|
**/
|
|
|
|
/* u3_foil_folder(): load directory, blockingly. create if nonexistent.
|
|
|
|
*/
|
|
|
|
u3_dire*
|
|
|
|
u3_foil_folder(const c3_c* pax_c); // directory object, or 0
|
|
|
|
|
|
|
|
/* u3_foil_create(): create a new, empty file, not syncing.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_foil_create(void (*fun_f)(void*, // context pointer
|
|
|
|
u3_foil*),// file object
|
|
|
|
void* vod_p, // context pointer
|
|
|
|
u3_dire* dir_u, // directory
|
|
|
|
const c3_c* nam_c); // name of new file
|
|
|
|
|
|
|
|
/* u3_foil_absorb(): absorb logfile, truncating to last good frame; block.
|
|
|
|
*/
|
|
|
|
u3_foil*
|
|
|
|
u3_foil_absorb(u3_dire* dir_u, // directory
|
|
|
|
c3_c* nam_c); // filename
|
|
|
|
|
|
|
|
/* u3_foil_delete(): delete a file; free descriptor.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_foil_delete(void (*fun_f)(void*), // context pointer
|
|
|
|
void* vod_p, // context pointer
|
|
|
|
u3_foil* fol_u); // file to delete
|
|
|
|
|
|
|
|
/* u3_foil_append(): write a frame at the end of a file, freeing buffer.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_foil_append(void (*fun_f)(void*), // context pointer
|
|
|
|
void* vod_p, // context pointer
|
|
|
|
u3_foil* fol_u, // file
|
|
|
|
c3_d* buf_d, // buffer to write from
|
|
|
|
c3_d len_d); // length in chubs
|
|
|
|
|
|
|
|
/* u3_foil_reveal(): read the frame before a position, blocking.
|
|
|
|
*/
|
|
|
|
c3_d*
|
|
|
|
u3_foil_reveal(u3_foil* fol_u, // file from
|
|
|
|
c3_d* pos_d, // end position/prev end
|
|
|
|
c3_d* len_d); // length return
|
|
|
|
|
|
|
|
/* u3_foil_commit(): reveal from one file, append to another.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_foil_commit(void (*fun_f)(void*, // context pointer
|
|
|
|
u3_foil*, // file from
|
|
|
|
c3_d, // previous from
|
|
|
|
u3_foil*, // file to
|
|
|
|
c3_d), // end of to
|
|
|
|
void* vod_p, // context pointer
|
|
|
|
u3_foil* del_u, // file from
|
|
|
|
c3_d del_d, // end of from frame
|
|
|
|
u3_foil* unt_u, // file to
|
|
|
|
c3_d unt_d); // end of to frame
|
|
|
|
|
|
|
|
/* u3_foil_invent(): make new file with one frame; free buffer, sync.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_foil_invent(void (*fun_f)(void*, // context pointer
|
|
|
|
u3_foil*), // new file
|
|
|
|
void* vod_p, // context pointer
|
|
|
|
u3_dire* dir_u, // directory
|
|
|
|
c3_c* nam_c, // filename
|
|
|
|
c3_d* buf_d, // buffer (to free)
|
|
|
|
c3_d len_d); // length
|
|
|
|
|
2013-09-29 00:21:18 +04:00
|
|
|
/** Output.
|
|
|
|
**/
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_reck_kick(): handle effect.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
void
|
2017-01-19 04:35:11 +03:00
|
|
|
u3_reck_kick(u3_pier* pir_u, u3_noun ovo);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
|
|
|
/** Terminal, new style.
|
|
|
|
**/
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_term_get_blew(): return window size [columns rows].
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_noun
|
|
|
|
u3_term_get_blew(c3_l tid_l);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_term_ef_boil(): initial effects for restored server.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_term_ef_boil();
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2015-05-19 21:38:23 +03:00
|
|
|
/* u3_term_ef_ticket(): initial effects for new ticket.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_term_ef_ticket(c3_c* who_c, c3_c* tic_c);
|
|
|
|
|
2015-05-19 21:56:44 +03:00
|
|
|
/* u3_term_ef_verb(): initial effects for verbose events.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_term_ef_verb(void);
|
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_term_ef_winc(): window change.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_term_ef_winc(void);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_term_ef_ctlc(): send ^C.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_term_ef_ctlc(void);
|
2014-03-14 21:47:17 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_term_ef_bake(): initial effects for new server.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
void
|
2017-01-19 04:35:11 +03:00
|
|
|
u3_term_ef_bake(void);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2015-10-15 20:47:52 +03:00
|
|
|
/* u3_term_ef_blit(): send %blit effect to terminal.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_term_ef_blit(c3_l tid_l,
|
|
|
|
u3_noun blt);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_term_io_init(): initialize terminal I/O.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-03-14 21:47:17 +04:00
|
|
|
void
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_term_io_init(void);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_term_io_talk(): start terminal listener.
|
2014-05-26 06:08:07 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_term_io_talk(void);
|
2014-05-26 06:08:07 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_term_io_exit(): terminate terminal I/O.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-03-14 21:47:17 +04:00
|
|
|
void
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_term_io_exit(void);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_term_io_poll(): update terminal IO state.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_term_io_poll(void);
|
2014-03-14 21:47:17 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_term_io_hija(): hijack console for cooked print.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
FILE*
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_term_io_hija(void);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_term_io_loja(): release console from cooked print.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_term_io_loja(int x);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
|
|
|
/* uL, uH: wrap hijack/lojack around fprintf.
|
|
|
|
**
|
|
|
|
** uL(fprintf(uH, ...));
|
|
|
|
*/
|
2014-09-10 20:06:30 +04:00
|
|
|
# define uH u3_term_io_hija()
|
|
|
|
# define uL(x) u3_term_io_loja(x)
|
2013-09-29 00:21:18 +04:00
|
|
|
|
|
|
|
|
|
|
|
/** Ames, packet networking.
|
|
|
|
**/
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_ames_ef_bake(): create ames duct.
|
2014-07-10 01:42:08 +04:00
|
|
|
*/
|
|
|
|
void
|
2017-01-19 04:35:11 +03:00
|
|
|
u3_ames_ef_bake(u3_pier* pir_u);
|
2014-07-10 01:42:08 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_ames_ef_send(): send packet to network.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
void
|
2017-01-19 04:35:11 +03:00
|
|
|
u3_ames_ef_send(u3_pier* pir_u,
|
|
|
|
u3_noun lan,
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_noun pac);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_ames_io_init(): initialize ames I/O.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-03-14 21:47:17 +04:00
|
|
|
void
|
2017-01-19 04:35:11 +03:00
|
|
|
u3_ames_io_init(u3_pier* pir_u);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_ames_io_talk(): bring up listener.
|
2014-01-17 12:12:05 +04:00
|
|
|
*/
|
|
|
|
void
|
2017-01-19 04:35:11 +03:00
|
|
|
u3_ames_io_talk(u3_pier* pir_u);
|
|
|
|
|
|
|
|
/* u3_ames_ef_bake(): send initial events.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_ames_io_bake(u3_pier* pir_u);
|
2014-01-17 12:12:05 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_ames_io_exit(): terminate ames I/O.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-03-14 21:47:17 +04:00
|
|
|
void
|
2017-01-19 04:35:11 +03:00
|
|
|
u3_ames_io_exit(u3_pier* pir_u);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_ames_io_poll(): update ames IO state.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
void
|
2017-01-19 04:35:11 +03:00
|
|
|
u3_ames_io_poll(u3_pier* pir_u);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
|
|
|
/** Autosave.
|
|
|
|
**/
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_save_ef_chld(): report SIGCHLD.
|
2013-10-04 00:38:37 +04:00
|
|
|
*/
|
|
|
|
void
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_save_ef_chld(u3_pier *pir_u);
|
2013-10-04 00:38:37 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_save_io_init(): initialize autosave.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-03-14 21:47:17 +04:00
|
|
|
void
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_save_io_init(u3_pier *pir_u);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_save_io_exit(): terminate autosave.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-03-14 21:47:17 +04:00
|
|
|
void
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_save_io_exit(u3_pier *pir_u);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_save_io_poll(): update autosave state.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
void
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_save_io_poll(u3_pier *pir_u);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
|
|
|
/** Storage, new school.
|
|
|
|
**/
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_unix_ef_hold():
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
void
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_unix_ef_hold(void);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2017-01-19 04:35:11 +03:00
|
|
|
/* u3_unix_ef_boot(): boot actions
|
|
|
|
*/
|
|
|
|
void
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_unix_ef_boot(u3_pier *pir_u);
|
2017-01-19 04:35:11 +03:00
|
|
|
|
|
|
|
/* u3_unix_ef_bake(): initial effects for new process.
|
|
|
|
*/
|
|
|
|
void
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_unix_ef_bake(u3_pier *pir_u);
|
2017-01-19 04:35:11 +03:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_unix_ef_move():
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
void
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_unix_ef_move(void);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2015-06-09 23:55:07 +03:00
|
|
|
/* u3_unix_initial_into(): intialize filesystem from urb/zod
|
|
|
|
*/
|
|
|
|
void
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_unix_ef_initial_into(u3_pier *pir_u);
|
2015-06-09 23:55:07 +03:00
|
|
|
|
2015-06-09 20:27:22 +03:00
|
|
|
/* u3_unix_ef_look(): update filesystem from unix
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
void
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_unix_ef_look(u3_pier *pir_u, u3_noun all);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2015-06-05 05:47:27 +03:00
|
|
|
/* u3_unix_ef_ergo(): update filesystem from urbit
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
void
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_unix_ef_ergo(u3_pier *pir_u, u3_noun mon, u3_noun can);
|
2015-06-09 20:27:22 +03:00
|
|
|
|
2017-01-12 18:50:11 +03:00
|
|
|
/* u3_unix_ef_dirk(): mark mount dirty
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_unix_ef_dirk(u3_pier *pir_u, u3_noun mon);
|
|
|
|
|
2015-06-09 20:27:22 +03:00
|
|
|
/* u3_unix_ef_ogre(): delete mount point
|
|
|
|
*/
|
|
|
|
void
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_unix_ef_ogre(u3_pier *pir_u, u3_noun mon);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2015-10-15 20:47:52 +03:00
|
|
|
/* u3_unix_ef_hill(): enumerate mount points
|
2015-06-17 22:06:40 +03:00
|
|
|
*/
|
|
|
|
void
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_unix_ef_hill(u3_pier *pir_u, u3_noun hil);
|
2015-06-17 22:06:40 +03:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_unix_io_init(): initialize storage.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-03-14 21:47:17 +04:00
|
|
|
void
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_unix_io_init(u3_pier *pir_u);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_unix_io_talk(): start listening for fs events.
|
2014-01-17 12:12:05 +04:00
|
|
|
*/
|
|
|
|
void
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_unix_io_talk(u3_pier *pir_u);
|
2014-01-17 12:12:05 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_unix_io_exit(): terminate storage.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-03-14 21:47:17 +04:00
|
|
|
void
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_unix_io_exit(u3_pier *pir_u);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_unix_io_poll(): update storage state.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
void
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_unix_io_poll(u3_pier *pir_u);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
|
|
|
|
2015-06-24 22:50:30 +03:00
|
|
|
/** behn, just a timer.
|
2014-10-15 06:25:23 +04:00
|
|
|
**/
|
2015-06-24 22:50:30 +03:00
|
|
|
/* u2_behn_io_init(): initialize behn timer.
|
2014-10-15 06:25:23 +04:00
|
|
|
*/
|
|
|
|
void
|
2015-06-24 22:50:30 +03:00
|
|
|
u2_behn_io_init(void);
|
2014-10-15 06:25:23 +04:00
|
|
|
|
2015-06-24 22:50:30 +03:00
|
|
|
/* u2_behn_io_exit(): terminate timer.
|
2014-10-15 06:25:23 +04:00
|
|
|
*/
|
|
|
|
void
|
2015-06-24 22:50:30 +03:00
|
|
|
u2_behn_io_exit(void);
|
2014-10-15 06:25:23 +04:00
|
|
|
|
2015-06-24 22:50:30 +03:00
|
|
|
/* u2_behn_io_poll(): update behn IO state.
|
2014-10-15 06:25:23 +04:00
|
|
|
*/
|
|
|
|
void
|
2015-06-24 22:50:30 +03:00
|
|
|
u2_behn_io_poll(void);
|
2014-10-15 06:25:23 +04:00
|
|
|
|
|
|
|
|
2014-02-27 04:37:47 +04:00
|
|
|
/** HTTP server.
|
2013-09-29 00:21:18 +04:00
|
|
|
**/
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_http_ef_thou(): send %thou effect to http.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_http_ef_thou(c3_l sev_l,
|
2014-03-20 02:40:40 +04:00
|
|
|
c3_l coq_l,
|
2013-09-29 00:21:18 +04:00
|
|
|
c3_l seq_l,
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_noun rep);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_cttp_ef_thus(): send %thus effect to cttp.
|
2013-10-27 07:55:53 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_cttp_ef_thus(c3_l num_l,
|
|
|
|
u3_noun req);
|
2013-10-27 07:55:53 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_http_ef_bake(): create new http server.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_http_ef_bake(void);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_http_io_init(): initialize http I/O.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-03-14 21:47:17 +04:00
|
|
|
void
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_http_io_init(void);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_http_io_talk(): start http listener.
|
2014-01-17 12:12:05 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_http_io_talk(void);
|
2014-01-17 12:12:05 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_http_io_exit(): terminate http I/O.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
2014-03-14 21:47:17 +04:00
|
|
|
void
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_http_io_exit(void);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_http_io_poll(): update http IO state.
|
2013-09-29 00:21:18 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_http_io_poll(void);
|
2014-02-26 00:18:07 +04:00
|
|
|
|
2014-11-05 03:41:26 +03:00
|
|
|
/** New timer system.
|
|
|
|
**/
|
2015-06-24 22:50:30 +03:00
|
|
|
/* u3_behn_io_init(): initialize time timer.
|
2014-11-05 03:41:26 +03:00
|
|
|
*/
|
|
|
|
void
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_behn_io_init(u3_pier *pir_u);
|
2014-11-05 03:41:26 +03:00
|
|
|
|
2015-06-24 22:50:30 +03:00
|
|
|
/* u3_behn_io_exit(): terminate timer.
|
2014-11-05 03:41:26 +03:00
|
|
|
*/
|
|
|
|
void
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_behn_io_exit(u3_pier *pir_u);
|
2014-11-05 03:41:26 +03:00
|
|
|
|
2015-06-24 22:50:30 +03:00
|
|
|
/* u3_behn_io_poll(): update behn IO state.
|
2014-11-05 03:41:26 +03:00
|
|
|
*/
|
|
|
|
void
|
2017-02-23 02:11:04 +03:00
|
|
|
u3_behn_io_poll(u3_pier *pir_u);
|
2014-11-05 03:41:26 +03:00
|
|
|
|
2014-02-27 04:37:47 +04:00
|
|
|
|
|
|
|
/** HTTP client.
|
|
|
|
**/
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_cttp_ef_thus(): send %thus effect to cttp.
|
2014-02-27 04:37:47 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_cttp_ef_thus(c3_l num_l,
|
|
|
|
u3_noun req);
|
2014-02-27 04:37:47 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_cttp_io_init(): initialize cttp I/O.
|
2014-02-27 04:37:47 +04:00
|
|
|
*/
|
2014-03-14 21:47:17 +04:00
|
|
|
void
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_cttp_io_init(void);
|
2014-02-27 04:37:47 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_cttp_io_exit(): terminate cttp I/O.
|
2014-02-27 04:37:47 +04:00
|
|
|
*/
|
2014-03-14 21:47:17 +04:00
|
|
|
void
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_cttp_io_exit(void);
|
2014-02-27 04:37:47 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_cttp_io_poll(): update cttp IO state.
|
2014-02-27 04:37:47 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_cttp_io_poll(void);
|
2016-12-30 21:26:59 +03:00
|
|
|
|
|
|
|
/** Stream messages.
|
|
|
|
**/
|
|
|
|
/* u3_newt_write(): write atom to stream; free atom.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_newt_write(u3_mojo* moj_u,
|
|
|
|
u3_atom mat,
|
|
|
|
void* vod_p);
|
|
|
|
|
|
|
|
/* u3_newt_read(): activate reading on input stream.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_newt_read(u3_moat* mot_u);
|
|
|
|
|
|
|
|
/** Main for worker process.
|
|
|
|
**/
|
|
|
|
c3_i
|
|
|
|
u3_serf_main(c3_i arg_i,
|
|
|
|
c3_c** arg_c);
|
|
|
|
|
|
|
|
/** Pier control.
|
|
|
|
**/
|
|
|
|
/* u3_pier_create(): create a pier, loading existing.
|
|
|
|
*/
|
|
|
|
u3_pier*
|
|
|
|
u3_pier_create(c3_c* pax_c, c3_c* sys_c);
|
|
|
|
|
|
|
|
/* u3_pier_interrupt(): interrupt running process.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_pier_interrupt(u3_pier* pir_u);
|
|
|
|
|
|
|
|
/* u3_pier_discover(): insert task into process controller.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_pier_discover(u3_pier* pir_u,
|
|
|
|
c3_l msc_l,
|
|
|
|
u3_noun job);
|
|
|
|
|
2017-06-12 08:46:25 +03:00
|
|
|
/* u3_pier_rand(): fill a 512-bit (16-word) buffer.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_pier_rand(c3_w* rad_w);
|
|
|
|
|
2016-12-30 21:26:59 +03:00
|
|
|
/* u3_pier_exit(): trigger a gentle shutdown.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_pier_exit(void);
|
|
|
|
|
2017-01-19 04:35:11 +03:00
|
|
|
/* u3_pier_work(): send event; real pier pointer.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_pier_work(u3_pier* pir_u, u3_noun pax, u3_noun fav);
|
|
|
|
|
|
|
|
/* u3_pier_stub(): get the One Pier for unreconstructed code.
|
|
|
|
*/
|
|
|
|
u3_pier*
|
|
|
|
u3_pier_stub(void);
|
|
|
|
|
|
|
|
/* u3_pier_plan(): submit event; fake pier
|
2016-12-30 21:26:59 +03:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_pier_plan(u3_noun pax, u3_noun fav);
|
|
|
|
|
|
|
|
/* u3_pier_boot(): start the new pier system.
|
|
|
|
*/
|
|
|
|
void
|
2017-06-03 23:34:37 +03:00
|
|
|
u3_pier_boot(u3_noun who, // identity
|
2017-06-11 08:30:49 +03:00
|
|
|
u3_noun tic, // ticket if any
|
2017-06-03 23:34:37 +03:00
|
|
|
u3_noun sec, // secret or 0
|
|
|
|
u3_noun pax, // path to pier
|
|
|
|
u3_noun sys); // path to boot pill
|
2016-12-30 21:26:59 +03:00
|
|
|
|
2018-11-20 07:45:39 +03:00
|
|
|
/* u3_pier_stay(): restart the new pier system.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_pier_stay(u3_noun pax);
|
|
|
|
|
2017-01-19 04:35:11 +03:00
|
|
|
/* u3_pier_tank(): dump single tank.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_pier_tank(c3_l tab_l, u3_noun tac);
|
|
|
|
|
|
|
|
/* u3_pier_punt(): dump tank list.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_pier_punt(c3_l tab_l, u3_noun tac);
|
|
|
|
|
|
|
|
/* u3_pier_sway(): print trace.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_pier_sway(c3_l tab_l, u3_noun tax);
|
2017-02-20 19:49:58 +03:00
|
|
|
|
|
|
|
void
|
|
|
|
u3_king_commence();
|