filedescriptor.h
// Copyright (c) 1999-2018 David Muse
// See the COPYING file for more information.
#ifndef RUDIMENTS_FILEDESCRIPTOR_H
#define RUDIMENTS_FILEDESCRIPTOR_H
#include <rudiments/private/filedescriptorincludes.h>
class listener;
class RUDIMENTS_DLLSPEC filedescriptor : public input, public output {
public:
filedescriptor();
filedescriptor(const filedescriptor &f);
filedescriptor &operator=(const filedescriptor &f);
virtual ~filedescriptor();
virtual bool close();
int32_t getFileDescriptor() const;
void setFileDescriptor(int32_t filedesc);
int32_t duplicate() const;
bool duplicate(int32_t newfd) const;
void setSecurityContext(securitycontext *ctx);
securitycontext *getSecurityContext();
virtual bool supportsBlockingNonBlockingModes();
virtual bool useNonBlockingMode() const;
virtual bool useBlockingMode() const;
virtual bool isUsingNonBlockingMode() const;
ssize_t write(uint16_t number);
ssize_t write(uint32_t number);
ssize_t write(uint64_t number);
ssize_t write(int16_t number);
ssize_t write(int32_t number);
ssize_t write(int64_t number);
ssize_t write(float number);
ssize_t write(double number);
ssize_t write(unsigned char character);
ssize_t write(char character);
ssize_t write(bool value);
ssize_t write(const unsigned char *string);
ssize_t write(const char *string);
ssize_t write(const unsigned char *string, size_t size);
ssize_t write(const char *string, size_t length);
ssize_t write(const void *buffer, size_t size);
ssize_t write(uint16_t number, int32_t sec, int32_t usec);
ssize_t write(uint32_t number, int32_t sec, int32_t usec);
ssize_t write(uint64_t number, int32_t sec, int32_t usec);
ssize_t write(int16_t number, int32_t sec, int32_t usec);
ssize_t write(int32_t number, int32_t sec, int32_t usec);
ssize_t write(int64_t number, int32_t sec, int32_t usec);
ssize_t write(float number, int32_t sec, int32_t usec);
ssize_t write(double number, int32_t sec, int32_t usec);
ssize_t write(unsigned char character,
int32_t sec, int32_t usec);
ssize_t write(char character, int32_t sec, int32_t usec);
ssize_t write(bool value, int32_t sec, int32_t usec);
ssize_t write(const unsigned char *string,
int32_t sec, int32_t usec);
ssize_t write(const char *string,
int32_t sec, int32_t usec);
ssize_t write(const unsigned char *string, size_t size,
int32_t sec, int32_t usec);
ssize_t write(const char *string, size_t size,
int32_t sec, int32_t usec);
ssize_t write(const void *buffer, size_t size,
int32_t sec, int32_t usec);
size_t printf(const char *format, ...);
size_t printf(const char *format, va_list *argp);
void safePrint(unsigned char c);
void safePrint(const unsigned char *str);
void safePrint(const unsigned char *str, int32_t length);
void safePrint(char c);
void safePrint(const char *str);
void safePrint(const char *str, int32_t length);
void printBits(unsigned char value);
void printBits(uint16_t value);
void printBits(uint32_t value);
void printBits(uint64_t value);
void printBits(char value);
void printBits(int16_t value);
void printBits(int32_t value);
void printBits(int64_t value);
void printBits(const unsigned char *bits, uint64_t size);
ssize_t read(uint16_t *buffer);
ssize_t read(uint32_t *buffer);
ssize_t read(uint64_t *buffer);
ssize_t read(int16_t *buffer);
ssize_t read(int32_t *buffer);
ssize_t read(int64_t *buffer);
ssize_t read(float *buffer);
ssize_t read(double *buffer);
ssize_t read(unsigned char *buffer);
ssize_t read(char *buffer);
ssize_t read(bool *buffer);
ssize_t read(unsigned char *buffer, size_t size);
ssize_t read(char *buffer, size_t length);
ssize_t read(void *buf, size_t size);
ssize_t read(char **buffer, const char *terminator);
ssize_t read(char **buffer,
const char *terminator, size_t maxbytes);
ssize_t read(uint16_t *buffer, int32_t sec, int32_t usec);
ssize_t read(uint32_t *buffer, int32_t sec, int32_t usec);
ssize_t read(uint64_t *buffer, int32_t sec, int32_t usec);
ssize_t read(int16_t *buffer, int32_t sec, int32_t usec);
ssize_t read(int32_t *buffer, int32_t sec, int32_t usec);
ssize_t read(int64_t *buffer, int32_t sec, int32_t usec);
ssize_t read(float *buffer, int32_t sec, int32_t usec);
ssize_t read(double *buffer, int32_t sec, int32_t usec);
ssize_t read(unsigned char *buffer, int32_t sec, int32_t usec);
ssize_t read(char *buffer, int32_t sec, int32_t usec);
ssize_t read(bool *buffer, int32_t sec, int32_t usec);
ssize_t read(unsigned char *buffer, size_t size,
int32_t sec, int32_t usec);
ssize_t read(char *buffer, size_t size,
int32_t sec, int32_t usec);
ssize_t read(void *buf, size_t size,
int32_t sec, int32_t usec);
ssize_t read(char **buffer, const char *terminator,
int32_t sec, int32_t usec);
ssize_t read(char **buffer,
const char *terminator, size_t maxbytes,
int32_t sec, int32_t usec);
ssize_t read(char **buffer,
const char *terminator, size_t maxbytes,
char escapechar, int32_t sec, int32_t usec);
int32_t waitForNonBlockingRead(int32_t sec, int32_t usec)
const;
int32_t waitForNonBlockingWrite(int32_t sec, int32_t usec)
const;
void retryInterruptedReads();
void dontRetryInterruptedReads();
bool getRetryInterruptedReads() const;
void retryInterruptedWrites();
void dontRetryInterruptedWrites();
bool getRetryInterruptedWrites() const;
void retryInterruptedWaits();
void dontRetryInterruptedWaits();
bool getRetryInterruptedWaits() const;
void retryInterruptedFcntl();
void dontRetryInterruptedFcntl();
bool getRetryInterruptedFcntl() const;
void retryInterruptedIoctl();
void dontRetryInterruptedIoctl();
bool getRetryInterruptedIoctl() const;
void allowShortReads();
void dontAllowShortReads();
void allowShortWrites();
void dontAllowShortWrites();
virtual bool passFileDescriptor(int32_t fd);
virtual bool receiveFileDescriptor(int32_t *fd);
virtual bool passSocket(int32_t sock);
virtual bool receiveSocket(int32_t *sock);
void translateByteOrder();
void dontTranslateByteOrder();
virtual int32_t fCntl(int32_t command, long arg) const;
virtual int32_t ioCtl(int32_t command, void *arg) const;
bool useNaglesAlgorithm();
bool dontUseNaglesAlgorithm();
bool setSocketWriteBufferSize(int32_t size);
bool getSocketWriteBufferSize(int32_t *size);
bool setSocketReadBufferSize(int32_t size);
bool getSocketReadBufferSize(int32_t *size);
bool disableIPv4();
bool enableIPv4();
const char *getType() const;
char *getPeerAddress() const;
bool setWriteBufferSize(ssize_t size) const;
bool flushWriteBuffer(int32_t sec, int32_t usec);
bool setReadBufferSize(ssize_t size) const;
bool closeOnExec();
bool dontCloseOnExec();
bool getCloseOnExec();
static bool createPipe(filedescriptor *readfd,
filedescriptor *writefd);
static uint16_t hostToNet(uint16_t value);
static uint32_t hostToNet(uint32_t value);
static uint64_t hostToNet(uint64_t value);
static uint16_t netToHost(uint16_t value);
static uint32_t netToHost(uint32_t value);
static uint64_t netToHost(uint64_t value);
static uint16_t hostToLittleEndian(uint16_t value);
static uint32_t hostToLittleEndian(uint32_t value);
static uint64_t hostToLittleEndian(uint64_t value);
static uint16_t littleEndianToHost(uint16_t value);
static uint32_t littleEndianToHost(uint32_t value);
static uint64_t littleEndianToHost(uint64_t value);
#include <rudiments/private/filedescriptor.h>
};
#endif
character
Definition: character.h:11
filedescriptor
Definition: filedescriptor.h:13
filedescriptor::fCntl
virtual int32_t fCntl(int32_t command, long arg) const
filedescriptor::hostToNet
static uint16_t hostToNet(uint16_t value)
filedescriptor::filedescriptor
filedescriptor()
filedescriptor::write
ssize_t write(char character)
filedescriptor::read
ssize_t read(unsigned char *buffer, size_t size, int32_t sec, int32_t usec)
filedescriptor::getRetryInterruptedReads
bool getRetryInterruptedReads() const
filedescriptor::write
ssize_t write(const unsigned char *string, int32_t sec, int32_t usec)
filedescriptor::netToHost
static uint32_t netToHost(uint32_t value)
filedescriptor::receiveSocket
virtual bool receiveSocket(int32_t *sock)
filedescriptor::read
ssize_t read(void *buf, size_t size, int32_t sec, int32_t usec)
filedescriptor::retryInterruptedIoctl
void retryInterruptedIoctl()
filedescriptor::write
ssize_t write(int64_t number)
filedescriptor::read
ssize_t read(int16_t *buffer)
filedescriptor::printBits
void printBits(unsigned char value)
filedescriptor::write
ssize_t write(uint16_t number)
filedescriptor::hostToLittleEndian
static uint16_t hostToLittleEndian(uint16_t value)
filedescriptor::littleEndianToHost
static uint16_t littleEndianToHost(uint16_t value)
filedescriptor::littleEndianToHost
static uint32_t littleEndianToHost(uint32_t value)
filedescriptor::read
ssize_t read(double *buffer)
filedescriptor::write
ssize_t write(const char *string)
filedescriptor::write
ssize_t write(uint16_t number, int32_t sec, int32_t usec)
filedescriptor::passFileDescriptor
virtual bool passFileDescriptor(int32_t fd)
filedescriptor::hostToNet
static uint64_t hostToNet(uint64_t value)
filedescriptor::ioCtl
virtual int32_t ioCtl(int32_t command, void *arg) const
filedescriptor::write
ssize_t write(uint64_t number, int32_t sec, int32_t usec)
filedescriptor::getRetryInterruptedWaits
bool getRetryInterruptedWaits() const
filedescriptor::printBits
void printBits(uint64_t value)
filedescriptor::write
ssize_t write(const unsigned char *string)
filedescriptor::getCloseOnExec
bool getCloseOnExec()
filedescriptor::write
ssize_t write(double number)
filedescriptor::write
ssize_t write(uint32_t number, int32_t sec, int32_t usec)
filedescriptor::read
ssize_t read(float *buffer, int32_t sec, int32_t usec)
filedescriptor::safePrint
void safePrint(unsigned char c)
filedescriptor::dontRetryInterruptedFcntl
void dontRetryInterruptedFcntl()
filedescriptor::operator=
filedescriptor & operator=(const filedescriptor &f)
filedescriptor::read
ssize_t read(char *buffer, int32_t sec, int32_t usec)
filedescriptor::waitForNonBlockingRead
int32_t waitForNonBlockingRead(int32_t sec, int32_t usec) const
filedescriptor::write
ssize_t write(int32_t number)
filedescriptor::read
ssize_t read(int16_t *buffer, int32_t sec, int32_t usec)
filedescriptor::write
ssize_t write(const unsigned char *string, size_t size, int32_t sec, int32_t usec)
filedescriptor::write
ssize_t write(uint32_t number)
filedescriptor::dontUseNaglesAlgorithm
bool dontUseNaglesAlgorithm()
filedescriptor::setReadBufferSize
bool setReadBufferSize(ssize_t size) const
filedescriptor::hostToLittleEndian
static uint32_t hostToLittleEndian(uint32_t value)
filedescriptor::useNonBlockingMode
virtual bool useNonBlockingMode() const
filedescriptor::dontAllowShortReads
void dontAllowShortReads()
filedescriptor::useBlockingMode
virtual bool useBlockingMode() const
filedescriptor::write
ssize_t write(unsigned char character)
filedescriptor::read
ssize_t read(unsigned char *buffer, int32_t sec, int32_t usec)
filedescriptor::setSecurityContext
void setSecurityContext(securitycontext *ctx)
filedescriptor::littleEndianToHost
static uint64_t littleEndianToHost(uint64_t value)
filedescriptor::read
ssize_t read(char **buffer, const char *terminator, int32_t sec, int32_t usec)
filedescriptor::translateByteOrder
void translateByteOrder()
filedescriptor::dontRetryInterruptedIoctl
void dontRetryInterruptedIoctl()
filedescriptor::read
ssize_t read(char **buffer, const char *terminator, size_t maxbytes)
filedescriptor::write
ssize_t write(const char *string, int32_t sec, int32_t usec)
filedescriptor::dontAllowShortWrites
void dontAllowShortWrites()
filedescriptor::dontTranslateByteOrder
void dontTranslateByteOrder()
filedescriptor::printBits
void printBits(char value)
filedescriptor::read
ssize_t read(char *buffer)
filedescriptor::write
ssize_t write(const unsigned char *string, size_t size)
filedescriptor::hostToLittleEndian
static uint64_t hostToLittleEndian(uint64_t value)
filedescriptor::setFileDescriptor
void setFileDescriptor(int32_t filedesc)
filedescriptor::read
ssize_t read(uint64_t *buffer)
filedescriptor::read
ssize_t read(int32_t *buffer)
filedescriptor::read
ssize_t read(char **buffer, const char *terminator, size_t maxbytes, char escapechar, int32_t sec, int32_t usec)
filedescriptor::read
ssize_t read(bool *buffer, int32_t sec, int32_t usec)
filedescriptor::close
virtual bool close()
filedescriptor::getRetryInterruptedWrites
bool getRetryInterruptedWrites() const
filedescriptor::printBits
void printBits(int16_t value)
filedescriptor::read
ssize_t read(uint32_t *buffer)
filedescriptor::netToHost
static uint16_t netToHost(uint16_t value)
filedescriptor::useNaglesAlgorithm
bool useNaglesAlgorithm()
filedescriptor::read
ssize_t read(int64_t *buffer, int32_t sec, int32_t usec)
filedescriptor::write
ssize_t write(const void *buffer, size_t size, int32_t sec, int32_t usec)
filedescriptor::setSocketWriteBufferSize
bool setSocketWriteBufferSize(int32_t size)
filedescriptor::safePrint
void safePrint(const unsigned char *str, int32_t length)
filedescriptor::read
ssize_t read(unsigned char *buffer, size_t size)
filedescriptor::dontCloseOnExec
bool dontCloseOnExec()
filedescriptor::getType
const char * getType() const
filedescriptor::write
ssize_t write(char character, int32_t sec, int32_t usec)
filedescriptor::read
ssize_t read(char *buffer, size_t length)
filedescriptor::dontRetryInterruptedReads
void dontRetryInterruptedReads()
filedescriptor::getPeerAddress
char * getPeerAddress() const
filedescriptor::write
ssize_t write(double number, int32_t sec, int32_t usec)
filedescriptor::allowShortReads
void allowShortReads()
filedescriptor::printBits
void printBits(int32_t value)
filedescriptor::setWriteBufferSize
bool setWriteBufferSize(ssize_t size) const
filedescriptor::retryInterruptedReads
void retryInterruptedReads()
filedescriptor::dontRetryInterruptedWaits
void dontRetryInterruptedWaits()
filedescriptor::read
ssize_t read(void *buf, size_t size)
filedescriptor::read
ssize_t read(char *buffer, size_t size, int32_t sec, int32_t usec)
filedescriptor::filedescriptor
filedescriptor(const filedescriptor &f)
filedescriptor::read
ssize_t read(float *buffer)
filedescriptor::read
ssize_t read(char **buffer, const char *terminator, size_t maxbytes, int32_t sec, int32_t usec)
filedescriptor::write
ssize_t write(bool value, int32_t sec, int32_t usec)
filedescriptor::write
ssize_t write(int32_t number, int32_t sec, int32_t usec)
filedescriptor::createPipe
static bool createPipe(filedescriptor *readfd, filedescriptor *writefd)
filedescriptor::printBits
void printBits(const unsigned char *bits, uint64_t size)
filedescriptor::duplicate
int32_t duplicate() const
filedescriptor::flushWriteBuffer
bool flushWriteBuffer(int32_t sec, int32_t usec)
filedescriptor::setSocketReadBufferSize
bool setSocketReadBufferSize(int32_t size)
filedescriptor::getRetryInterruptedIoctl
bool getRetryInterruptedIoctl() const
filedescriptor::getFileDescriptor
int32_t getFileDescriptor() const
filedescriptor::closeOnExec
bool closeOnExec()
filedescriptor::safePrint
void safePrint(const unsigned char *str)
filedescriptor::read
ssize_t read(uint64_t *buffer, int32_t sec, int32_t usec)
filedescriptor::read
ssize_t read(uint16_t *buffer)
filedescriptor::read
ssize_t read(int64_t *buffer)
filedescriptor::write
ssize_t write(int16_t number)
filedescriptor::getSocketReadBufferSize
bool getSocketReadBufferSize(int32_t *size)
filedescriptor::write
ssize_t write(float number)
filedescriptor::hostToNet
static uint32_t hostToNet(uint32_t value)
filedescriptor::read
ssize_t read(bool *buffer)
filedescriptor::write
ssize_t write(bool value)
filedescriptor::read
ssize_t read(unsigned char *buffer)
filedescriptor::passSocket
virtual bool passSocket(int32_t sock)
filedescriptor::enableIPv4
bool enableIPv4()
filedescriptor::supportsBlockingNonBlockingModes
virtual bool supportsBlockingNonBlockingModes()
filedescriptor::write
ssize_t write(int16_t number, int32_t sec, int32_t usec)
filedescriptor::printf
size_t printf(const char *format, va_list *argp)
filedescriptor::read
ssize_t read(int32_t *buffer, int32_t sec, int32_t usec)
filedescriptor::allowShortWrites
void allowShortWrites()
filedescriptor::netToHost
static uint64_t netToHost(uint64_t value)
filedescriptor::write
ssize_t write(const void *buffer, size_t size)
filedescriptor::write
ssize_t write(int64_t number, int32_t sec, int32_t usec)
filedescriptor::printBits
void printBits(uint32_t value)
filedescriptor::write
ssize_t write(uint64_t number)
filedescriptor::retryInterruptedWrites
void retryInterruptedWrites()
filedescriptor::dontRetryInterruptedWrites
void dontRetryInterruptedWrites()
filedescriptor::isUsingNonBlockingMode
virtual bool isUsingNonBlockingMode() const
filedescriptor::retryInterruptedFcntl
void retryInterruptedFcntl()
filedescriptor::getRetryInterruptedFcntl
bool getRetryInterruptedFcntl() const
filedescriptor::printBits
void printBits(uint16_t value)
filedescriptor::safePrint
void safePrint(char c)
filedescriptor::duplicate
bool duplicate(int32_t newfd) const
filedescriptor::waitForNonBlockingWrite
int32_t waitForNonBlockingWrite(int32_t sec, int32_t usec) const
filedescriptor::getSecurityContext
securitycontext * getSecurityContext()
filedescriptor::write
ssize_t write(unsigned char character, int32_t sec, int32_t usec)
filedescriptor::read
ssize_t read(char **buffer, const char *terminator)
filedescriptor::safePrint
void safePrint(const char *str)
filedescriptor::read
ssize_t read(double *buffer, int32_t sec, int32_t usec)
filedescriptor::printBits
void printBits(int64_t value)
filedescriptor::~filedescriptor
virtual ~filedescriptor()
filedescriptor::retryInterruptedWaits
void retryInterruptedWaits()
filedescriptor::write
ssize_t write(const char *string, size_t length)
filedescriptor::write
ssize_t write(const char *string, size_t size, int32_t sec, int32_t usec)
filedescriptor::printf
size_t printf(const char *format,...)
filedescriptor::read
ssize_t read(uint32_t *buffer, int32_t sec, int32_t usec)
filedescriptor::getSocketWriteBufferSize
bool getSocketWriteBufferSize(int32_t *size)
filedescriptor::disableIPv4
bool disableIPv4()
filedescriptor::receiveFileDescriptor
virtual bool receiveFileDescriptor(int32_t *fd)
filedescriptor::safePrint
void safePrint(const char *str, int32_t length)
filedescriptor::write
ssize_t write(float number, int32_t sec, int32_t usec)
filedescriptor::read
ssize_t read(uint16_t *buffer, int32_t sec, int32_t usec)
input
Definition: input.h:9
listener
Definition: listener.h:14
output
Definition: output.h:9
securitycontext
Definition: security.h:16