26#ifndef PROTOCORE_VXI11_H
27#define PROTOCORE_VXI11_H
31#if PROTOCORE_ENABLE_VXI11
36#define PROTOCORE_VXI11_CORE_PROG 0x0607AFu
37#define PROTOCORE_VXI11_CORE_VERS 1
38#define PROTOCORE_RPC_PMAP_PROG 100000u
39#define PROTOCORE_RPC_PMAP_VERS 2
40#define PROTOCORE_RPC_PMAP_PORT 111
41#define PROTOCORE_RPC_PMAP_GETPORT 3
42#define PROTOCORE_RPC_PROTO_TCP 6
43#define PROTOCORE_RPC_AUTH_NONE 0
44#define PROTOCORE_RPC_MSG_ACCEPTED 0
45#define PROTOCORE_RPC_ACCEPT_SUCCESS 0
48EMBED_ENUM_BYTE(Vxi11Proc, VXI11_PROC_CREATE_LINK = 10, VXI11_PROC_DEVICE_WRITE = 11, VXI11_PROC_DEVICE_READ = 12,
49 VXI11_PROC_DEVICE_READSTB = 13, VXI11_PROC_DEVICE_TRIGGER = 14, VXI11_PROC_DEVICE_CLEAR = 15,
50 VXI11_PROC_DEVICE_REMOTE = 16, VXI11_PROC_DEVICE_LOCAL = 17, VXI11_PROC_DEVICE_LOCK = 18,
51 VXI11_PROC_DEVICE_UNLOCK = 19, VXI11_PROC_DEVICE_ENABLE_SRQ = 20, VXI11_PROC_DEVICE_DOCMD = 22,
52 VXI11_PROC_DESTROY_LINK = 23, VXI11_PROC_CREATE_INTR_CHAN = 25, VXI11_PROC_DESTROY_INTR_CHAN = 26, );
55#define PROTOCORE_VXI11_FLAG_WAITLOCK 0x01
56#define PROTOCORE_VXI11_FLAG_END 0x08
57#define PROTOCORE_VXI11_FLAG_TERMCHRSET 0x80
59#define PROTOCORE_VXI11_REASON_REQCNT 0x01
60#define PROTOCORE_VXI11_REASON_CHR 0x02
61#define PROTOCORE_VXI11_REASON_END 0x04
63#define PROTOCORE_VXI11_ERR_NONE 0
64#define PROTOCORE_VXI11_ERR_SYNTAX 1
65#define PROTOCORE_VXI11_ERR_NOT_ACCESSIBLE 3
66#define PROTOCORE_VXI11_ERR_INVALID_LINK 4
67#define PROTOCORE_VXI11_ERR_PARAMETER 5
68#define PROTOCORE_VXI11_ERR_NO_LOCK 12
69#define PROTOCORE_VXI11_ERR_IO_TIMEOUT 15
70#define PROTOCORE_VXI11_ERR_IO_ERROR 17
71#define PROTOCORE_VXI11_ERR_ABORT 23
74const char *protocore_vxi11_error_str(int32_t error);
83size_t protocore_rpc_record_mark(uint8_t *buf,
size_t cap, uint32_t payload_len);
91embed_bool protocore_rpc_parse_record_mark(
const uint8_t *buf,
size_t len, embed_bool *last, uint32_t *frag_len);
101embed_bool protocore_rpc_parse_reply(
const uint8_t *rpc,
size_t len, uint32_t *xid, uint32_t *accept_stat,
110size_t protocore_vxi11_build_getport(uint8_t *buf,
size_t cap, uint32_t xid, uint32_t prog, uint32_t vers,
117embed_bool protocore_vxi11_parse_getport_resp(
const uint8_t *rpc,
size_t len, uint32_t *port);
126size_t protocore_vxi11_build_create_link(uint8_t *buf,
size_t cap, uint32_t xid, int32_t client_id,
127 embed_bool lock_device, uint32_t lock_timeout,
const char *device);
135 uint32_t max_recv_size;
136} Vxi11CreateLinkResp;
137embed_bool protocore_vxi11_parse_create_link_resp(
const uint8_t *rpc,
size_t len, Vxi11CreateLinkResp *out);
144size_t protocore_vxi11_build_device_write(uint8_t *buf,
size_t cap, uint32_t xid, int32_t lid, uint32_t io_timeout,
145 uint32_t lock_timeout, uint32_t flags,
const uint8_t *data,
size_t data_len);
153embed_bool protocore_vxi11_parse_write_resp(
const uint8_t *rpc,
size_t len, Vxi11WriteResp *out);
160size_t protocore_vxi11_build_device_read(uint8_t *buf,
size_t cap, uint32_t xid, int32_t lid, uint32_t request_size,
161 uint32_t io_timeout, uint32_t lock_timeout, uint32_t flags, uint8_t term_char);
171embed_bool protocore_vxi11_parse_read_resp(
const uint8_t *rpc,
size_t len, Vxi11ReadResp *out);
177size_t protocore_vxi11_build_device_readstb(uint8_t *buf,
size_t cap, uint32_t xid, int32_t lid, uint32_t flags,
178 uint32_t lock_timeout, uint32_t io_timeout);
186embed_bool protocore_vxi11_parse_readstb_resp(
const uint8_t *rpc,
size_t len, Vxi11ReadStbResp *out);
193size_t protocore_vxi11_build_device_clear(uint8_t *buf,
size_t cap, uint32_t xid, int32_t lid, uint32_t flags,
194 uint32_t lock_timeout, uint32_t io_timeout);
200size_t protocore_vxi11_build_device_trigger(uint8_t *buf,
size_t cap, uint32_t xid, int32_t lid, uint32_t flags,
201 uint32_t lock_timeout, uint32_t io_timeout);
207size_t protocore_vxi11_build_destroy_link(uint8_t *buf,
size_t cap, uint32_t xid, int32_t lid);
214embed_bool protocore_vxi11_parse_error_resp(
const uint8_t *rpc,
size_t len, int32_t *error);
EMBED_ENUM_BYTE(ProtoConn, PROTO_NONE=0, PROTO_HTTP=1, PROTO_TELNET=2, PROTO_SSH=3, PROTO_MODBUS=4, PROTO_OPCUA=5, PROTO_SSH_RFWD=6, PROTO_RELAY=7, PROTO_BRIDGE=8, PROTO_NTRIP_CASTER=9, PROTO_MESH=10, PROTO_UDP=11,)
Application protocol spoken on a listener port or connection slot.