Rudiments
Public Member Functions | List of all members
websocket Class Reference

Inherits securitycontext.

Public Member Functions

 websocket ()
 
virtual ~websocket ()
 
void setFileDescriptor (filedescriptor *fd)
 
filedescriptorgetFileDescriptor ()
 
bool connect ()
 
bool accept ()
 
ssize_t read (void *buf, ssize_t size)
 
ssize_t write (const void *buf, ssize_t size)
 
bool ping (const unsigned char *buf, ssize_t size)
 
ssize_t pending ()
 
bool close ()
 
ssize_t getSizeMax ()
 

Constructor & Destructor Documentation

◆ websocket()

websocket::websocket ( )

Creates a new instance of the websocket class.

◆ ~websocket()

virtual websocket::~websocket ( )
virtual

Deletes this instance of the websocket class.

Member Function Documentation

◆ accept()

bool websocket::accept ( )
virtual

Accepts a security context from the client with whom a connection is already established across the filedescriptor previously set using setFileDescriptor().

Note that if this instance is set as the current GSS context of a child of the socketserver class, then this method is called implicitly during a successful call to accept().

Returns true on success and false on failure.

Implements securitycontext.

◆ close()

bool websocket::close ( )
virtual

Releases any security context established during the previous call to connect() or accept().

Implements securitycontext.

◆ connect()

bool websocket::connect ( )
virtual

Initiates a security context with the server with whom a connection is already established across the filedescriptor previously set using setFileDescriptor().

Note that if this instance is set as the current security context of a child of the socketclient class, then this method is called implicitly during a successful call to connect().

Returns true on success and false on failure.

Implements securitycontext.

◆ getFileDescriptor()

filedescriptor* websocket::getFileDescriptor ( )
virtual

Returns the file descrptor that will be used to communicate with the peer during the next call to connect() or accept().

Implements securitycontext.

◆ getSizeMax()

ssize_t websocket::getSizeMax ( )
virtual

Returns the maximum number of bytes that can be written or read in a single call to write() or read().

Implements securitycontext.

◆ pending()

ssize_t websocket::pending ( )
virtual

Returns the number of bytes that are buffered and available for immediate read.

Implements securitycontext.

◆ ping()

bool websocket::ping ( const unsigned char *  buf,
ssize_t  size 
)

Pings the peer with "size" bytes of "buf" data. Returns true if the peer responds with the same data or false if the peer doesn't respond or responds with different data.

◆ read()

ssize_t websocket::read ( void *  buf,
ssize_t  size 
)
virtual

Reads from the file descriptor previously configured by setFileDescriptor() into "buf" until "size" bytes have been read. Returns the number of bytes that were written to "buf" or RESULT_ERROR if an error occurred.

Implements securitycontext.

◆ setFileDescriptor()

void websocket::setFileDescriptor ( filedescriptor fd)
virtual

Sets the file descriptor that will be used to communicate with the peer during the next call to connect() or accept().

Implements securitycontext.

◆ write()

ssize_t websocket::write ( const void *  buf,
ssize_t  size 
)
virtual

Writes "size" bytes from "buf" to the file descriptor previously configured by setFileDescriptor(). Returns the number of bytes that were written or RESULT_ERROR if an error occurred.

Implements securitycontext.