Webserv
Loading...
Searching...
No Matches
Public Member Functions | Data Fields | Private Attributes
Server Class Reference

#include <Server.hpp>

Inheritance diagram for Server:
Inheritance graph
[legend]
Collaboration diagram for Server:
Collaboration graph
[legend]

Public Member Functions

 Server (JSONNode *server)
 Constructor.
 
 ~Server (void)
 Destructor.
 
Mastercreate_master (string str)
 Master socket safe creation.
 
std::vector< Master * > get_sockets (JSONNode *server)
 Create server's defined sockets:
 
Routechoose_route (string uri)
 Choose the route an uri asked to the server.
 
string getName (void)
 
- Public Member Functions inherited from Route
 Route (Server *server, string location, JSONNode *datas)
 Constructor.
 
 ~Route (void)
 Destructor.
 
string getLocation (void)
 
string getRoot (void)
 
string getReturn (void)
 
ServergetServer (void)
 
string getIndex (string uri, string path)
 Search for an index while generating autoindex.
 
string correctUri (string uri)
 Find the local path corresponding to the uri asked by te client.
 

Data Fields

std::vector< ip_port_t_listens
 The list of listens the server which are linked to the server.
 
- Data Fields inherited from Route
vec_string _indexs
 
vec_string _allowed_methods
 
std::map< string, string > _cgi
 
int _client_max_body_size
 

Private Attributes

string _name
 The server name.
 
std::map< string, Route * > _routes
 The server's routings with a route object as object and his location as key.
 

Additional Inherited Members

- Protected Attributes inherited from Route
Server_server
 
string _location
 
string _root
 
string _ret
 
bool _autoindex
 

Detailed Description

Definition at line 4 of file Server.hpp.

Constructor & Destructor Documentation

◆ Server()

Server::Server ( JSONNode server)

Constructor.

The Route constructor scrap the routing informations (index, root, autoindex ...) and the Server one the others ones (server_name, sub-routes)

Parameters
serverA server block JSONNode get by parser.

Definition at line 20 of file Server.cpp.

Here is the call graph for this function:

◆ ~Server()

Server::~Server ( void  )

Destructor.

Delete alocated routes.

Definition at line 38 of file Server.cpp.

Member Function Documentation

◆ choose_route()

Route * Server::choose_route ( string  uri)

Choose the route an uri asked to the server.

Parameters
uriThe uri asked by the client to the server.
Returns
The route object choosen or the server itself if no location is found

Definition at line 102 of file Server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_master()

Master * Server::create_master ( string  str)

Master socket safe creation.

Parameters
stra "ip:port" string
Returns
a Master socket object or NULL if the creation failed.

Definition at line 56 of file Server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_sockets()

std::vector< Master * > Server::get_sockets ( JSONNode server)

Create server's defined sockets:

Parameters
serverA server block node from JSONParser.

@retrn A vector containing all the succesfull created sockets using listens from the server block.

Definition at line 79 of file Server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getName()

string Server::getName ( void  )
Returns
The server name (server_name)

Definition at line 47 of file Server.cpp.

Field Documentation

◆ _listens

std::vector<ip_port_t> Server::_listens

The list of listens the server which are linked to the server.

Definition at line 9 of file Server.hpp.

◆ _name

string Server::_name
private

The server name.

Definition at line 5 of file Server.hpp.

◆ _routes

std::map<string, Route *> Server::_routes
private

The server's routings with a route object as object and his location as key.

Definition at line 6 of file Server.hpp.


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