mirror of
https://github.com/espressif/openthread.git
synced 2026-09-04 16:20:05 +00:00
[spinel] add udp port to the epskc state property (#11975)
This commit adds a field UDP port in the property SPINEL_PROP_BORDER_AGENT_EPHEMERAL_KEY_STATE. Similar as `SPINEL_PROP_BORDER_AGENT_MESHCOP_SERVICE_STATE`, NCP needs to sync the UDP port number to the host as well so that the UDP proxy on the host can correctly map the port and forward the UDP packet to the NCP. I missed the field in the previous commit. But since the spinel property was just added recently and it hasn't been put into usage, I think it's fine to change the existing spinel protocol.
This commit is contained in:
@@ -4913,9 +4913,11 @@ enum
|
||||
|
||||
/// Border Agent Ephemeral Key State.
|
||||
/**
|
||||
* Format: `C` - Get and Unsolicited notifications.
|
||||
* Format: `CS` - Get and Unsolicited notifications.
|
||||
*
|
||||
* `C`: The Ephemeral Key state. The value corresponds to `otBorderAgentEphemeralKeyState`.
|
||||
* `S`: The UDP port that is being used by the ephemeral key. If the state is 'Disabled' or 'Stopped' , the port
|
||||
* MUST be 0.
|
||||
*/
|
||||
SPINEL_PROP_BORDER_AGENT_EPHEMERAL_KEY_STATE = SPINEL_PROP_BORDER_AGENT__BEGIN + 2,
|
||||
|
||||
|
||||
@@ -1748,7 +1748,13 @@ exit:
|
||||
|
||||
template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_BORDER_AGENT_EPHEMERAL_KEY_STATE>(void)
|
||||
{
|
||||
return mEncoder.WriteUint8(static_cast<uint8_t>(otBorderAgentEphemeralKeyGetState(mInstance)));
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
SuccessOrExit(error = mEncoder.WriteUint8(static_cast<uint8_t>(otBorderAgentEphemeralKeyGetState(mInstance))));
|
||||
SuccessOrExit(error = mEncoder.WriteUint16(otBorderAgentEphemeralKeyGetUdpPort(mInstance)));
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user