10 #define READ_TIMEOUT (300 * 1000 * 1000)
11 #define FRAME_CHAR 0x7e
14 #define SET_CHANNEL_RESET 0
15 #define SET_CHANNEL_DEBUG 1
16 #define SET_CHANNEL_TEXT 2
17 #define SET_CHANNEL_NAK 0xff
26 eprintf(
"%s: data too long\n", __func__);
30 g->recv.data[
g->data_len++] = ch;
38 for (;
g->read_ptr <
g->read_len;
g->read_ptr++) {
39 char cur =
g->read_buff[
g->read_ptr];
49 eprintf(
"%s: Checksum error\n", __func__);
69 eprintf(
"Initialize libqnxr_t first\n");
76 if (
g->read_len == 0 ||
g->read_ptr ==
g->read_len) {
90 if (
g->read_len <= 0) {
92 eprintf(
"%s: read failed\n", __func__);
102 eprintf(
"%s: unpack failed\n", __func__);
106 if (
g->data_len >=
sizeof(
struct DShdr)) {
107 if (
g->recv.pkt.hdr.channel)
108 g->channelrd =
g->recv.pkt.hdr.channel;
109 }
else if (
g->data_len >= 1) {
111 eprintf(
"%s: NAK received\n", __func__);
116 g->channelrd =
g->recv.data[0];
121 return g->data_len - 1;
145 eprintf(
"Initialize libqnxr_t first\n");
156 for (
i = 0;
i <
g->send_len;
i++) {
181 if (
g->channelwr !=
g->tran.pkt.hdr.channel) {
182 switch (
g->tran.pkt.hdr.channel) {
190 g->channelwr =
g->tran.pkt.hdr.channel;
RZ_API int rz_socket_ready(RzSocket *s, int secs, int usecs)
RZ_API void RZ_API int rz_socket_read(RzSocket *s, ut8 *read, int len)
RZ_API int rz_socket_write(RzSocket *s, void *buf, int len)
static ut8 ch_debug_packet[]
#define SET_CHANNEL_DEBUG
static ut8 ch_reset_packet[]
int qnxr_read_packet(libqnxr_t *g)
Function reads data from the established connection.
static ut8 ch_text_packet[]
int qnxr_send_ch_reset(libqnxr_t *g)
int qnxr_send_ch_text(libqnxr_t *g)
static int unpack(libqnxr_t *g)
static int append(libqnxr_t *g, char ch)
#define SET_CHANNEL_RESET
int qnxr_send_nak(libqnxr_t *g)
int qnxr_send_packet(libqnxr_t *g)
sends a packet sends a packet to the established connection
int qnxr_send_ch_debug(libqnxr_t *g)