UniSet 2.32.1
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// -------------------------------------------------------------------------
9namespace 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(){}
24 Buffer( const unsigned char* bytes, size_t nbytes );
25 Buffer( const std::string& s );
26 virtual ~Buffer();
27
28 void reset( const std::string& s );
29 void reset( const unsigned char* bytes, size_t nbytes );
30
31 unsigned char* dpos() const noexcept;
32
33 size_t nbytes() const noexcept;
34
35 unsigned char* data = { nullptr };
36 size_t len = { 0 };
37 size_t pos = { 0 };
38 };
39 }
40 // -------------------------------------------------------------------------
41} // end of uniset namespace
42// -------------------------------------------------------------------------
43#endif // UTCPCore_H_
44// -------------------------------------------------------------------------
Definition Calibration.h:27
Definition UTCPCore.h:22