-
Notifications
You must be signed in to change notification settings - Fork 85
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 encoding format on the wire #399
Merged
Mallets
merged 8 commits into
eclipse-zenoh:protocol_changes
from
jean-roland:ft_encoding
Apr 11, 2024
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
93704c3
feat: update encoding wire change
jean-roland f21b518
refactor: rename codec test gen_uint to gen_uint32
jean-roland 3947232
test: update codec test for encoding
jean-roland 9d5a420
fix: add encoding_len codec function
jean-roland 9b3a450
fix: deactivating interests temporarily
jean-roland 1f615e1
build: suppress msvc warning c4127
jean-roland 97eefed
fix: remove unused variable warning
jean-roland 469c741
fix: rename encoding fields
jean-roland File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,7 +145,7 @@ uint64_t gen_uint64(void) { | |
return ret; | ||
} | ||
|
||
unsigned int gen_uint(void) { | ||
uint32_t gen_uint32(void) { | ||
unsigned int ret = 0; | ||
z_random_fill(&ret, sizeof(ret)); | ||
return ret; | ||
|
@@ -236,15 +236,20 @@ _z_locator_array_t gen_locator_array(size_t size) { | |
return la; | ||
} | ||
|
||
_z_value_t gen_value(void) { | ||
_z_value_t val; | ||
val.encoding.prefix = gen_zint(); | ||
_z_encoding_t gen_encoding(void) { | ||
_z_encoding_t en; | ||
en.prefix = gen_uint32() & 0x7fffffff; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prefix should be represented as an |
||
if (gen_bool()) { | ||
val.encoding.suffix = gen_bytes(8); | ||
en.suffix = gen_bytes(16); | ||
} else { | ||
val.encoding.suffix = _z_bytes_empty(); | ||
en.suffix = _z_bytes_empty(); | ||
} | ||
return en; | ||
} | ||
|
||
_z_value_t gen_value(void) { | ||
_z_value_t val; | ||
val.encoding = gen_encoding(); | ||
if (gen_bool()) { | ||
val.payload = _z_bytes_empty(); | ||
} else { | ||
|
@@ -532,7 +537,6 @@ void assert_eq_source_info(const _z_source_info_t *left, const _z_source_info_t | |
assert(left->_entity_id == right->_entity_id); | ||
assert(memcmp(left->_id.id, right->_id.id, 16) == 0); | ||
} | ||
_z_encoding_t gen_encoding(void) { return (_z_encoding_t){.prefix = gen_uint64(), .suffix = gen_bytes(16)}; } | ||
void assert_eq_encoding(const _z_encoding_t *left, const _z_encoding_t *right) { | ||
assert(left->prefix == right->prefix); | ||
assert_eq_bytes(&left->suffix, &right->suffix); | ||
|
@@ -1310,7 +1314,7 @@ _z_n_msg_response_t gen_response(void) { | |
._ext_timestamp = gen_bool() ? gen_timestamp() : _z_timestamp_null(), | ||
._ext_responder = {._eid = gen_uint16(), ._zid = gen_zid()}, | ||
}; | ||
switch (gen_uint() % 2) { | ||
switch (gen_uint32() % 2) { | ||
case 0: { | ||
ret._tag = _Z_RESPONSE_BODY_ERR; | ||
ret._body._err = gen_err(); | ||
|
@@ -1463,9 +1467,9 @@ void init_message(void) { | |
|
||
_z_transport_message_t gen_open(void) { | ||
if (gen_bool()) { | ||
return _z_t_msg_make_open_syn(gen_uint(), gen_uint(), gen_bytes(16)); | ||
return _z_t_msg_make_open_syn(gen_uint32(), gen_uint32(), gen_bytes(16)); | ||
} else { | ||
return _z_t_msg_make_open_ack(gen_uint(), gen_uint()); | ||
return _z_t_msg_make_open_ack(gen_uint32(), gen_uint32()); | ||
} | ||
} | ||
void assert_eq_open(const _z_t_msg_open_t *left, const _z_t_msg_open_t *right) { | ||
|
@@ -1583,7 +1587,7 @@ _z_network_message_vec_t gen_net_msgs(size_t n) { | |
} | ||
|
||
_z_transport_message_t gen_frame(void) { | ||
return _z_t_msg_make_frame(gen_uint(), gen_net_msgs(gen_uint8() % 16), gen_bool()); | ||
return _z_t_msg_make_frame(gen_uint32(), gen_net_msgs(gen_uint8() % 16), gen_bool()); | ||
} | ||
void assert_eq_frame(const _z_t_msg_frame_t *left, const _z_t_msg_frame_t *right) { | ||
assert(left->_sn == right->_sn); | ||
|
@@ -1609,7 +1613,7 @@ void frame_message(void) { | |
} | ||
|
||
_z_transport_message_t gen_fragment(void) { | ||
return _z_t_msg_make_fragment(gen_uint(), gen_bytes(gen_uint8()), gen_bool(), gen_bool()); | ||
return _z_t_msg_make_fragment(gen_uint32(), gen_bytes(gen_uint8()), gen_bool(), gen_bool()); | ||
} | ||
void assert_eq_fragment(const _z_t_msg_fragment_t *left, const _z_t_msg_fragment_t *right) { | ||
assert(left->_sn == right->_sn); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For naming alignment, it should be called
has_schema
anden->schema
.