Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 31 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
rz-pipe
======
# rz-pipe
The `rz-pipe` provides access to `rz_core_cmd_str()`.

The rz-pipe APIs are based on a single rizin primitive found behind `rz_core_cmd_str()`
which is a function that accepts a string parameter describing the rizin command to
run and returns a string with the result.

The decision behind this design comes from a series of benchmarks with different
libffi implementations and resulted that using the native API is more complex and
slower than just using raw command strings and parsing the output.
## Usage
This function **takes a string parameter describing the rizin command** to execute and **returns a string** with the result.

As long as the output can be tricky to parse, it's recommended to use the JSON
output and deserializing them into native language objects which results much more
handy than handling and maintaining internal data structures and pointers.
```json
"fij"
```
->
```json
Copy link
Member

@wargio wargio Apr 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably it would make sense to have:

for example, running `fij` via rz-pipe returns the following json data.

[{"name":"entry0","size":1,"offset":27296},{"name":"entry.fini0","size":1,"offset":27456},{"name":"entry.init0","size":1,"offset":27520}]
```

Also, memory management results into a much simpler thing because you only have
to care about freeing the resulting string.

This directory contains different implementations of the rz-pipe API for different
languages which could handle different communication backends:
## Design Choice
After benchmarking various `libffi` implementations, it was found that using the native API is both more complex and slower compared to utilizing raw command strings and parsing their output.
Parsing the output can be challenging, so it's advisable to use JSON output and deserialize it into native language objects.
This approach proves to be much more convenient than dealing with and maintaining internal data structures and pointers.

* Grab RZPIPE{_IN|_OUT} environment variables
* Spawn `rizin -q0` and communicate with pipe(2)
* Plain TCP connection
* HTTP queries (connecting to a remote webserver)
* RAP protocol (rizin own's remote protocol)
Moreover, memory management becomes simpler since you only need to focus on freeing the resulting string.

The current supported languages are:
## Backends
In this directory, you'll find different implementations of the `rz-pipe` API for various languages, each capable of handling different communication backends:

* Python
* Go
* Haskell
* OCaml
* Rust
* Ruby
- Retrieving RZPIPE{_IN|_OUT} environment variables
- Spawning `rizin -q0` and communicating with pipe(2)
- Plain TCP connection
- HTTP queries (connecting to a remote webserver)
- RAP protocol (rizin's custom remote protocol)

## Supported Languages
- Python
- Go
- Haskell
- OCaml
- Rust
- Ruby
Loading