Wittyshare
0.2
|
Main class of the FsDaemon. More...
#include <WsFsDaemon.h>
Public Types | |
enum | DaemonStatus { Success, Failure, NotLogged, NoAccess } |
Public Member Functions | |
WsFsDaemon (WsGlobalProperties *props) | |
constructor for the server More... | |
~WsFsDaemon () | |
destructor More... | |
DaemonStatus | bind (unsigned int numWorkers=1) |
start listening on the port More... | |
DaemonStatus | workerRoutine () |
Private Member Functions | |
DaemonStatus | send (zmq::socket_t &sock, const std::string &s) |
Sends data on the socket. More... | |
DaemonStatus | receive (zmq::socket_t &sock, std::string &receivedData) |
read data from the socket More... | |
DaemonStatus | parse (const std::string &s, Json::Value &root) |
Parses the received data (json) More... | |
DaemonStatus | handleRequest (zmq::socket_t &sock, Json::Value &root) |
Handle received request and redirect to correct method. More... | |
DaemonStatus | handleAuthRequest (zmq::socket_t &sock, Json::Value &root) |
Authenticate user on server Loads the groups which the user belongs to, uid, email, etc.. More... | |
DaemonStatus | handleGetLockRequest (zmq::socket_t &sock, Json::Value &root) |
Acquires the lock for the path. More... | |
DaemonStatus | handlePutLockRequest (zmq::socket_t &sock, Json::Value &root) |
releases the lock for the path More... | |
DaemonStatus | handleIsLockedRequest (zmq::socket_t &sock, Json::Value &root) |
checks the lock for the path More... | |
DaemonStatus | handleAccessTreeRequest (zmq::socket_t &sock, Json::Value &root) |
Sends the accesstree to the client. More... | |
DaemonStatus | handlePermRequest (zmq::socket_t &sock, Json::Value &root) |
sends the permissions of a path to the client More... | |
DaemonStatus | handlePropRequest (zmq::socket_t &sock, Json::Value &root) |
sends a property of a node to the client More... | |
DaemonStatus | handleAllGroupsRequest (zmq::socket_t &sock, Json::Value &root) |
sends all the groups available to the client More... | |
DaemonStatus | handlePropsRequest (zmq::socket_t &sock, Json::Value &root) |
sends all the properties of a node More... | |
DaemonStatus | handleSearchRequest (zmq::socket_t &sock, Json::Value &root) |
sends the result of a search request to the client. Only nodes where the user has access are returned More... | |
DaemonStatus | handleClearCache (zmq::socket_t &sock, Json::Value &root) |
clears the user from the cache More... | |
DaemonStatus | handleIsAdminRequest (zmq::socket_t &sock, Json::Value &root) |
sends the result of an admin request so that the client can know if he is an admin or not More... | |
DaemonStatus | handleIsEditorRequest (zmq::socket_t &sock, Json::Value &root) |
sends the result of an editor request so that the client can know if he is an editor or not More... | |
DaemonStatus | handleSavePropertiesRequest (zmq::socket_t &sock, Json::Value &root) |
saves the properties received by the client for a node More... | |
DaemonStatus | handleSavePropertyRequest (zmq::socket_t &sock, Json::Value &root) |
saves one property received by a client for a node More... | |
DaemonStatus | handleCreateNodeRequest (zmq::socket_t &sock, Json::Value &root) |
create a node requested by the client More... | |
DaemonStatus | handleRenameNodeRequest (zmq::socket_t &sock, Json::Value &root) |
rename a node More... | |
DaemonStatus | handleDeleteNodeRequest (zmq::socket_t &sock, Json::Value &root) |
delete a node requested by the client More... | |
DaemonStatus | handleRootPathRequest (zmq::socket_t &sock, Json::Value &root) |
send the rootPath to the client More... | |
DaemonStatus | handleGetTreeVersion (zmq::socket_t &sock, Json::Value &root) |
sends the last tree version to the client More... | |
string | rawDataToString (zmq::message_t &msg) |
converts raw data received on the socket to string More... | |
bool | isActiveSession (const std::string &uid, const std::string &pass, const std::string &ip) |
returns true or false whether the section of a user is still active or not More... | |
Private Attributes | |
WsGlobalProperties * | m_conf |
bool | m_listening |
WsFsTreeOperations * | m_operation |
map< string, WsUserSession * > | m_userMap |
set< string > | m_allGroups |
bool | m_compress |
WsCompressor * | m_compressor |
WsDecompressor * | m_decompressor |
zmq::context_t * | m_context |
Main class of the FsDaemon.
Caches locally the FileSystemTree and wait for request and replies
Definition at line 44 of file WsFsDaemon.h.
Enumerator | |
---|---|
Success | |
Failure | |
NotLogged | |
NoAccess |
Definition at line 47 of file WsFsDaemon.h.
WsFsDaemon::WsFsDaemon | ( | WsGlobalProperties * | props | ) |
constructor for the server
props | an instance of WsGlobalProperties |
Definition at line 28 of file WsFsDaemon.cpp.
WsFsDaemon::~WsFsDaemon | ( | ) |
WsFsDaemon::WsFsDaemon::DaemonStatus WsFsDaemon::bind | ( | unsigned int | numWorkers = 1 | ) |
start listening on the port
Definition at line 83 of file WsFsDaemon.cpp.
|
private |
Sends the accesstree to the client.
sock | the zmq::socket_t |
Definition at line 316 of file WsFsDaemon.cpp.
|
private |
sends all the groups available to the client
sock | the zmq::socket_t |
Definition at line 347 of file WsFsDaemon.cpp.
|
private |
Authenticate user on server Loads the groups which the user belongs to, uid, email, etc..
Definition at line 274 of file WsFsDaemon.cpp.
|
private |
clears the user from the cache
sock | the zmq::socket_t |
Definition at line 412 of file WsFsDaemon.cpp.
|
private |
create a node requested by the client
sock | the zmq::socket_t |
Definition at line 478 of file WsFsDaemon.cpp.
|
private |
delete a node requested by the client
sock | the zmq::socket_t |
Definition at line 492 of file WsFsDaemon.cpp.
|
private |
Acquires the lock for the path.
sock | the zmq::socket_t |
Definition at line 519 of file WsFsDaemon.cpp.
|
private |
sends the last tree version to the client
sock | the zmq::socket_t |
Definition at line 566 of file WsFsDaemon.cpp.
|
private |
sends the result of an admin request so that the client can know if he is an admin or not
sock | the zmq::socket_t |
Definition at line 435 of file WsFsDaemon.cpp.
|
private |
sends the result of an editor request so that the client can know if he is an editor or not
sock | the zmq::socket_t |
Definition at line 422 of file WsFsDaemon.cpp.
|
private |
checks the lock for the path
sock | the zmq::socket_t |
Definition at line 543 of file WsFsDaemon.cpp.
|
private |
sends the permissions of a path to the client
sock | the zmq::socket_t |
Definition at line 333 of file WsFsDaemon.cpp.
|
private |
sends a property of a node to the client
sock | the zmq::socket_t |
Definition at line 374 of file WsFsDaemon.cpp.
|
private |
sends all the properties of a node
sock | the zmq::socket_t |
Definition at line 358 of file WsFsDaemon.cpp.
|
private |
releases the lock for the path
sock | the zmq::socket_t |
Definition at line 531 of file WsFsDaemon.cpp.
|
private |
rename a node
sock | the zmq::socket_t |
Definition at line 505 of file WsFsDaemon.cpp.
|
private |
Handle received request and redirect to correct method.
sock | the zmq::socket_t |
Definition at line 189 of file WsFsDaemon.cpp.
|
private |
send the rootPath to the client
sock | the zmq::socket_t |
Definition at line 557 of file WsFsDaemon.cpp.
|
private |
saves the properties received by the client for a node
sock | the zmq::socket_t |
Definition at line 448 of file WsFsDaemon.cpp.
|
private |
saves one property received by a client for a node
sock | the zmq::socket_t |
Definition at line 461 of file WsFsDaemon.cpp.
|
private |
sends the result of a search request to the client. Only nodes where the user has access are returned
sock | the zmq::socket_t |
Definition at line 389 of file WsFsDaemon.cpp.
|
private |
returns true or false whether the section of a user is still active or not
sock | the zmq::socket_t |
Definition at line 583 of file WsFsDaemon.cpp.
|
private |
Parses the received data (json)
s | the string to parse (Json) |
Definition at line 177 of file WsFsDaemon.cpp.
|
private |
converts raw data received on the socket to string
sock | the zmq::socket_t |
Definition at line 574 of file WsFsDaemon.cpp.
|
private |
read data from the socket
sock | the zmq::socket_t |
receivedData | the string where the data read will be stored |
Definition at line 160 of file WsFsDaemon.cpp.
|
private |
Sends data on the socket.
sock | a zmq::socket_t |
s | the string to send |
Definition at line 120 of file WsFsDaemon.cpp.
WsFsDaemon::WsFsDaemon::DaemonStatus WsFsDaemon::workerRoutine | ( | ) |
Definition at line 48 of file WsFsDaemon.cpp.
|
private |
All groups available
Definition at line 281 of file WsFsDaemon.h.
|
private |
Copress data or no ?
Definition at line 286 of file WsFsDaemon.h.
|
private |
Object used for compression
Definition at line 291 of file WsFsDaemon.h.
|
private |
GlobalProperties
Definition at line 261 of file WsFsDaemon.h.
|
private |
Definition at line 298 of file WsFsDaemon.h.
|
private |
Object used for decompressions
Definition at line 296 of file WsFsDaemon.h.
|
private |
listening on socket ?
Definition at line 266 of file WsFsDaemon.h.
|
private |
Contains the interface to all possible operations on tree
Definition at line 271 of file WsFsDaemon.h.
|
private |
User's session map
Definition at line 276 of file WsFsDaemon.h.