#include "rz_io.h"
#include "rz_lib.h"
#include "rz_socket.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
Go to the source code of this file.
|
static int | __write (RzIO *io, RzIODesc *fd, const ut8 *buf, int count) |
|
static int | __read (RzIO *io, RzIODesc *fd, ut8 *buf, int count) |
|
static int | __close (RzIODesc *fd) |
|
static ut64 | __lseek (RzIO *io, RzIODesc *fd, ut64 offset, int whence) |
|
static bool | __check (RzIO *io, const char *pathname, bool many) |
|
static RzIODesc * | __open (RzIO *io, const char *pathname, int rw, int mode) |
|
static char * | __system (RzIO *io, RzIODesc *fd, const char *msg) |
|
◆ RZP
◆ __check()
Definition at line 137 of file io_rzpipe.c.
138 return (!strncmp(
pathname,
"rzpipe://", 9));
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
References pathname.
Referenced by __open().
◆ __close()
◆ __lseek()
◆ __open()
Definition at line 141 of file io_rzpipe.c.
static bool __check(RzIO *io, const char *pathname, bool many)
RzIOPlugin rz_io_plugin_rzpipe
RZ_API RzIODesc * rz_io_desc_new(RzIO *io, RzIOPlugin *plugin, const char *uri, int flags, int mode, void *data)
RZ_API RzPipe * rzpipe_open(const char *cmd)
References __check(), NULL, pathname, rz_io_desc_new(), rz_io_plugin_rzpipe, and rzpipe_open().
◆ __read()
Definition at line 48 of file io_rzpipe.c.
49 char fmt[4096],
num[128];
50 int rv, rescount = -1;
53 if (!
fd || !
fd->data) {
60 "{\"op\":\"read\",\"address\":%" PFMT64d ",\"count\":%d}",
64 eprintf(
"rzpipe_write: error\n");
70 r = strstr(res,
"result");
72 rescount = atoi(
r + 6 + 2);
74 r = strstr(res,
"data");
76 char *
arr = strchr(
r,
':');
77 if (!
arr ||
arr[1] !=
'[') {
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 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 static mode static oldfd struct tms static buf static getgid static geteuid const char static filename static arg static mask struct ustat static ubuf static getppid static setsid static egid sigset_t static set struct timeval struct timezone static tz fd_set fd_set fd_set struct timeval static timeout const char char static bufsiz const char static swapflags void static offset const char static length static mode static who const char struct statfs static buf unsigned unsigned num
RZ_API char * rzpipe_read(RzPipe *rzpipe)
RZ_API int rzpipe_write(RzPipe *rzpipe, const char *str)
References syscall_preprocessing::arr, count, eprintf, fd, free(), num, rz_io_t::off, PFMT64d, r, RZP, rzpipe_read(), rzpipe_write(), and snprintf.
◆ __system()
Definition at line 151 of file io_rzpipe.c.
155 pj_ks(pj,
"op",
"system");
162 eprintf(
"rzpipe_write: error\n");
168 char *
r = strstr(res,
"result");
170 int rescount = atoi(
r + 6 + 1);
171 eprintf(
"RESULT %d\n", rescount);
#define rz_return_val_if_fail(expr, val)
RZ_API PJ * pj_end(PJ *j)
RZ_API const char * pj_string(PJ *pj)
RZ_API void pj_free(PJ *j)
RZ_API PJ * pj_ks(PJ *j, const char *k, const char *v)
static struct sockaddr static addrlen static backlog const void msg
References eprintf, fd, free(), msg, NULL, pj_end(), pj_free(), pj_ks(), pj_new(), pj_o(), pj_string(), r, rz_return_val_if_fail, RZP, rzpipe_read(), and rzpipe_write().
◆ __write()
Definition at line 16 of file io_rzpipe.c.
18 char *bufn, bufnum[4096];
19 int i, rv, rescount = -1;
20 if (!
fd || !
fd->data) {
26 int bufn_sz =
sizeof(bufnum) - (bufn - bufnum);
31 "{\"op\":\"write\",\"address\":%" PFMT64d ",\"data\":[%s]}",
33 if (
len >=
sizeof(fmt)) {
34 eprintf(
"rzpipe_write: error, fmt string has been truncated\n");
39 eprintf(
"rzpipe_write: error\n");
References count, eprintf, fd, i, len, rz_io_t::off, PFMT64d, RZP, rzpipe_read(), rzpipe_write(), and snprintf.
◆ rizin_plugin
◆ rz_io_plugin_rzpipe
Initial value:= {
.name = "rzpipe",
.desc = "rzpipe io plugin",
.license = "MIT",
.uris = "rzpipe://",
}
static int __read(RzIO *io, RzIODesc *fd, ut8 *buf, int count)
static char * __system(RzIO *io, RzIODesc *fd, const char *msg)
static RzIODesc * __open(RzIO *io, const char *pathname, int rw, int mode)
static int __write(RzIO *io, RzIODesc *fd, const ut8 *buf, int count)
static ut64 __lseek(RzIO *io, RzIODesc *fd, ut64 offset, int whence)
static int __close(RzIODesc *fd)
Definition at line 177 of file io_rzpipe.c.
Referenced by __open().