16 #define RzIORAP_FD(x) (((x)->data) ? (((RzIORap *)((x)->data))->client) : NULL)
17 #define RzIORAP_IS_LISTEN(x) (((RzIORap *)((x)->data))->listener)
18 #define RzIORAP_IS_VALID(x) ((x) && ((x)->data) && ((x)->plugin == &rz_io_plugin_rap))
27 if (rap &&
fd != -1) {
44 if (
r &&
fd->fd != -1) {
55 eprintf(
"__rap_close: fdesc is not a rz_io_rap plugin\n");
76 bool is_ssl = (!strncmp(
pathname,
"raps://", 7));
77 const char *host =
pathname + (is_ssl ? 7 : 6);
78 if (!(port = strchr(host,
':'))) {
82 listenmode = (*host ==
':');
88 if ((
file = strchr(port + 1,
'/'))) {
94 eprintf(
"rap: cannot listen here. Try rap://:9999\n");
98 eprintf(
"rap: listening at port %s ssl %s\n", port, (is_ssl) ?
"on" :
"off");
129 eprintf(
"Cannot create new socket\n");
132 eprintf(
"Connecting to %s, port %s\n", host, port);
134 eprintf(
"Cannot connect to '%s' (%d)\n", host,
p);
138 eprintf(
"Connected to: %s at port %s\n", host, port);
154 eprintf(
"rap connection was successful. open %d\n",
i);
174 int ret, reslen = 0, cmdlen = 0;
176 char *ptr, *res, *
str;
181 if (
i > RMT_MAX - 5) {
182 eprintf (
"Command too long\n");
198 if (
buf[0] != RMT_CMD) {
210 if (cmdlen + 1 == 0) {
217 res = io->cb_core_cmdstr (io->user,
str);
222 reslen = strlen (res);
236 if (
buf[0] != (RMT_CMD | RMT_REPLY)) {
237 eprintf (
"Unexpected rap cmd reply\n");
247 ptr = (
char *)
calloc (1,
i + 1);
281 .desc =
"Remote binary protocol plugin",
282 .uris =
"rap://,raps://",
295 #ifndef RZ_PLUGIN_INCORE
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
RZ_API void Ht_() free(HtName_(Ht) *ht)
static bool __rap_plugin_open(RzIO *io, const char *pathname, bool many)
#define RzIORAP_IS_LISTEN(x)
static RzIODesc * __rap_open(RzIO *io, const char *pathname, int rw, int mode)
static bool __rap_accept(RzIO *io, RzIODesc *desc, int fd)
static int __rap_close(RzIODesc *fd)
RZ_API RzLibStruct rizin_plugin
static char * __rap_system(RzIO *io, RzIODesc *fd, const char *command)
RzIOPlugin rz_io_plugin_rap
static int __rap_listener(RzIODesc *fd)
#define RzIORAP_IS_VALID(x)
static ut64 __rap_lseek(RzIO *io, RzIODesc *fd, ut64 offset, int whence)
static int __rap_write(RzIO *io, RzIODesc *fd, const ut8 *buf, int count)
static int __rap_read(RzIO *io, RzIODesc *fd, ut8 *buf, int count)
return memset(p, 0, total)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
void * calloc(size_t number, size_t size)
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc static sig const char pathname
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
static ut32 rz_read_at_be32(const void *src, size_t offset)
static void rz_write_be32(void *dest, ut32 val)
RZ_API RzIODesc * rz_io_desc_new(RzIO *io, RzIOPlugin *plugin, const char *uri, int flags, int mode, void *data)
RZ_API char * rz_socket_rap_client_command(RzSocket *s, const char *cmd, RzCoreBind *c)
RZ_API int rz_socket_close(RzSocket *s)
RZ_API int rz_socket_read_block(RzSocket *s, unsigned char *buf, int len)
RZ_API int rz_socket_rap_client_open(RzSocket *s, const char *file, int rw)
RZ_API int rz_socket_rap_client_write(RzSocket *s, const ut8 *buf, int count)
RZ_API bool rz_socket_listen(RzSocket *s, const char *port, const char *certfile)
RZ_API int rz_socket_flush(RzSocket *s)
RZ_API void RZ_API int rz_socket_read(RzSocket *s, ut8 *read, int len)
RZ_API bool rz_socket_connect(RzSocket *s, const char *host, const char *port, int proto, unsigned int timeout)
#define RZ_SOCKET_PROTO_TCP
RZ_API int rz_socket_rap_client_read(RzSocket *s, ut8 *buf, int count)
RZ_API RzSocket * rz_socket_new(bool is_ssl)
RZ_API RzSocket * rz_socket_new_from_fd(int fd)
RZ_API int rz_socket_free(RzSocket *s)
RZ_API int rz_socket_write(RzSocket *s, void *buf, int len)
RZ_API int rz_socket_rap_client_seek(RzSocket *s, ut64 offset, int whence)
RZ_API bool rz_str_startswith(RZ_NONNULL const char *str, RZ_NONNULL const char *needle)
Checks if a string starts with a specifc sequence of characters (case sensitive)
#define tr(opcode, mask, lose, flags)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static const z80_opcode fd[]