Dbserver-protocols
dbserver listens on several ports, each one providing a different service. Most services correspond to another server which will connect. All of these services use the common Network protocol, in TCP-only mode.
account
arena
auction
AuctionServer connects to this service. It can receive the following commands:
AUCTION_SVR_CONNECT (2)
The message has no parameters. dbserver will accept only a single connection, and while it has one, it will respond to all further AUCTION_SVR_CONNECT messages by closing the connection.
dbserver responds with AUCTION_CLIENT_CONNECT (2):
packint(1) protocol_version string shard_name bits(1) have_inactive_players something....
AUCTION_SVR_SEND_INV (3)
autobits entity_id string inventory
dbserver finds the mapserver for entity_id, and proxies the message there as DBSERVER_AUCTION_SEND_INV
inventory is eventually decoded by AuctionInventory_FromStr in the mapserver, but dbserver proxies it without inspecting its value.
AUCTION_SVR_SEND_HISTORYINFO (4)
autobits entity_id string identifier autobits buying_count autobits selling_count autobits history_count repeated history_count times: autobits date autobits price
dbserver finds the mapserver for entity_id, and proxies the message there as DBSERVER_AUCTION_SEND_HIST.
AUCTION_SVR_BATCH_SEND_ITEMINFO (5)
autobits entity_id zipped data
dbserver finds the mapserver for entity_id, and proxies the message there as DBSERVER_AUCTION_BATCH_INFO. The zipped data is not inspected by dbserver.
After this output packet has been queued, dbserver sends AUCTION_CLIENT_DATAOK to the AuctioServer, with no both. This is a primitive form of flow control. It does not wait for the message to be sent to the mapserver before doing this.
AUCTION_SVR_XACT_CMD (7)
autobits entity_id autobits type XactCmd cmd
dbserver finds the mapserver for entity_id. If there is one, it proxies the message there as DBSERVER_AUCTION_XACT_CMD. If there is no mapserver, then dbserver responds to AuctionServer with AUCTION_CLIENT_XACT_UPDATE, sending:
autobits xid autobits subid autobits result
Where *xid* and *subid* are taken from *cmd*, and the result is set to *kXactCmdRes_No*.
AUCTION_SVR_RELAY_CMD_BYENT (9)
packint(1) entity_id packint(1) force string msg
dbserver finds the mapserver for entity_id. If there is one, it sends DBSERVER_RELAY_CMD there with *msg* as the body. If there is no mapserver, and force is set to 1, then the message is queued for relaying when the entity is available, and dbserver begins attempting to load the entity into a mapserver.
AUCTION_SVR_THROTTLE_ON (10)
This message has no parameters, and dbserver sends no response. It enables throttling, which prevents some (???) messages from being sent to the AuctionServer.
AUCTION_SVR_THROTTLE_OFF (11)
This message has no parameters, and dbserver sends no response. It disables throttling.
AUCTION_SVR_ACCOUNT_SHARDXFER (12)
OrderId order_id autobits dbid
dbid is interpreted as an entity_id. dbserver will offline (???) and delete (???) the player, and then send AccountServer an ACCOUNT_CLIENT_SHARDXFER with:
OrderId order_id autobits SHARDXFER_FULFILL_COMMIT_SRC
beacon
client
This service is used for the game client to communicate with dbserver.
It is documented on Client-to-dbserver
db
Despite the name, this service is used to communicate with MapServer.
Every NetLink for the db server has a unique lock_id, starting from 0. They are used to identify current connections to MapServer in order to send messages.
DBCLIENT_INITIAL_CONNECT
optional packint(1) map_protocol
If map_protocol is not present (the body is empty), it is 0. If map_protocol is not equal to DBSERVER_PROTOCOL_VERSION (currently 20110503) then dbserver will respond with DBSERVER_CLIENT_CMD_FAILED and close the NetLink.
Otherwise, dbserver sends these commands back to the MapServer:
DBSERVER_TIMEOFFSET:
bits(32) seconds_since_2000 float32 time_zone_delta
These values are set based on the system clock. time_zone_delta is the difference between UTC and local time, in hours.
DBSERVER_OVERRIDDEN_AUTHBITS
bits(128) overridden_auth_bits
The value of overridden_auth_bits is set based on OverrideAuthBit lines in servers.cfg.
If any DisabledZoneEvents entries are present in servers.cfg, dbserver sends a DBSERVER_DISABLED_ZONE_EVENTS command:
repeated string event
One entry for each DisabledZoneEvents line in servers.cfg
If user reactivation is active, dbserver sends a DBSERVER_NOTIFY_REACTIVATION message, with no body.
DBSERVER_UPDATE_LOG_LEVELS:
repeated LOG_LEVELS times: packint(1) log_level
These are the log levels, as managed by log.h, for all logging types in order from 0 to LOG_LEVELS. They are set in servers.cfg with SetLogLevel lines.
DBSERVER_ACCOUNTSERVER_CATALOG:
autobits catalog_timestamp autobits auth_timeout string mtx_environment string play_span_domain string play_spam_url_home string play_spam_url_categoryview string play_spam_url_itemview string play_spam_url_showcart string play_spam_url_addtocart string play_spam_url_manageaccount string play_spam_url_supportpage string play_spam_url_supportpage_de string play_spam_url_supportpage_fr string play_spam_url_updatetovip string coh_url_newfeatures string coh_url_newfeaturesupdate autobits play_span_store_flags
These appear to be values set in account_server.cfg. Most of them are URLs.
DBCLIENT_READY
This message is understood by dbserver, but does not appear to be sent by mapserver; it is suspected to be historical debris.
DBCLIENT_REGISTER
packint(1) map_id packint(1) local_ip packint(1) remote_ip packint(1) udp_port packint(1) tcp_port packint(1) static_link packint(1) cookie string patch_version optional string map_name
static_link is set based on the command line of the MapServer
map_id is a signed int, set on the command line of the MapServer. Negative values mean that a map_name field will be sent and edit mode will be used.
If map_id is non-negative, then dbserver selects the container for this mapserver based on map_id. Otherwise, dbserver selects the container based on map_name, and enables edit mode on this container. If static_link is set, then dbserver searches for a map with this name. If static_link is not set, or no map of this name is found, then a new map container is created and populated with the data in the map_name field.
udp_port and tcp_port are the ports on which the MapServer will listen for game clients, and are set on the command line.
cookie is set on the command line of the MapServer, and sent as-is. If the cookie is non-zero, then dbserver will validate that it matches the cookie matches the container referenced by map_id, and will close the link if it does not match. This is used to ensure the MapServer is the one this dbserver wanted to spawn, and not from a previous instance of dbserver.
local_ip and remote_ip are sent by the mapserver, based on the result of gethostbyname(NULL). They will use the first two results from this function. If one of those results is an rfc1918 address, or 127.0.0.1 (none of the other loopback addresses are recognised as "local"), then it will be local_ip; otherwise local_ip will be the first result from gethostbyname() and remote_ip will be the second.