NCBI C++ ToolKit
Macros | Variables
message_handler.cpp File Reference
#include "nc_pch.hpp"
#include <corelib/ncbireg.hpp>
#include <corelib/ncbifile.hpp>
#include <corelib/request_ctx.hpp>
#include <corelib/ncbi_bswap.hpp>
#include <util/md5.hpp>
#include "netcached.hpp"
#include "message_handler.hpp"
#include "netcache_version.hpp"
#include "nc_stat.hpp"
#include "peer_control.hpp"
#include "distribution_conf.hpp"
#include "periodic_sync.hpp"
#include "active_handler.hpp"
#include "nc_storage.hpp"
#include "nc_storage_blob.hpp"
#include "logging.hpp"
+ Include dependency graph for message_handler.cpp:

Go to the source code of this file.

Go to the SVN repository for this file.




static CNCMessageHandler::SCommandDef s_CommandMap []
 Definition of all NetCache commands. More...
static SNSProtoArgument s_AuthArgs []

Macro Definition Documentation



Definition at line 57 of file message_handler.cpp.



Definition at line 65 of file message_handler.cpp.

Variable Documentation

◆ s_AuthArgs

SNSProtoArgument s_AuthArgs[]
Initial value:
= {
{ "client", eNSPT_Str, eNSPA_Optional, "Unknown client" },
{ "params", eNSPT_Str, eNSPA_Ellipsis },
{ NULL }
#define NULL
Definition: ncbistd.hpp:225

Definition at line 1684 of file message_handler.cpp.

Referenced by CNCMessageHandler::x_ReadAuthMessage().

◆ s_CommandMap

CNCMessageHandler::SCommandDef s_CommandMap[]

Definition of all NetCache commands.

General format of a "NetCache" command is as follows:

CMD param1 param2 ...

Format of "ICache" command is as follows:

IC(cache) CMD param1 param2 ...

Here "IC" is two letters that appear in command literally. "cache" is name of the cache where blob is stored; it's mentioned in parameter list as first parameter with type eNSPA_ICPrefix. Every command parameter can be given as just value or as name=value pair. String parameter values can be enclosed in double quotes. If parameter is declared with the flag eNSPA_Optional then it can be skipped from the command, in this case its default value will be used (if any). If parameter flag eNSPA_Optchain has the same meaning except if it's not provided then all following parameters marked as eNSPA_Optional will be assumed not provided too.

If command needs some binary data along with it then it's sent split in chunks each having 4-byte integer prefix containing the length of the chunk. When all data is sent special chunk length 0xFFFFFFFF should be sent at the end. Successful response of each command is sent as one line starting with "OK:" and then space-separated parameters that need to be returned. If response should contain binary data then initial response line should have "SIZE=nnn" with the size of binary data to follow. Unsuccessful responses to commands always start with "ERR:" and then error explanation follows.

Descriptions of commands have

  • command name as it comes from client;
  • structure containing * state function processing this command; * command name as it appears in statistics; * flags controlling command behavior; * type of access to blob if needed; * type of proxy command that should be executed if command will need to be proxied to other servers;
  • set of structures explaining command parameters. Each structure has * parameter name which can be used by client if it passes parameters in name=value form. Also name is used to distinguish parameters in x_AssignCmdParams(); * type of parameter - parser makes additional checks to see if given value is applicable for necessary parameter type; * parameter flags.

Definition at line 113 of file message_handler.cpp.

Modified on Tue Feb 27 05:55:07 2024 by rev. 669887