26 #include <sys/socket.h> 36 #if defined(__APPLE__) 37 #if !defined(MSG_NOSIGNAL) 38 #define MSG_NOSIGNAL SO_NOSIGPIPE 46 int const c_pathMaxSize =
sizeof(sockaddr_un::sun_path)/
sizeof(sockaddr_un::sun_path[0]);
55 return getenv(
"HOME") + string(
"/Library/Ethereum");
63 UnixDomainSocketServer::UnixDomainSocketServer(
string const& _appId):
77 if (access(
m_path.c_str(), F_OK) != -1)
80 if (access(
m_path.c_str(), F_OK) != -1)
83 m_socket = socket(PF_UNIX, SOCK_STREAM, 0);
84 memset(&(
m_address), 0,
sizeof(sockaddr_un));
111 socklen_t addressLen =
sizeof(
m_address);
134 int r = send(_connection, _data.data(), _data.size(),
MSG_NOSIGNAL);
142 int r = read(_connection, _data, _size);
bool(* handler)(HTTPRequest *req, const std::string &strReq)
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
std::string getDefaultDataDir(std::string _prefix="ethereum")
bool StopListening() override
bool StartListening() override
void CloseConnection(int _socket) override
std::hash for asio::adress
#define DEV_GUARDED(MUTEX)
Simple block guard.
void GenerateResponse(int_connection)
~UnixDomainSocketServer()
virtual bool StopListening()
size_t Write(int _connection, std::string const &_data) override
virtual bool StartListening()
size_t Read(int _connection, void *_data, size_t _size) override
std::unordered_set< int > m_sockets