ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

Client class represents one client's HTTP request to the LocalWebserver. More...

#include <client.h>

Collaboration diagram for Networking::Client:

List of all members.

Public Member Functions

 Client ()
 Client (SDLNet_SocketSet set, TCPsocket socket)
virtual ~Client ()
void open (SDLNet_SocketSet set, TCPsocket socket)
void readHeaders ()
bool readContent (Common::WriteStream *stream)
bool readBlockHeaders (Common::WriteStream *stream)
bool readBlockContent (Common::WriteStream *stream)
void setHandler (ClientHandler *handler)
void handle ()
void close ()
ClientState state () const
Common::String headers () const
Common::String method () const
Common::String path () const
Common::String query () const
Common::String queryParameter (Common::String name) const
Common::String anchor () const
bool noMoreContent () const
bool socketIsReady ()
 Return SDLNet_SocketReady(_socket).
int recv (void *data, int maxlen)
int send (void *data, int len)

Private Member Functions

bool readMoreIfNeeded ()

Private Attributes

ClientState _state
SDLNet_SocketSet _set
TCPsocket _socket
Reader _reader

Detailed Description

Client class represents one client's HTTP request to the LocalWebserver.

While in READING_HEADERS state, it's kept in LocalWebserver. Client must read the headers and decide whether it's READ_HEADERS (could be handled) or BAD_REQUEST (failed).

If it's READ_HEADERS, LocalWebserver searches for a corresponding BaseHandler. These classes use the information from headers - like method, path, GET parameters - to build the response for this client's request. When they do, they call setHandler() and pass a special ClientHandler. Client becomes BEING_HANDLED.

While in that state, LocalWebserver calls Client's handle() and it's passed to ClientHandler. The latter does the job: it commands Client to read or write bytes with its socket or calls readContent() methods, so Client reads the request through Reader.

Definition at line 76 of file client.h.

Constructor & Destructor Documentation

Networking::Client::Client (  ) 

Definition at line 32 of file client.cpp.

Networking::Client::Client ( SDLNet_SocketSet  set,
TCPsocket  socket 

Definition at line 36 of file client.cpp.

Networking::Client::~Client (  )  [virtual]

Definition at line 42 of file client.cpp.

Member Function Documentation

Common::String Networking::Client::anchor (  )  const

Definition at line 180 of file client.cpp.

void Networking::Client::close (  ) 

Definition at line 144 of file client.cpp.

void Networking::Client::handle (  ) 

Definition at line 135 of file client.cpp.

Common::String Networking::Client::headers (  )  const

Definition at line 170 of file client.cpp.

Common::String Networking::Client::method (  )  const

Definition at line 172 of file client.cpp.

bool Networking::Client::noMoreContent (  )  const

Definition at line 182 of file client.cpp.

void Networking::Client::open ( SDLNet_SocketSet  set,
TCPsocket  socket 

Definition at line 47 of file client.cpp.

Common::String Networking::Client::path (  )  const

Definition at line 174 of file client.cpp.

Common::String Networking::Client::query (  )  const

Definition at line 176 of file client.cpp.

Common::String Networking::Client::queryParameter ( Common::String  name  )  const

Definition at line 178 of file client.cpp.

bool Networking::Client::readBlockContent ( Common::WriteStream stream  ) 

Definition at line 118 of file client.cpp.

bool Networking::Client::readBlockHeaders ( Common::WriteStream stream  ) 

Definition at line 111 of file client.cpp.

bool Networking::Client::readContent ( Common::WriteStream stream  ) 

Definition at line 104 of file client.cpp.

void Networking::Client::readHeaders (  ) 

Definition at line 96 of file client.cpp.

bool Networking::Client::readMoreIfNeeded (  )  [private]

Definition at line 70 of file client.cpp.

int Networking::Client::recv ( void *  data,
int  maxlen 

Definition at line 186 of file client.cpp.

int Networking::Client::send ( void *  data,
int  len 

Definition at line 188 of file client.cpp.

void Networking::Client::setHandler ( ClientHandler handler  ) 

Definition at line 125 of file client.cpp.

bool Networking::Client::socketIsReady (  ) 

Return SDLNet_SocketReady(_socket).

It's "ready" when it has something to read (recv()). You can send() when this is false.

Definition at line 184 of file client.cpp.

ClientState Networking::Client::state (  )  const

Definition at line 168 of file client.cpp.

Member Data Documentation

Definition at line 83 of file client.h.

Definition at line 81 of file client.h.

Definition at line 81 of file client.h.

Definition at line 80 of file client.h.

Definition at line 78 of file client.h.

Definition at line 79 of file client.h.

Definition at line 77 of file client.h.

Definition at line 82 of file client.h.

The documentation for this class was generated from the following files:

Generated on Sat Aug 8 2020 05:03:47 for ResidualVM by doxygen 1.7.1
curved edge   curved edge