-
Notifications
You must be signed in to change notification settings - Fork 82
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
Add support for raweth locator #303
Conversation
memcpy(&self->_socket._raweth._smac, addr, _ZP_MAC_ADDR_LENGTH); | ||
z_free(addr); | ||
} else { | ||
memcpy(&self->_socket._raweth._smac, _ZP_RAWETH_CFG_SMAC, _ZP_MAC_ADDR_LENGTH); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 17.7 rule Note
@@ -161,4 +205,19 @@ | |||
_ZP_UNUSED(endpoint); | |||
return _Z_ERR_TRANSPORT_NOT_AVAILABLE; | |||
} | |||
|
|||
size_t _z_raweth_config_strlen(const _z_str_intmap_t *s) { |
Check warning
Code scanning / Cppcheck (reported by Codacy)
misra violation 804 with no text in the supplied rule-texts-file Warning
return NULL; | ||
} | ||
|
||
int8_t _z_raweth_config_from_str(_z_str_intmap_t *strint, const char *s) { |
Check warning
Code scanning / Cppcheck (reported by Codacy)
misra violation 804 with no text in the supplied rule-texts-file Warning
return _z_str_intmap_to_str(s, RAWETH_CONFIG_ARGC, args); | ||
} | ||
|
||
int8_t _z_raweth_config_from_str(_z_str_intmap_t *strint, const char *s) { |
Check warning
Code scanning / Cppcheck (reported by Codacy)
misra violation 804 with no text in the supplied rule-texts-file Warning
_ZP_UNUSED(s); | ||
return 0; | ||
} | ||
char *_z_raweth_config_to_str(const _z_str_intmap_t *s) { |
Check warning
Code scanning / Cppcheck (reported by Codacy)
misra violation 804 with no text in the supplied rule-texts-file Warning
memcpy(&self->_socket._raweth._smac, _ZP_RAWETH_CFG_SMAC, _ZP_MAC_ADDR_LENGTH); | ||
if (_z_valid_address_raweth(self->_endpoint._locator._address)) { | ||
uint8_t *addr = _z_parse_address_raweth(self->_endpoint._locator._address); | ||
memcpy(&self->_socket._raweth._smac, addr, _ZP_MAC_ADDR_LENGTH); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 17.7 rule Note
_Z_DEBUG("Key '%s' wasn't found in config mapping, sending to default address\n", keyexpr->_suffix); | ||
} | ||
// Store data into socket | ||
memcpy(&sock->_dmac, &_ZP_RAWETH_CFG_ARRAY[idx]._dmac, _ZP_MAC_ADDR_LENGTH); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 17.7 rule Note
uint16_t vlan = _ZP_RAWETH_CFG_ARRAY[idx]._vlan; | ||
sock->_has_vlan = _ZP_RAWETH_CFG_ARRAY[idx]._has_vlan; | ||
if (sock->_has_vlan) { | ||
memcpy(&sock->_vlan, &vlan, sizeof(vlan)); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 17.7 rule Note
_Z_RES_OK) { | ||
continue; | ||
} | ||
return i; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 15.5 rule Note
memcpy(&sock->_dmac, &_ZP_RAWETH_CFG_ARRAY[idx]._dmac, _ZP_MAC_ADDR_LENGTH); | ||
uint16_t vlan = _ZP_RAWETH_CFG_ARRAY[idx]._vlan; | ||
sock->_has_vlan = _ZP_RAWETH_CFG_ARRAY[idx]._has_vlan; | ||
if (sock->_has_vlan) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 14.4 rule Note
For ease of use, we can now specify in the locator, the source mac address and the interface a raweth socket will use to communicate.
E.g:
reth/01:02:03:04:05:06#iface=eth0
If any of this information is invalid or missing, e.g:
reth/0
, the socket will fall back to the values defined inzenoh-pico/src/transport/raweth/config.c
.In addition, initially a put of a keyexpr not specified in the config mapping would be dropped, now it's sent to the default config address (first entry) with a log.