TinyPPP
PPP networking over any Arduino Stream
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PPPUDP Class Reference

UDP socket over PPP: used like WiFiUDP or EthernetUDP. More...

#include <PPPSockets.h>

Inheritance diagram for PPPUDP:

Public Member Functions

 PPPUDP ()=default
 UDP on the default stack (the first TinyPPP instance)
 
 PPPUDP (const PPPUDP &)=delete
 
 PPPUDP (IPStack &stack)
 UDP on the indicated stack.
 
 ~PPPUDP ()
 
int available () override
 Unread bytes of the current datagram.
 
uint8_t begin (uint16_t port) override
 Opens the socket on the port (0: any port): returns 1 on success.
 
int beginPacket (const char *host, uint16_t port) override
 Starts a datagram to the host (resolved via DNS) and port.
 
int beginPacket (IPAddress ip, uint16_t port) override
 Starts a datagram to the address and port.
 
int endPacket () override
 Sends the datagram: returns 1 on success.
 
void flush () override
 Discards the rest of the current datagram.
 
uint16_t localPort ()
 Our port.
 
PPPUDP & operator= (const PPPUDP &)=delete
 
int parsePacket () override
 Moves to the next received datagram: returns its size (0 if none)
 
int peek () override
 Next byte of the current datagram without removing it (-1 if none)
 
int read () override
 Reads one byte of the current datagram (-1 if none)
 
int read (char *buf, size_t len) override
 Reads from the current datagram: returns the number read or -1.
 
int read (unsigned char *buf, size_t len) override
 Reads from the current datagram: returns the number read or -1.
 
IPAddress remoteIP () override
 Sender address of the current datagram.
 
uint16_t remotePort () override
 Sender port of the current datagram.
 
void stop () override
 Closes the socket.
 
size_t write (const uint8_t *buf, size_t size) override
 Adds data to the datagram (max TINYPPP_UDP_TX_BUFFER bytes)
 
size_t write (uint8_t b) override
 Adds one byte to the datagram.
 

Protected Member Functions

IPStack * stack () const
 

Protected Attributes

IPAddress _rxIP
 
uint16_t _rxPort = 0
 
int _sock = -1
 
IPStack * _stack = nullptr
 
uint8_t _tx [576]
 
IPAddress _txIP
 
size_t _txLen = 0
 
bool _txOverflow = false
 
uint16_t _txPort = 0
 

Detailed Description

UDP socket over PPP: used like WiFiUDP or EthernetUDP.

Constructor & Destructor Documentation

◆ PPPUDP() [1/3]

PPPUDP ( )
default

UDP on the default stack (the first TinyPPP instance)

◆ PPPUDP() [2/3]

PPPUDP ( IPStack &  stack)
inlineexplicit

UDP on the indicated stack.

◆ ~PPPUDP()

~PPPUDP ( )
inline

◆ PPPUDP() [3/3]

PPPUDP ( const PPPUDP &  )
delete

Member Function Documentation

◆ available()

int available ( )
inlineoverride

Unread bytes of the current datagram.

◆ begin()

uint8_t begin ( uint16_t  port)
inlineoverride

Opens the socket on the port (0: any port): returns 1 on success.

◆ beginPacket() [1/2]

int beginPacket ( const char *  host,
uint16_t  port 
)
inlineoverride

Starts a datagram to the host (resolved via DNS) and port.

◆ beginPacket() [2/2]

int beginPacket ( IPAddress  ip,
uint16_t  port 
)
inlineoverride

Starts a datagram to the address and port.

◆ endPacket()

int endPacket ( )
inlineoverride

Sends the datagram: returns 1 on success.

◆ flush()

void flush ( )
inlineoverride

Discards the rest of the current datagram.

◆ localPort()

uint16_t localPort ( )
inline

Our port.

◆ operator=()

PPPUDP & operator= ( const PPPUDP &  )
delete

◆ parsePacket()

int parsePacket ( )
inlineoverride

Moves to the next received datagram: returns its size (0 if none)

◆ peek()

int peek ( )
inlineoverride

Next byte of the current datagram without removing it (-1 if none)

◆ read() [1/3]

int read ( )
inlineoverride

Reads one byte of the current datagram (-1 if none)

◆ read() [2/3]

int read ( char *  buf,
size_t  len 
)
inlineoverride

Reads from the current datagram: returns the number read or -1.

◆ read() [3/3]

int read ( unsigned char *  buf,
size_t  len 
)
inlineoverride

Reads from the current datagram: returns the number read or -1.

◆ remoteIP()

IPAddress remoteIP ( )
inlineoverride

Sender address of the current datagram.

◆ remotePort()

uint16_t remotePort ( )
inlineoverride

Sender port of the current datagram.

◆ stack()

IPStack * stack ( ) const
inlineprotected

◆ stop()

void stop ( )
inlineoverride

Closes the socket.

◆ write() [1/2]

size_t write ( const uint8_t *  buf,
size_t  size 
)
inlineoverride

Adds data to the datagram (max TINYPPP_UDP_TX_BUFFER bytes)

◆ write() [2/2]

size_t write ( uint8_t  b)
inlineoverride

Adds one byte to the datagram.

Member Data Documentation

◆ _rxIP

IPAddress _rxIP
protected

◆ _rxPort

uint16_t _rxPort = 0
protected

◆ _sock

int _sock = -1
protected

◆ _stack

IPStack* _stack = nullptr
protected

◆ _tx

uint8_t _tx[576]
protected

◆ _txIP

IPAddress _txIP
protected

◆ _txLen

size_t _txLen = 0
protected

◆ _txOverflow

bool _txOverflow = false
protected

◆ _txPort

uint16_t _txPort = 0
protected

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