ESPHome 2026.3.0-dev
Loading...
Searching...
No Matches
esphome::socket::LWIPRawCommon Class Reference

Non-virtual common base for LWIP raw TCP sockets. More...

#include <lwip_raw_tcp_impl.h>

Inheritance diagram for esphome::socket::LWIPRawCommon:
esphome::socket::LWIPRawImpl esphome::socket::LWIPRawListenImpl

Public Member Functions

 LWIPRawCommon (sa_family_t family, struct tcp_pcb *pcb)
 
 ~LWIPRawCommon ()
 
 LWIPRawCommon (const LWIPRawCommon &)=delete
 
LWIPRawCommonoperator= (const LWIPRawCommon &)=delete
 
int bind (const struct sockaddr *name, socklen_t addrlen)
 
int close ()
 
int shutdown (int how)
 
int getpeername (struct sockaddr *name, socklen_t *addrlen)
 
int getsockname (struct sockaddr *name, socklen_t *addrlen)
 
size_t getpeername_to (std::span< char, SOCKADDR_STR_LEN > buf)
 Format peer address into a fixed-size buffer (no heap allocation)
 
size_t getsockname_to (std::span< char, SOCKADDR_STR_LEN > buf)
 Format local address into a fixed-size buffer (no heap allocation)
 
int getsockopt (int level, int optname, void *optval, socklen_t *optlen)
 
int setsockopt (int level, int optname, const void *optval, socklen_t optlen)
 
int get_fd () const
 

Protected Member Functions

int ip2sockaddr_ (ip_addr_t *ip, uint16_t port, struct sockaddr *name, socklen_t *addrlen)
 

Protected Attributes

struct tcp_pcb * pcb_
 
bool nodelay_ = false
 
sa_family_t family_ = 0
 

Detailed Description

Non-virtual common base for LWIP raw TCP sockets.

Provides shared fields and methods for both connected and listening sockets. No virtual methods — pure code sharing.

Definition at line 27 of file lwip_raw_tcp_impl.h.

Constructor & Destructor Documentation

◆ LWIPRawCommon() [1/2]

esphome::socket::LWIPRawCommon::LWIPRawCommon ( sa_family_t family,
struct tcp_pcb * pcb )
inline

Definition at line 29 of file lwip_raw_tcp_impl.h.

◆ ~LWIPRawCommon()

esphome::socket::LWIPRawCommon::~LWIPRawCommon ( )

Definition at line 56 of file lwip_raw_tcp_impl.cpp.

◆ LWIPRawCommon() [2/2]

esphome::socket::LWIPRawCommon::LWIPRawCommon ( const LWIPRawCommon & )
delete

Member Function Documentation

◆ bind()

int esphome::socket::LWIPRawCommon::bind ( const struct sockaddr * name,
socklen_t addrlen )

Definition at line 64 of file lwip_raw_tcp_impl.cpp.

◆ close()

int esphome::socket::LWIPRawCommon::close ( )

Definition at line 129 of file lwip_raw_tcp_impl.cpp.

◆ get_fd()

int esphome::socket::LWIPRawCommon::get_fd ( ) const
inline

Definition at line 49 of file lwip_raw_tcp_impl.h.

◆ getpeername()

int esphome::socket::LWIPRawCommon::getpeername ( struct sockaddr * name,
socklen_t * addrlen )

Definition at line 173 of file lwip_raw_tcp_impl.cpp.

◆ getpeername_to()

size_t esphome::socket::LWIPRawCommon::getpeername_to ( std::span< char, SOCKADDR_STR_LEN > buf)

Format peer address into a fixed-size buffer (no heap allocation)

Definition at line 197 of file lwip_raw_tcp_impl.cpp.

◆ getsockname()

int esphome::socket::LWIPRawCommon::getsockname ( struct sockaddr * name,
socklen_t * addrlen )

Definition at line 185 of file lwip_raw_tcp_impl.cpp.

◆ getsockname_to()

size_t esphome::socket::LWIPRawCommon::getsockname_to ( std::span< char, SOCKADDR_STR_LEN > buf)

Format local address into a fixed-size buffer (no heap allocation)

Definition at line 207 of file lwip_raw_tcp_impl.cpp.

◆ getsockopt()

int esphome::socket::LWIPRawCommon::getsockopt ( int level,
int optname,
void * optval,
socklen_t * optlen )

Definition at line 217 of file lwip_raw_tcp_impl.cpp.

◆ ip2sockaddr_()

int esphome::socket::LWIPRawCommon::ip2sockaddr_ ( ip_addr_t * ip,
uint16_t port,
struct sockaddr * name,
socklen_t * addrlen )
protected

Definition at line 279 of file lwip_raw_tcp_impl.cpp.

◆ operator=()

LWIPRawCommon & esphome::socket::LWIPRawCommon::operator= ( const LWIPRawCommon & )
delete

◆ setsockopt()

int esphome::socket::LWIPRawCommon::setsockopt ( int level,
int optname,
const void * optval,
socklen_t optlen )

Definition at line 251 of file lwip_raw_tcp_impl.cpp.

◆ shutdown()

int esphome::socket::LWIPRawCommon::shutdown ( int how)

Definition at line 147 of file lwip_raw_tcp_impl.cpp.

Field Documentation

◆ family_

sa_family_t esphome::socket::LWIPRawCommon::family_ = 0
protected

Definition at line 59 of file lwip_raw_tcp_impl.h.

◆ nodelay_

bool esphome::socket::LWIPRawCommon::nodelay_ = false
protected

Definition at line 58 of file lwip_raw_tcp_impl.h.

◆ pcb_

struct tcp_pcb* esphome::socket::LWIPRawCommon::pcb_
protected

Definition at line 55 of file lwip_raw_tcp_impl.h.


The documentation for this class was generated from the following files: