|
Babel
Epitech's C++ VoIP project
|
Main server class contains almost all the logic for the server. More...
#include <BabelServer.hpp>
Classes | |
| struct | RequestHandler |
| Utils struct to store requests information. More... | |
Public Member Functions | |
| void | onMessage (std::shared_ptr< ITCPConnection< RFCCodes >> client, Message< RFCCodes > &msg) override |
| Called when we received a message from a client. More... | |
| bool | onClientConnect (std::shared_ptr< ITCPConnection< RFCCodes >> client) override |
| Called when a client connect. More... | |
| void | onClientDisconnect (std::shared_ptr< ITCPConnection< RFCCodes >> client) override |
| Called when a client disconnect. More... | |
| Message< RFCCodes > | login (std::shared_ptr< ITCPConnection< RFCCodes >> connection, Message< RFCCodes > message) |
| The function to call to manage a login request. More... | |
| Message< RFCCodes > | listUsers (std::shared_ptr< ITCPConnection< RFCCodes >> connection, Message< RFCCodes > message) |
| The function to call to manage a listUser request. More... | |
| Message< RFCCodes > | callUser (std::shared_ptr< ITCPConnection< RFCCodes >> connection, Message< RFCCodes > message) |
| The function to call to manage a callUser request. More... | |
| Message< RFCCodes > | joinCall (std::shared_ptr< ITCPConnection< RFCCodes >> connection, Message< RFCCodes > message) |
| The function to call to manage a joinCall request. More... | |
| Message< RFCCodes > | denyCall (std::shared_ptr< ITCPConnection< RFCCodes >> connection, Message< RFCCodes > message) |
| The function to call to manage a denyCall request. More... | |
| Message< RFCCodes > | hangUpCall (std::shared_ptr< ITCPConnection< RFCCodes >> connection, Message< RFCCodes > message) |
| The function to call to manage a hangUp request. More... | |
Public Member Functions inherited from Babel::AsioTCPServer< RFCCodes > | |
| bool | start (uint16_t port) override |
| Starts the server on indicated port. More... | |
| void | stop () override |
| Stop the server. More... | |
| void | messageClient (std::shared_ptr< ITCPConnection< RFCCodes >> client, const Message< RFCCodes > &msg) override |
| Send a message to the specified client. More... | |
| void | messageAllClients (const Message< RFCCodes > &msg) override |
| Send a message to all connected clients. More... | |
| void | update (uint64_t nbMessagesToProcess, bool wait) override |
| Forces the server to call callbacks. More... | |
| bool | onClientConnect (std::shared_ptr< ITCPConnection< RFCCodes >> client) override |
| Called when a client connect. More... | |
| void | onClientDisconnect (std::shared_ptr< ITCPConnection< RFCCodes >> client) override |
| Called when a client disconnect. More... | |
| void | onMessage (std::shared_ptr< ITCPConnection< RFCCodes >> client, Message< RFCCodes > &msg) override |
| Called when we received a message from a client. More... | |
| ~AsioTCPServer () override | |
| default dtor More... | |
| AsioTCPServer () | |
| ctor More... | |
Public Member Functions inherited from Babel::ITCPServer< RFCCodes > | |
| virtual | ~ITCPServer ()=default |
| default dtor More... | |
Private Member Functions | |
| bool | getUserByUsername (const std::string &username, User &user) |
| Utility function to get the User from it's username. More... | |
| bool | isValidCallId (int callId) const |
| Tells if a given callId is currently pointing to an active call. More... | |
| Message< RFCCodes > & | getCallAllIPs (Message< RFCCodes > &m, const Call &call) |
| std::shared_ptr< ITCPConnection< RFCCodes > > | getConnectionById (uint64_t id) const |
| Get the connection from it's Id. More... | |
| void | messageAllParticipants (Call &call, const Message< RFCCodes > &m) |
| Send a message to all current call participants. More... | |
| void | announceUserLeftCall (Call &call, const ITCPConnection< RFCCodes > &connectionLeaving) |
Private Attributes | |
| std::map< uint64_t, User > | _users |
| All the connected user. More... | |
| FreeList< Call > | ongoingCalls |
| The list of all ongoing calls. More... | |
| std::map< RFCCodes, RequestHandler > | requestsHandlers |
| map that map a RFCCode to an requestHandler More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Babel::AsioTCPServer< RFCCodes > | |
| void | waitForClientConnections () |
| Listens for client messages. More... | |
Protected Attributes inherited from Babel::AsioTCPServer< RFCCodes > | |
| TSQueue< OwnedMessage< RFCCodes > > | _messagesIn |
| Received messages from clients. More... | |
| std::deque< std::shared_ptr< ITCPConnection< RFCCodes > > > | _connections |
| All the active connections. More... | |
| asio::io_context | _ioContext |
| Server's asio context. More... | |
| std::thread | _contextThread |
| Thread running the asio context. More... | |
| asio::ip::tcp::acceptor | _acceptor |
| The acceptor. More... | |
| uint64_t | _idCounter |
| The counter to set connections ids. More... | |
Main server class contains almost all the logic for the server.
|
private |
| Message< RFCCodes > Babel::BabelServer::callUser | ( | std::shared_ptr< ITCPConnection< RFCCodes >> | connection, |
| Message< RFCCodes > | message | ||
| ) |
The function to call to manage a callUser request.
| connection | The connection who made the request |
| message | The request message |
| Message< RFCCodes > Babel::BabelServer::denyCall | ( | std::shared_ptr< ITCPConnection< RFCCodes >> | connection, |
| Message< RFCCodes > | message | ||
| ) |
The function to call to manage a denyCall request.
| connection | The connection who made the request |
| message | The request message |
|
private |
|
private |
Get the connection from it's Id.
| id | The connection id |
|
private |
| Message< RFCCodes > Babel::BabelServer::hangUpCall | ( | std::shared_ptr< ITCPConnection< RFCCodes >> | connection, |
| Message< RFCCodes > | message | ||
| ) |
The function to call to manage a hangUp request.
| connection | The connection who made the request |
| message | The request message |
|
private |
Tells if a given callId is currently pointing to an active call.
| callId | The wanted call Id |
| Message< RFCCodes > Babel::BabelServer::joinCall | ( | std::shared_ptr< ITCPConnection< RFCCodes >> | connection, |
| Message< RFCCodes > | message | ||
| ) |
The function to call to manage a joinCall request.
| connection | The connection who made the request |
| message | The request message |
| Message< RFCCodes > Babel::BabelServer::listUsers | ( | std::shared_ptr< ITCPConnection< RFCCodes >> | connection, |
| Message< RFCCodes > | message | ||
| ) |
The function to call to manage a listUser request.
| connection | The connection who made the request |
| message | The request message |
| Message< RFCCodes > Babel::BabelServer::login | ( | std::shared_ptr< ITCPConnection< RFCCodes >> | connection, |
| Message< RFCCodes > | message | ||
| ) |
The function to call to manage a login request.
| connection | The connection who made the request |
| message | The request message |
|
private |
Send a message to all current call participants.
|
overridevirtual |
Called when a client connect.
Implements Babel::ITCPServer< RFCCodes >.
|
overridevirtual |
Called when a client disconnect.
Implements Babel::ITCPServer< RFCCodes >.
|
overridevirtual |
Called when we received a message from a client.
Implements Babel::ITCPServer< RFCCodes >.
|
private |
All the connected user.
|
private |
map that map a RFCCode to an requestHandler
1.8.17