mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
* ANON_REQ_TYPE_VER_OWNER now delimited by newline chars
This commit is contained in:
parent
65796c8f20
commit
4e4f6d92a0
1 changed files with 1 additions and 12 deletions
|
|
@ -159,14 +159,6 @@ uint8_t MyMesh::handleAnonRegionsReq(const mesh::Identity& sender, uint32_t send
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sanitiseName(char* dest, const char* src) {
|
|
||||||
while (*src) {
|
|
||||||
*dest++ = (*src == ',') ? ' ' : *src;
|
|
||||||
src++;
|
|
||||||
}
|
|
||||||
*dest = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t MyMesh::handleAnonVerOwnerReq(const mesh::Identity& sender, uint32_t sender_timestamp, const uint8_t* data) {
|
uint8_t MyMesh::handleAnonVerOwnerReq(const mesh::Identity& sender, uint32_t sender_timestamp, const uint8_t* data) {
|
||||||
if (anon_limiter.allow(rtc_clock.getCurrentTime())) {
|
if (anon_limiter.allow(rtc_clock.getCurrentTime())) {
|
||||||
// request data has: {reply-path-len}{reply-path}
|
// request data has: {reply-path-len}{reply-path}
|
||||||
|
|
@ -174,13 +166,10 @@ uint8_t MyMesh::handleAnonVerOwnerReq(const mesh::Identity& sender, uint32_t sen
|
||||||
memcpy(reply_path, data, reply_path_len);
|
memcpy(reply_path, data, reply_path_len);
|
||||||
// data += reply_path_len;
|
// data += reply_path_len;
|
||||||
|
|
||||||
char tmp[sizeof(_prefs.node_name)];
|
|
||||||
sanitiseName(tmp, _prefs.node_name);
|
|
||||||
|
|
||||||
memcpy(reply_data, &sender_timestamp, 4); // prefix with sender_timestamp, like a tag
|
memcpy(reply_data, &sender_timestamp, 4); // prefix with sender_timestamp, like a tag
|
||||||
uint32_t now = getRTCClock()->getCurrentTime();
|
uint32_t now = getRTCClock()->getCurrentTime();
|
||||||
memcpy(&reply_data[4], &now, 4); // include our clock (for easy clock sync, and packet hash uniqueness)
|
memcpy(&reply_data[4], &now, 4); // include our clock (for easy clock sync, and packet hash uniqueness)
|
||||||
sprintf((char *) &reply_data[8], "%s,%s,%s", FIRMWARE_VERSION, tmp, _prefs.owner_info);
|
sprintf((char *) &reply_data[8], "%s\n%s\n%s", FIRMWARE_VERSION, _prefs.node_name, _prefs.owner_info);
|
||||||
|
|
||||||
return 8 + strlen((char *) &reply_data[8]); // reply length
|
return 8 + strlen((char *) &reply_data[8]); // reply length
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue