Go to the documentation of this file.
38 #include <netinet/in.h>
86 UDPPort (std::map<std::string, std::string> options);
96 ssize_t
Read (
void *
const buffer,
size_t count);
98 ssize_t
ReadFull (
void *
const buffer,
size_t count);
100 ssize_t
ReadUntil (
void *
const buffer,
size_t count, uint8_t terminator);
107 ssize_t
SkipUntil (uint8_t terminator,
unsigned int count);
113 ssize_t
Write (
const void *
const buffer,
size_t count);
131 #if defined (FLEXIPORT_HAVE_GETADDRINFO)
132 struct sockaddr _destSockAddr;
134 struct sockaddr_in _destSockAddr;
136 #endif // !defined (WIN32)
141 unsigned int _destPort;
143 unsigned int _recvPort;
146 void CheckPort (
bool read);
148 bool ProcessOption (
const std::string &option,
const std::string &value);
152 void OpenReceiver ();
153 void CloseReceiver ();
154 typedef enum {TIMED_OUT, DATA_AVAILABLE, CAN_WRITE} WaitStatus;
155 WaitStatus WaitForDataOrTimeout ();
156 bool IsDataAvailable ();
157 WaitStatus WaitForWritableOrTimeout ();
158 void SetSocketBlockingFlag ();
165 #endif // __UDPPORT_H
void Flush()
Flush the port's input and output buffers, discarding all data.
void Open()
Open the port.
ssize_t ReadUntil(void *const buffer, size_t count, uint8_t terminator)
Read data until a specified termination byte is received.
void SetTimeout(Timeout timeout)
Set the timeout value in milliseconds.
void Close()
Close the port.
void Drain()
Drain the port's input and output buffers.
ssize_t ReadFull(void *const buffer, size_t count)
Read the requested quantity of data from the port.
ssize_t Write(const void *const buffer, size_t count)
Write data to the port.
void SetCanRead(bool canRead)
Set the read permissions of the port.
UDP implementation of the Port class.
void SetCanWrite(bool canWrite)
Set the write permissions of the port.
ssize_t BytesAvailable()
Get the number of bytes waiting to be read at the port. Returns immediatly.
ssize_t ReadStringUntil(std::string &buffer, char terminator)
Read a string until the specified termination character is received.
ssize_t BytesAvailableWait()
Get the number of bytes waiting after blocking for the timeout.
ssize_t SkipUntil(uint8_t terminator, unsigned int count)
Read and dump data until the specified termination character has been seen count times.
UDPPort(std::map< std::string, std::string > options)
ssize_t Read(void *const buffer, size_t count)
Read from the port.
bool IsOpen() const
Check if the port is open.
std::string GetStatus() const
Get the status of the port (type, device, etc).
An object used to represent timeouts.
ssize_t Skip(size_t count)
Dump data until the specified number of bytes have been read.