|
ESPHome 2026.3.0
|
#include <api_frame_helper_noise.h>
Public Member Functions | |
| APINoiseFrameHelper (std::unique_ptr< socket::Socket > socket, APINoiseContext &ctx) | |
| ~APINoiseFrameHelper () override | |
| APIError | init () override |
| Initialize the frame helper, returns OK if successful. | |
| APIError | loop () override |
| Run through handshake messages (if in that phase) | |
| APIError | read_packet (ReadPacketBuffer *buffer) override |
| APIError | write_protobuf_packet (uint8_t type, ProtoWriteBuffer buffer) override |
| APIError | write_protobuf_messages (ProtoWriteBuffer buffer, std::span< const MessageInfo > messages) override |
Public Member Functions inherited from esphome::api::APIFrameHelper | |
| APIFrameHelper ()=default | |
| APIFrameHelper (std::unique_ptr< socket::Socket > socket) | |
| const char * | get_client_name () const |
| const char * | get_peername_to (std::span< char, socket::SOCKADDR_STR_LEN > buf) const |
| void | set_client_name (const char *name, size_t len) |
| virtual | ~APIFrameHelper ()=default |
| bool | can_write_without_blocking () |
| int | getpeername (struct sockaddr *addr, socklen_t *addrlen) |
| APIError | close () |
| APIError | shutdown (int how) |
| void | set_nodelay_for_message (bool is_log_message) |
| uint8_t | frame_header_padding () const |
| uint8_t | frame_footer_size () const |
| bool | is_socket_ready () const |
| void | release_buffers () |
Protected Member Functions | |
| APIError | state_action_ () |
| To be called from read/write methods. | |
| APIError | try_read_frame_ () |
| Read a packet into the rx_buf_. | |
| APIError | write_frame_ (const uint8_t *data, uint16_t len) |
| APIError | init_handshake_ () |
| Initiate the data structures for the handshake. | |
| APIError | check_handshake_finished_ () |
| void | send_explicit_handshake_reject_ (const LogString *reason) |
| APIError | handle_handshake_frame_error_ (APIError aerr) |
| APIError | handle_noise_error_ (int err, const LogString *func_name, APIError api_err) |
Protected Member Functions inherited from esphome::api::APIFrameHelper | |
| APIError | write_raw_ (const struct iovec *iov, int iovcnt, uint16_t total_write_len) |
| APIError | try_send_tx_buf_ () |
| void | buffer_data_from_iov_ (const struct iovec *iov, int iovcnt, uint16_t total_write_len, uint16_t offset) |
| APIError | handle_socket_write_error_ () |
| APIError ESPHOME_ALWAYS_INLINE | check_data_state_ () const |
| void | set_nodelay_raw_ (bool enable) |
| APIError | init_common_ () |
| APIError | handle_socket_read_result_ (ssize_t received) |
Protected Attributes | |
| NoiseHandshakeState * | handshake_ {nullptr} |
| NoiseCipherState * | send_cipher_ {nullptr} |
| NoiseCipherState * | recv_cipher_ {nullptr} |
| APINoiseContext & | ctx_ |
| APIBuffer | prologue_ |
| NoiseProtocolId | nid_ |
| uint8_t | rx_header_buf_ [3] |
| uint8_t | rx_header_buf_len_ = 0 |
Protected Attributes inherited from esphome::api::APIFrameHelper | |
| std::unique_ptr< socket::Socket > | socket_ |
| std::array< std::unique_ptr< SendBuffer >, API_MAX_SEND_QUEUE > | tx_buf_ |
| APIBuffer | rx_buf_ |
| char | client_name_ [CLIENT_INFO_NAME_MAX_LEN] {} |
| uint16_t | rx_buf_len_ = 0 |
| State | state_ {State::INITIALIZE} |
| uint8_t | frame_header_padding_ {0} |
| uint8_t | frame_footer_size_ {0} |
| uint8_t | tx_buf_head_ {0} |
| uint8_t | tx_buf_tail_ {0} |
| uint8_t | tx_buf_count_ {0} |
| int8_t | nodelay_state_ {NODELAY_ON} |
Additional Inherited Members | |
Protected Types inherited from esphome::api::APIFrameHelper | |
| enum class | State : uint8_t { INITIALIZE = 1 , CLIENT_HELLO = 2 , SERVER_HELLO = 3 , HANDSHAKE = 4 , DATA = 5 , CLOSED = 6 , FAILED = 7 , EXPLICIT_REJECT = 8 } |
Static Protected Attributes inherited from esphome::api::APIFrameHelper | |
| static constexpr int8_t | NODELAY_ON = -1 |
| static constexpr int8_t | LOG_NAGLE_COUNT = 2 |
Definition at line 10 of file api_frame_helper_noise.h.
|
inline |
Definition at line 12 of file api_frame_helper_noise.h.
|
override |
Definition at line 612 of file api_frame_helper_noise.cpp.
|
protected |
Definition at line 584 of file api_frame_helper_noise.cpp.
|
protected |
Definition at line 120 of file api_frame_helper_noise.cpp.
|
protected |
Definition at line 130 of file api_frame_helper_noise.cpp.
|
overridevirtual |
Initialize the frame helper, returns OK if successful.
Implements esphome::api::APIFrameHelper.
Definition at line 101 of file api_frame_helper_noise.cpp.
|
protected |
Initiate the data structures for the handshake.
Definition at line 544 of file api_frame_helper_noise.cpp.
|
overridevirtual |
Run through handshake messages (if in that phase)
Reimplemented from esphome::api::APIFrameHelper.
Definition at line 140 of file api_frame_helper_noise.cpp.
|
overridevirtual |
Implements esphome::api::APIFrameHelper.
Definition at line 402 of file api_frame_helper_noise.cpp.
|
protected |
Definition at line 371 of file api_frame_helper_noise.cpp.
|
protected |
To be called from read/write methods.
This method runs through the internal handshake methods, if in that state.
If the handshake is still active when this method returns and a read/write can't take place at the moment, returns WOULD_BLOCK. If an error occurred, returns that error. Only returns OK if the transport is ready for data traffic.
Definition at line 245 of file api_frame_helper_noise.cpp.
|
protected |
Read a packet into the rx_buf_.
errno EWOULDBLOCK: Packet could not be read without blocking. Try again later. errno ENOMEM: Not enough memory for reading packet. errno API_ERROR_BAD_INDICATOR: Bad indicator byte at start of frame. errno API_ERROR_HANDSHAKE_PACKET_LEN: Packet too big for this phase.
Definition at line 169 of file api_frame_helper_noise.cpp.
|
protected |
Definition at line 522 of file api_frame_helper_noise.cpp.
|
overridevirtual |
Implements esphome::api::APIFrameHelper.
Definition at line 461 of file api_frame_helper_noise.cpp.
|
overridevirtual |
Implements esphome::api::APIFrameHelper.
Definition at line 453 of file api_frame_helper_noise.cpp.
|
protected |
Definition at line 44 of file api_frame_helper_noise.h.
|
protected |
Definition at line 39 of file api_frame_helper_noise.h.
|
protected |
Definition at line 50 of file api_frame_helper_noise.h.
|
protected |
Definition at line 47 of file api_frame_helper_noise.h.
|
protected |
Definition at line 41 of file api_frame_helper_noise.h.
|
protected |
Definition at line 56 of file api_frame_helper_noise.h.
|
protected |
Definition at line 57 of file api_frame_helper_noise.h.
|
protected |
Definition at line 40 of file api_frame_helper_noise.h.