ESP8266
Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
UdpContext Class Reference

Public Types

typedef std::function< void(void)> rxhandler_t
 

Public Member Functions

 UdpContext ()
 
 ~UdpContext ()
 
void ref ()
 
void unref ()
 
bool connect (ip_addr_t addr, uint16_t port)
 
bool listen (ip_addr_t addr, uint16_t port)
 
void disconnect ()
 
void setMulticastInterface (ip_addr_t addr)
 
void setMulticastTTL (int ttl)
 
void onRx (rxhandler_t handler)
 
size_t getSize () const
 
uint32_t getRemoteAddress ()
 
uint16_t getRemotePort ()
 
uint32_t getDestAddress ()
 
uint16_t getLocalPort ()
 
bool next ()
 
int read ()
 
size_t read (char *dst, size_t size)
 
char peek ()
 
void flush ()
 
size_t append (const char *data, size_t size)
 
void send (ip_addr_t *addr=0, uint16_t port=0)
 

Private Member Functions

void _reserve (size_t size)
 
void _consume (size_t size)
 
void _recv (udp_pcb *upcb, pbuf *pb, ip_addr_t *addr, u16_t port)
 

Static Private Member Functions

static void _s_recv (void *arg, udp_pcb *upcb, pbuf *p, ip_addr_t *addr, u16_t port)
 

Private Attributes

udp_pcb * _pcb
 
pbuf_rx_buf
 
bool _first_buf_taken
 
size_t _rx_buf_offset
 
int _refcnt
 
pbuf_tx_buf_head
 
pbuf_tx_buf_cur
 
size_t _tx_buf_offset
 
uint16_t _multicast_ttl
 
uint16_t _dest_port
 
ip_addr_t _dest_addr
 
rxhandler_t _on_rx
 

Member Typedef Documentation

typedef std::function<void(void)> UdpContext::rxhandler_t

Constructor & Destructor Documentation

UdpContext::UdpContext ( )
UdpContext::~UdpContext ( )

Member Function Documentation

void UdpContext::_consume ( size_t  size)
private
void UdpContext::_recv ( udp_pcb *  upcb,
pbuf pb,
ip_addr_t *  addr,
u16_t  port 
)
private
void UdpContext::_reserve ( size_t  size)
private
static void UdpContext::_s_recv ( void *  arg,
udp_pcb *  upcb,
pbuf p,
ip_addr_t *  addr,
u16_t  port 
)
staticprivate
size_t UdpContext::append ( const char *  data,
size_t  size 
)
bool UdpContext::connect ( ip_addr_t  addr,
uint16_t  port 
)
void UdpContext::disconnect ( )
void UdpContext::flush ( )
uint32_t UdpContext::getDestAddress ( )
uint16_t UdpContext::getLocalPort ( )
uint32_t UdpContext::getRemoteAddress ( )
uint16_t UdpContext::getRemotePort ( )
size_t UdpContext::getSize ( void  ) const
bool UdpContext::listen ( ip_addr_t  addr,
uint16_t  port 
)
bool UdpContext::next ( )
void UdpContext::onRx ( rxhandler_t  handler)
char UdpContext::peek ( )
int UdpContext::read ( )
size_t UdpContext::read ( char *  dst,
size_t  size 
)
void UdpContext::ref ( )
void UdpContext::send ( ip_addr_t *  addr = 0,
uint16_t  port = 0 
)
void UdpContext::setMulticastInterface ( ip_addr_t  addr)
void UdpContext::setMulticastTTL ( int  ttl)
void UdpContext::unref ( )

Member Data Documentation

ip_addr_t UdpContext::_dest_addr
private
uint16_t UdpContext::_dest_port
private
bool UdpContext::_first_buf_taken
private
uint16_t UdpContext::_multicast_ttl
private
rxhandler_t UdpContext::_on_rx
private
udp_pcb* UdpContext::_pcb
private
int UdpContext::_refcnt
private
pbuf* UdpContext::_rx_buf
private
size_t UdpContext::_rx_buf_offset
private
pbuf* UdpContext::_tx_buf_cur
private
pbuf* UdpContext::_tx_buf_head
private
size_t UdpContext::_tx_buf_offset
private