Skip to content

Commit e5719ec

Browse files
author
Jamie C. Driver
committed
cbor: expose method for accessing raw string data in message
Similar to the existing for unsigned bytes (for when the message contains the data at the root rather than having a map of named values).
1 parent ec166b7 commit e5719ec

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

main/utils/cbor_rpc.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,11 @@ bool rpc_get_n_bytes(const char* field, const CborValue* value, const size_t exp
236236
return written == expected_size;
237237
}
238238

239+
void rpc_get_raw_string_ptr(const CborValue* value, const char** data, size_t* size)
240+
{
241+
rpc_get_raw_type_ptr(value, (const uint8_t**)data, size, CBOR_TEXT_MASK);
242+
}
243+
239244
void rpc_get_string_ptr(const char* field, const CborValue* value, const char** data, size_t* size)
240245
{
241246
rpc_get_type_ptr(field, value, (const uint8_t**)data, size, CBOR_TEXT_MASK);

main/utils/cbor_rpc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ bool rpc_is_method(const CborValue* value, const char* method);
4141

4242
// Some typed/checked getters for various nodes/data-types
4343
bool rpc_has_field_data(const char* field, const CborValue* value);
44+
void rpc_get_raw_string_ptr(const CborValue* value, const char** data, size_t* size);
4445
void rpc_get_string_ptr(const char* field, const CborValue* value, const char** data, size_t* size);
4546
void rpc_get_string(const char* field, size_t max, const CborValue* value, char* data, size_t* written);
4647
void rpc_get_raw_bytes_ptr(const CborValue* value, const uint8_t** data, size_t* size);

0 commit comments

Comments
 (0)