Commit Graph

15 Commits

Author SHA1 Message Date
Slava Monich 3350f51a21 [gbinder] Added gbinder_reader_read_nullable_string8
The equivalent of Android's Parcel::readString8
2024-09-24 18:48:39 +03:00
Slava Monich 3c828b453a [gbinder] Housekeeping. JB#54354 2022-02-20 02:31:56 +02:00
Eugenio Paolantonio (g7) 5fd5b423c1 [gbinder] Added reader for parcelables
Signed-off-by: Eugenio Paolantonio (g7) <me@medesimo.eu>
2022-02-19 19:06:12 +01:00
Slava Monich 97831a65da [gbinder] Added readers for int8 and int16. JB#42956 2021-12-27 06:36:22 +02:00
Slava Monich d439bd467a [gbinder] Added gbinder_reader_get_data(). JB#55014
Mostly for logging purposes.
2021-11-23 19:25:49 +02:00
Slava Monich 000534654d [gbinder] Added gbinder_reader_read_string16_utf16(). JB#42956
Returns const pointer to UTF-16 string in binder's buffer. The
memory pointed to by this string gets automatically deallocated
by libgbinder when transaction completes.

Also added const to gbinder_reader_read_nullable_string16_utf16()
output argument. It may cause compilation warnings, but that makes
it obvious that caller doesn't deallocate the returned pointer, in
my opinion it's worth the trouble.
2019-01-22 18:39:51 +02:00
Slava Monich c3f783bf7e [gbinder] Added gbinder_reader_read_hidl_string_c(). JB#42956
It allows to fetch a pointer to the hidl string contents (which must
be NULL terminated) without duplicating the string and allocating any
memory in the process.

Added gbinder_reader_skip_hidl_string() macro.

Reduced number of memory allocations performed by functions parsing
buffer objects. Many of them don't allocate any memory at all now.
2019-01-15 14:44:25 +02:00
Slava Monich c39bf4b802 [gbinder] Support for file descriptors. JB#42956
gbinder_writer_append_fd() duplicates the descriptor and appends
the duplicate to the parcel. The caller may immediately close its
descriptor.

gbinder_reader_read_fd() fetches the descriptor from the parcel
without duplicating it. The descrriptor will be closed as soon as
the library has finished processing the request. Returns -1 on error.

gbinder_reader_read_dup_fd() fetches descriptor from the parcel
and dups it. The caller is responsible for closing the returned
descriptor. Returns -1 on failure.
2018-12-08 16:27:45 +02:00
Slava Monich 31a1d19b4e [gbinder] Added gbinder_reader_read_nullable_string16_utf16(). JB#43524
This function allows to read UTF-16 strings from Java parcel as UTF-16,
without any conversion.

As a side effect, it also allows parsing strings containing embedded
NULL characters.
2018-12-06 21:50:08 +02:00
Slava Monich 5a35ed5ea1 [gbinder] Added gbinder_reader_copy(). JB#42956
Even though it's just a straight memcpy at the moment.
Also, constified GBinderReader pointer where appropriate.

This allows passing const GBinderReader pointer as a parameter and
a) allow the callee to parse the payload and b) make sure that the
caller's reader doesn't get damaged (well, or at least warn the callee
that it's doing the wrong thing).
2018-12-06 16:35:30 +02:00
Juho Hämäläinen b2206adae5 [gbinder] Add byte array reader and writer. JB#43536
New functions gbinder_reader_read_byte_array() and
gbinder_writer_append_byte_array()
2018-10-30 07:28:19 +02:00
Slava Monich f14783b8cf [gbinder] Add gbinder_reader_read_hidl_struct() macro. JB#42956
As well as two macros for reading arrays:

   gbinder_reader_read_hidl_type_vec() - vec<type>
   gbinder_reader_read_hidl_byte_vec() - vec<uint8_t>

These convenient for pulling structures and arrays from hwbinder
requests and responses.

Note that data are not being copied, all these macros return pointers
to the memory buffer passed to us by the kernel. Such pointers remain
valid as long the associated remote request/response is alive.
2018-10-06 18:07:39 +03:00
Slava Monich 9eae4ef819 [gbinder] Added gbinder_reader_read_hidl_vec(). JB#42956
This provides a generic way to read any array of any primitive
types or structures. Note that it doesn't copy the data and
directly returns the pointer provided by the kernel.
2018-09-24 03:14:33 +03:00
Matti Lehtimäki 2860286ff1 [gbinder] Add double and float support. MER#1942 2018-08-16 23:33:29 +03:00
Slava Monich fb981c9983 [gbinder] C interface for Android binder. JB#41335 2018-07-15 17:38:51 +03:00