|
UniSet
2.6.0
|
00001 // ------------------------------------------------------------------------- 00002 #ifndef UTCPCore_H_ 00003 #define UTCPCore_H_ 00004 // ------------------------------------------------------------------------- 00005 #include <string> 00006 #include <cstring> // for std::memcpy 00007 #include "PassiveTimer.h" // ..for timeout_t 00008 // ------------------------------------------------------------------------- 00009 namespace uniset 00010 { 00011 00012 namespace UTCPCore 00013 { 00014 bool setKeepAliveParams( int sock, timeout_t timeout_sec = 5, int conn_keepcnt = 1, int keepintvl = 2 ) noexcept; 00015 00016 // ------------------------------------------- 00017 // author: https://gist.github.com/koblas/3364414 00018 // ---------------------- 00019 // for use with ev::io.. 00020 // Buffer class - allow for output buffering such that it can be written out into async pieces 00021 struct Buffer 00022 { 00023 Buffer( const unsigned char* bytes, ssize_t nbytes ); 00024 Buffer( const std::string& s ); 00025 virtual ~Buffer(); 00026 00027 unsigned char* dpos() noexcept; 00028 00029 ssize_t nbytes() noexcept; 00030 00031 unsigned char* data = { 0 }; 00032 ssize_t len; 00033 ssize_t pos; 00034 }; 00035 } 00036 // ------------------------------------------------------------------------- 00037 } // end of uniset namespace 00038 // ------------------------------------------------------------------------- 00039 #endif // UTCPCore_H_ 00040 // -------------------------------------------------------------------------
1.7.6.1