|
Wrath of Zeus
Made by Torchlight Games for CSE 125 SP24
|
#include <session.hpp>
Public Member Functions | |
| Session (tcp::socket socket, SessionInfo info) | |
| ~Session () | |
| bool | isOkay () const |
| std::vector< Event > | handleAllReceivedPackets () |
| bool | connectTo (basic_resolver_results< class boost::asio::ip::tcp > endpoints) |
| void | sendPacket (std::shared_ptr< PackagedPacket > packet) |
| void | sendEvent (Event evt) |
| const SessionInfo & | getInfo () const |
| void | setDM (bool is_dm) |
A class which wraps around the concept of a Client <-> Server relationship. This works from both the client perpsective and the Server perspective. It essentially provides a wrapper around a tcp::socket and lets us easily send and receive our packet types.
| Session::Session | ( | tcp::socket | socket, |
| SessionInfo | info | ||
| ) |
Constructs a new session, with the specified info
| socket | The boost asio socket which is already open and contains the connection. |
| info | Session Information |
| Session::~Session | ( | ) |
| bool Session::connectTo | ( | basic_resolver_results< class boost::asio::ip::tcp > | endpoints | ) |
Connects to the ip
| const SessionInfo & Session::getInfo | ( | ) | const |
Get the information associated with this session.
| std::vector< Event > Session::handleAllReceivedPackets | ( | ) |
handles all of the incoming packets and puts the events in the event queue, which you can get by calling getEvents
| bool Session::isOkay | ( | ) | const |
Sends an event on the socket after packaging it into the packet format.
| evt | The event object to send |
| void Session::sendPacket | ( | std::shared_ptr< PackagedPacket > | packet | ) |
Puts a packet in the queue of packets to send
| packet | The packet to send. |
| void Session::setDM | ( | bool | is_dm | ) |