4 #ifndef RUDIMENTS_FILEDESCRIPTOR_H 5 #define RUDIMENTS_FILEDESCRIPTOR_H 7 #include <rudiments/private/filedescriptorincludes.h> 10 class filedescriptorprivate;
36 int32_t getFileDescriptor()
const;
40 void setFileDescriptor(int32_t filedesc);
51 int32_t duplicate()
const;
59 bool duplicate(int32_t newfd)
const;
72 virtual bool supportsBlockingNonBlockingModes();
77 virtual bool useNonBlockingMode()
const;
82 virtual bool useBlockingMode()
const;
86 virtual bool isUsingNonBlockingMode()
const;
91 ssize_t write(uint16_t number)
const;
96 ssize_t write(uint32_t number)
const;
101 ssize_t write(uint64_t number)
const;
106 ssize_t write(int16_t number)
const;
111 ssize_t write(int32_t number)
const;
116 ssize_t write(int64_t number)
const;
121 ssize_t write(
float number)
const;
126 ssize_t write(
double number)
const;
131 ssize_t write(
unsigned char character)
const;
136 ssize_t write(
char character)
const;
141 ssize_t write(
bool value)
const;
146 ssize_t write(
const unsigned char *
string)
const;
151 ssize_t write(
const char *
string)
const;
158 ssize_t write(
const unsigned char *
string,
size_t size)
const;
165 ssize_t write(
const char *
string,
size_t size)
const;
170 ssize_t write(
const void *buffer,
size_t size)
const;
177 ssize_t write(uint16_t number, int32_t sec, int32_t usec)
const;
184 ssize_t write(uint32_t number, int32_t sec, int32_t usec)
const;
191 ssize_t write(uint64_t number, int32_t sec, int32_t usec)
const;
198 ssize_t write(int16_t number, int32_t sec, int32_t usec)
const;
205 ssize_t write(int32_t number, int32_t sec, int32_t usec)
const;
212 ssize_t write(int64_t number, int32_t sec, int32_t usec)
const;
219 ssize_t write(
float number, int32_t sec, int32_t usec)
const;
226 ssize_t write(
double number, int32_t sec, int32_t usec)
const;
233 ssize_t write(
unsigned char character,
234 int32_t sec, int32_t usec)
const;
241 ssize_t write(
char character, int32_t sec, int32_t usec)
const;
248 ssize_t write(
bool value, int32_t sec, int32_t usec)
const;
255 ssize_t write(
const unsigned char *
string,
256 int32_t sec, int32_t usec)
const;
263 ssize_t write(
const char *
string,
264 int32_t sec, int32_t usec)
const;
272 ssize_t write(
const unsigned char *
string,
size_t size,
273 int32_t sec, int32_t usec)
const;
281 ssize_t write(
const char *
string,
size_t size,
282 int32_t sec, int32_t usec)
const;
289 ssize_t write(
const void *buffer,
size_t size,
290 int32_t sec, int32_t usec)
const;
294 size_t printf(
const char *format, ...);
301 size_t printf(
const char *format, va_list *argp);
307 void safePrint(
unsigned char c);
313 void safePrint(
const unsigned char *str);
319 void safePrint(
const unsigned char *str, int32_t length);
325 void safePrint(
char c);
331 void safePrint(
const char *str);
337 void safePrint(
const char *str, int32_t length);
341 void printBits(
unsigned char value);
345 void printBits(uint16_t value);
349 void printBits(uint32_t value);
353 void printBits(uint64_t value);
357 void printBits(
char value);
361 void printBits(int16_t value);
365 void printBits(int32_t value);
369 void printBits(int64_t value);
373 void printBits(
const unsigned char *bits, uint64_t size);
379 ssize_t read(uint16_t *buffer);
385 ssize_t read(uint32_t *buffer);
391 ssize_t read(uint64_t *buffer);
396 ssize_t read(int16_t *buffer);
401 ssize_t read(int32_t *buffer);
406 ssize_t read(int64_t *buffer);
412 ssize_t read(
float *buffer);
418 ssize_t read(
double *buffer);
424 ssize_t read(
unsigned char *buffer);
429 ssize_t read(
char *buffer);
434 ssize_t read(
bool *buffer);
439 ssize_t read(
unsigned char *buffer,
size_t size);
444 ssize_t read(
char *buffer,
size_t size);
449 ssize_t read(
void *buf,
size_t size);
459 ssize_t read(
char **buffer,
const char *terminator);
472 ssize_t read(
char **buffer,
473 const char *terminator,
size_t maxbytes);
480 ssize_t read(uint16_t *buffer, int32_t sec, int32_t usec);
487 ssize_t read(uint32_t *buffer, int32_t sec, int32_t usec);
494 ssize_t read(uint64_t *buffer, int32_t sec, int32_t usec);
501 ssize_t read(int16_t *buffer, int32_t sec, int32_t usec);
508 ssize_t read(int32_t *buffer, int32_t sec, int32_t usec);
515 ssize_t read(int64_t *buffer, int32_t sec, int32_t usec);
522 ssize_t read(
float *buffer, int32_t sec, int32_t usec);
529 ssize_t read(
double *buffer, int32_t sec, int32_t usec);
536 ssize_t read(
unsigned char *buffer, int32_t sec, int32_t usec);
543 ssize_t read(
char *buffer, int32_t sec, int32_t usec);
550 ssize_t read(
bool *buffer, int32_t sec, int32_t usec);
557 ssize_t read(
unsigned char *buffer,
size_t size,
558 int32_t sec, int32_t usec);
565 ssize_t read(
char *buffer,
size_t size,
566 int32_t sec, int32_t usec);
573 ssize_t read(
void *buf,
size_t size,
574 int32_t sec, int32_t usec);
585 ssize_t read(
char **buffer,
const char *terminator,
586 int32_t sec, int32_t usec);
600 ssize_t read(
char **buffer,
601 const char *terminator,
size_t maxbytes,
602 int32_t sec, int32_t usec);
619 ssize_t read(
char **buffer,
620 const char *terminator,
size_t maxbytes,
621 char escapechar, int32_t sec, int32_t usec);
643 int32_t waitForNonBlockingRead(int32_t sec, int32_t usec)
666 int32_t waitForNonBlockingWrite(int32_t sec, int32_t usec)
674 void retryInterruptedReads();
681 void dontRetryInterruptedReads();
685 bool getRetryInterruptedReads()
const;
691 void retryInterruptedWrites();
698 void dontRetryInterruptedWrites();
702 bool getRetryInterruptedWrites()
const;
709 void retryInterruptedWaits();
716 void dontRetryInterruptedWaits();
720 bool getRetryInterruptedWaits()
const;
727 void retryInterruptedFcntl();
734 void dontRetryInterruptedFcntl();
738 bool getRetryInterruptedFcntl()
const;
745 void retryInterruptedIoctl();
752 void dontRetryInterruptedIoctl();
756 bool getRetryInterruptedIoctl()
const;
769 void allowShortReads();
776 void dontAllowShortReads();
789 void allowShortWrites();
796 void dontAllowShortWrites();
802 virtual bool passFileDescriptor(int32_t fd);
807 virtual bool receiveFileDescriptor(int32_t *fd);
813 virtual bool passSocket(int32_t sock);
818 virtual bool receiveSocket(int32_t *sock);
824 void translateByteOrder();
829 void dontTranslateByteOrder();
833 virtual int32_t fCntl(int32_t command,
long arg)
const;
837 virtual int32_t ioCtl(int32_t command,
void *arg)
const;
847 bool useNaglesAlgorithm();
853 bool dontUseNaglesAlgorithm();
858 bool setSocketWriteBufferSize(int32_t size);
864 bool getSocketWriteBufferSize(int32_t *size);
869 bool setSocketReadBufferSize(int32_t size);
875 bool getSocketReadBufferSize(int32_t *size);
892 const char *getType()
const;
900 char *getPeerAddress()
const;
924 bool setWriteBufferSize(ssize_t size)
const;
952 bool flushWriteBuffer(int32_t sec, int32_t usec)
const;
974 bool setReadBufferSize(ssize_t size)
const;
989 bool dontCloseOnExec();
997 bool getCloseOnExec();
1006 static uint16_t hostToNet(uint16_t value);
1010 static uint32_t hostToNet(uint32_t value);
1014 static uint64_t hostToNet(uint64_t value);
1018 static uint16_t netToHost(uint16_t value);
1022 static uint32_t netToHost(uint32_t value);
1026 static uint64_t netToHost(uint64_t value);
1030 static uint16_t hostToLittleEndian(uint16_t value);
1034 static uint32_t hostToLittleEndian(uint32_t value);
1038 static uint64_t hostToLittleEndian(uint64_t value);
1042 static uint16_t littleEndianToHost(uint16_t value);
1046 static uint32_t littleEndianToHost(uint32_t value);
1050 static uint64_t littleEndianToHost(uint64_t value);
1052 #include <rudiments/private/filedescriptor.h> Definition: character.h:11
Definition: listener.h:16
Definition: filedescriptor.h:14
Definition: security.h:16