UniSet  2.7.0
UTCPCore.h
1 // -------------------------------------------------------------------------
2 #ifndef UTCPCore_H_
3 #define UTCPCore_H_
4 // -------------------------------------------------------------------------
5 #include <string>
6 #include <cstring> // for std::memcpy
7 #include "PassiveTimer.h" // ..for timeout_t
8 // -------------------------------------------------------------------------
9 namespace uniset
10 {
11 
12  namespace UTCPCore
13  {
14  bool setKeepAliveParams( int sock, timeout_t timeout_sec = 5, int conn_keepcnt = 1, int keepintvl = 2 ) noexcept;
15 
16  // -------------------------------------------
17  // author: https://gist.github.com/koblas/3364414
18  // ----------------------
19  // for use with ev::io..
20  // Buffer class - allow for output buffering such that it can be written out into async pieces
21  struct Buffer
22  {
23  Buffer( const unsigned char* bytes, size_t nbytes );
24  Buffer( const std::string& s );
25  virtual ~Buffer();
26 
27  unsigned char* dpos() const noexcept;
28 
29  size_t nbytes() const noexcept;
30 
31  unsigned char* data = { 0 };
32  size_t len;
33  size_t pos;
34  };
35  }
36  // -------------------------------------------------------------------------
37 } // end of uniset namespace
38 // -------------------------------------------------------------------------
39 #endif // UTCPCore_H_
40 // -------------------------------------------------------------------------
Definition: CallbackTimer.h:29
Definition: UTCPCore.h:21