SNode.C
Loading...
Searching...
No Matches
web::websocket::client Namespace Reference

Classes

class  SocketContextUpgrade
 
class  SocketContextUpgradeFactory
 
class  SubProtocol
 
class  SubProtocolFactorySelector
 

Functions

int getentropy (void *buf, size_t buflen)
 
web::http::client::SocketContextUpgradeFactorywebsocketClientSocketContextUpgradeFactory ()
 

Function Documentation

◆ getentropy()

int web::websocket::client::getentropy ( void * buf,
size_t buflen )

Definition at line 70 of file SocketContextUpgradeFactory.cpp.

70 {
71#ifdef SYS_GETRANDOM
72 const ssize_t ret = syscall(SYS_getrandom, buf, buflen, 0);
73#else
74 // Fallback to /dev/urandom if necessary
75 const int fd = open("/dev/urandom", O_RDONLY);
76 if (fd == -1) {
77 return -1;
78 }
79 const ssize_t ret = read(fd, buf, buflen);
80 close(fd);
81#endif
82 return (ret == static_cast<ssize_t>(buflen)) ? 0 : -1;
83 }

◆ websocketClientSocketContextUpgradeFactory()

web::http::client::SocketContextUpgradeFactory * web::websocket::client::websocketClientSocketContextUpgradeFactory ( )