Rudiments
filedescriptor.h
1 // Copyright (c) 2002 David Muse
2 // See the COPYING file for more information.
3 
4  protected:
5 
6  void filedescriptorInit();
7  void filedescriptorClone(const filedescriptor &f);
8 
9  virtual ssize_t bufferedRead(void *buf, ssize_t count,
10  int32_t sec, int32_t usec) const;
11  virtual ssize_t bufferedWrite(const void *buf, ssize_t count,
12  int32_t sec, int32_t usec) const;
13  virtual ssize_t safeRead(void *buf, ssize_t count,
14  int32_t sec, int32_t usec) const;
15  virtual ssize_t safeWrite(const void *buf, ssize_t count,
16  int32_t sec, int32_t usec) const;
17  virtual int32_t safeSelect(int32_t sec, int32_t usec,
18  bool read, bool write) const;
19  virtual int32_t safePoll(int32_t sec, int32_t usec,
20  bool read, bool write) const;
21  bool setNoDelay(int32_t onoff);
22 
23  #ifdef RUDIMENTS_HAS_SSL
24  virtual void *newSSLBIO() const;
25  #endif
26 
27  int32_t getSockOpt(int32_t level, int32_t optname,
28  void *optval, socklen_t *optlen);
29  int32_t setSockOpt(int32_t level, int32_t optname,
30  const void *optval, socklen_t optlen);
31 
32  virtual ssize_t lowLevelRead(void *buf,
33  ssize_t count) const;
34  virtual ssize_t lowLevelWrite(const void *buf,
35  ssize_t count) const;
36  virtual int32_t lowLevelClose();
37 
38  const char *type() const;
39  void type(const char *tp);
40 
41  int32_t fd() const;
42  void fd(int32_t filedes);
43 
44  #ifdef RUDIMENTS_HAS_SSL
45  void *ctx();
46  void *ssl();
47  int32_t sslresult();
48  void sslresult(int32_t sslrslt);
49  #endif
50 
51  private:
52  filedescriptorprivate *pvt;
53 
54  public:
55  filedescriptor(int32_t fd);