#include <api_frame_helper.h>
Definition at line 78 of file api_frame_helper.h.
◆ State
Enumerator |
---|
INITIALIZE | |
CLIENT_HELLO | |
SERVER_HELLO | |
HANDSHAKE | |
DATA | |
CLOSED | |
FAILED | |
EXPLICIT_REJECT | |
Definition at line 128 of file api_frame_helper.h.
◆ APINoiseFrameHelper()
◆ ~APINoiseFrameHelper()
esphome::api::APINoiseFrameHelper::~APINoiseFrameHelper |
( |
| ) |
|
|
override |
◆ can_write_without_blocking()
bool esphome::api::APINoiseFrameHelper::can_write_without_blocking |
( |
| ) |
|
|
overridevirtual |
◆ check_handshake_finished_()
APIError esphome::api::APINoiseFrameHelper::check_handshake_finished_ |
( |
| ) |
|
|
protected |
◆ close()
APIError esphome::api::APINoiseFrameHelper::close |
( |
| ) |
|
|
overridevirtual |
◆ getpeername() [1/2]
std::string esphome::api::APINoiseFrameHelper::getpeername |
( |
| ) |
|
|
inlineoverridevirtual |
◆ getpeername() [2/2]
int esphome::api::APINoiseFrameHelper::getpeername |
( |
struct sockaddr * |
addr, |
|
|
socklen_t * |
addrlen |
|
) |
| |
|
inlineoverridevirtual |
◆ init()
APIError esphome::api::APINoiseFrameHelper::init |
( |
| ) |
|
|
overridevirtual |
◆ init_handshake_()
APIError esphome::api::APINoiseFrameHelper::init_handshake_ |
( |
| ) |
|
|
protected |
Initiate the data structures for the handshake.
- Returns
- 0 on success, -1 on error (check errno)
Definition at line 632 of file api_frame_helper.cpp.
◆ loop()
APIError esphome::api::APINoiseFrameHelper::loop |
( |
| ) |
|
|
overridevirtual |
◆ read_packet()
◆ send_explicit_handshake_reject_()
void esphome::api::APINoiseFrameHelper::send_explicit_handshake_reject_ |
( |
const std::string & |
reason | ) |
|
|
protected |
◆ set_log_info()
void esphome::api::APINoiseFrameHelper::set_log_info |
( |
std::string |
info | ) |
|
|
inlineoverridevirtual |
◆ shutdown()
APIError esphome::api::APINoiseFrameHelper::shutdown |
( |
int |
how | ) |
|
|
overridevirtual |
◆ state_action_()
APIError esphome::api::APINoiseFrameHelper::state_action_ |
( |
| ) |
|
|
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 276 of file api_frame_helper.cpp.
◆ try_read_frame_()
Read a packet into the rx_buf_.
If successful, stores frame data in the frame parameter
- Parameters
-
frame | The struct to hold the frame information in. msg_start: points to the start of the payload - this pointer is only valid until the next try_receive_raw_ call |
- Returns
- 0 if a full packet is in rx_buf_
-
-1 if error, check errno.
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 178 of file api_frame_helper.cpp.
◆ try_send_tx_buf_()
APIError esphome::api::APINoiseFrameHelper::try_send_tx_buf_ |
( |
| ) |
|
|
protected |
◆ write_frame_()
APIError esphome::api::APINoiseFrameHelper::write_frame_ |
( |
const uint8_t * |
data, |
|
|
size_t |
len |
|
) |
| |
|
protected |
◆ write_packet()
APIError esphome::api::APINoiseFrameHelper::write_packet |
( |
uint16_t |
type, |
|
|
const uint8_t * |
payload, |
|
|
size_t |
len |
|
) |
| |
|
overridevirtual |
◆ write_raw_()
APIError esphome::api::APINoiseFrameHelper::write_raw_ |
( |
const struct iovec * |
iov, |
|
|
int |
iovcnt |
|
) |
| |
|
protected |
Write the data to the socket, or buffer it a write would block.
- Parameters
-
data | The data to write |
len | The length of data |
Definition at line 550 of file api_frame_helper.cpp.
◆ ctx_
◆ handshake_
NoiseHandshakeState* esphome::api::APINoiseFrameHelper::handshake_ {nullptr} |
|
protected |
◆ info_
std::string esphome::api::APINoiseFrameHelper::info_ |
|
protected |
◆ nid_
NoiseProtocolId esphome::api::APINoiseFrameHelper::nid_ |
|
protected |
◆ prologue_
std::vector<uint8_t> esphome::api::APINoiseFrameHelper::prologue_ |
|
protected |
◆ recv_cipher_
NoiseCipherState* esphome::api::APINoiseFrameHelper::recv_cipher_ {nullptr} |
|
protected |
◆ rx_buf_
std::vector<uint8_t> esphome::api::APINoiseFrameHelper::rx_buf_ |
|
protected |
◆ rx_buf_len_
size_t esphome::api::APINoiseFrameHelper::rx_buf_len_ = 0 |
|
protected |
◆ rx_header_buf_
uint8_t esphome::api::APINoiseFrameHelper::rx_header_buf_[3] |
|
protected |
◆ rx_header_buf_len_
size_t esphome::api::APINoiseFrameHelper::rx_header_buf_len_ = 0 |
|
protected |
◆ send_cipher_
NoiseCipherState* esphome::api::APINoiseFrameHelper::send_cipher_ {nullptr} |
|
protected |
◆ socket_
std::unique_ptr<socket::Socket> esphome::api::APINoiseFrameHelper::socket_ |
|
protected |
◆ state_
◆ tx_buf_
std::vector<uint8_t> esphome::api::APINoiseFrameHelper::tx_buf_ |
|
protected |
The documentation for this class was generated from the following files: