Crossfire Server, Trunk
|
#include "global.h"
#include <assert.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <netdb.h>
#include "commands.h"
#include "living.h"
#include "newserver.h"
#include "shared/newclient.h"
#include "sounds.h"
#include "sproto.h"
#include "assets.h"
Go to the source code of this file.
Macros | |
#define | AddShortAttr(New, Type) |
Functions | |
static void | build_class_list_reply (SockList *sl) |
static void | build_race_list_reply (SockList *sl) |
static void | do_class_list (archetype *cl) |
static void | do_map_info (archetype *m) |
static void | do_race_list (archetype *race) |
static void | send_arch_info (SockList *sl, const object *op) |
void | send_class_info (socket_struct *ns, char *params) |
void | send_class_list (socket_struct *ns) |
void | send_exp_table (socket_struct *ns) |
void | send_file (socket_struct *ns, const char *file) |
void | send_map_info (socket_struct *ns) |
void | send_new_char_info (socket_struct *ns) |
void | send_race_info (socket_struct *ns, char *params) |
void | send_race_list (socket_struct *ns) |
void | send_skill_info (socket_struct *ns, char *params) |
void | send_spell_paths (socket_struct *ns) |
Variables | |
static SockList * | ugly |
requestinfo protocol handling.
This file implements all of requestinfo protocol commands/responses. This was broken from request.c as that file as getting quite large and throwing everything into that file was making it fairly unmanageable.
Definition in file requestinfo.c.
#define AddShortAttr | ( | New, | |
Type | |||
) |
Definition at line 150 of file requestinfo.c.
|
static |
Creates the appropriate reply to the 'class_list' request info.
sl | reply. |
Definition at line 360 of file requestinfo.c.
References archetypes_for_each(), do_class_list(), SockList_AddString(), SockList_Reset(), and ugly.
Referenced by send_class_list().
|
static |
Creates the appropriate reply to the 'race_list' request info.
sl | suitable reply. |
Definition at line 291 of file requestinfo.c.
References archetypes_for_each(), do_race_list(), SockList_AddString(), and ugly.
Referenced by send_race_list().
|
static |
Definition at line 348 of file requestinfo.c.
References CLASS, archt::clone, archt::name, SockList_AddPrintf(), obj::type, and ugly.
Referenced by build_class_list_reply().
|
static |
Callback function sending start map information, used by send_map_info().
m | archetype. |
Definition at line 423 of file requestinfo.c.
References INFO_MAP_ARCH_NAME, INFO_MAP_DESCRIPTION, INFO_MAP_NAME, m, MAP, MAP_TYPE_CHOICE, SockList_AddChar(), SockList_AddLen16Data(), and ugly.
Referenced by send_map_info().
|
static |
Callback used to write race archetypes to the socket.
race | archetype to process. |
Definition at line 279 of file requestinfo.c.
References archt::clone, archt::name, PLAYER, SockList_AddPrintf(), obj::type, and ugly.
Referenced by build_race_list_reply().
This sends information about object op to client - used in response to requestinfo. This function is used by both race & class transmissions, and could perhaps be used by future requestinfo types.
sl | socketlist to add data to |
op | Object to extract data from. |
Definition at line 167 of file requestinfo.c.
References AddShortAttr, archininventory::arch, buf, CLASS, CS_STAT_CHA, CS_STAT_CON, CS_STAT_DEX, CS_STAT_INT, CS_STAT_POW, CS_STAT_STR, CS_STAT_WIS, llevError, LOG(), MAX_BUF, object_get_value(), give::op, PLAYER, SockList_AddChar(), SockList_AddData(), SockList_AddLen8Data(), SockList_AddShort(), SockList_AddString(), strdup_local, try_find_archetype(), and autojail::value.
Referenced by send_class_info(), and send_race_info().
void send_class_info | ( | socket_struct * | ns, |
char * | params | ||
) |
Send information on the specified class.
ns | where to send. |
params | class name to send. |
Definition at line 396 of file requestinfo.c.
References CLASS, socket_struct::host, llevError, LOG(), roll-o-matic::params, send_arch_info(), Send_With_Handling(), SockList_AddPrintf(), SockList_Init(), and SockList_Term().
Referenced by request_info_cmd().
void send_class_list | ( | socket_struct * | ns | ) |
Sends the list of classes to the client. The reply is kept in a static buffer, as it won't change during server run.
ns | client to send to. |
Definition at line 375 of file requestinfo.c.
References build_class_list_reply(), Send_With_Handling(), and SockList_Init().
Referenced by request_info_cmd().
void send_exp_table | ( | socket_struct * | ns | ) |
This sends the experience table the sever is using.
ns | where to write the information. |
Definition at line 127 of file requestinfo.c.
References levels, llevError, LOG(), Settings::max_level, Send_With_Handling(), settings, SockList_AddInt64(), SockList_AddShort(), SockList_AddString(), SockList_Avail(), SockList_Init(), and SockList_Term().
Referenced by request_info_cmd().
void send_file | ( | socket_struct * | ns, |
const char * | file | ||
) |
Sends the desired file to the client. In all three cases, we are basically just dumping file contents to the client - nothing more.
ns | socket to send to |
file | Which file to send - string of either motd, news, rules |
Definition at line 470 of file requestinfo.c.
References buf, Settings::confdir, mad_mage_user::file, llevError, LOG(), MAX_BUF, Settings::motd, Settings::news, Settings::rules, Send_With_Handling(), settings, SockList_AddChar(), SockList_AddString(), SockList_Init(), and SockList_Term().
Referenced by request_info_cmd().
void send_map_info | ( | socket_struct * | ns | ) |
Send information on available start maps.
ns | where to send. |
Definition at line 447 of file requestinfo.c.
References archetypes_for_each(), do_map_info(), Send_With_Handling(), SockList_AddPrintf(), SockList_Init(), SockList_Term(), and ugly.
Referenced by request_info_cmd().
void send_new_char_info | ( | socket_struct * | ns | ) |
Sends information related to creating a new character to the client.
ns | socket to send to |
Definition at line 511 of file requestinfo.c.
References buf, MAX_BUF, NUM_STATS, safe_strcat(), Send_With_Handling(), settings, short_stat_name, SockList_AddLen8Data(), SockList_AddString(), SockList_Init(), SockList_Term(), Settings::starting_stat_max, Settings::starting_stat_min, and Settings::starting_stat_points.
Referenced by request_info_cmd().
void send_race_info | ( | socket_struct * | ns, |
char * | params | ||
) |
Sends information on specified race to the client.
ns | where to send. |
params | race name to send. |
Definition at line 326 of file requestinfo.c.
References archt::clone, socket_struct::host, llevError, LOG(), roll-o-matic::params, PLAYER, send_arch_info(), Send_With_Handling(), SockList_AddPrintf(), SockList_Init(), SockList_Term(), try_find_archetype(), and obj::type.
Referenced by request_info_cmd().
void send_race_list | ( | socket_struct * | ns | ) |
Send the list of player races to the client. The reply is kept in a static buffer, as it won't change during server run.
ns | where to send. |
Definition at line 305 of file requestinfo.c.
References build_race_list_reply(), Send_With_Handling(), and SockList_Init().
Referenced by request_info_cmd().
void send_skill_info | ( | socket_struct * | ns, |
char * | params | ||
) |
This sends the skill number to name mapping.
ns | where to write the information. |
params | if '1', then send the face along the skill, else just send the skill name. |
Definition at line 70 of file requestinfo.c.
References CS_STAT_SKILLINFO, esrv_send_face(), socket_struct::faces_sent, llevError, LOG(), MAX_SKILLS, NS_FACESENT_FACE, Face::number, roll-o-matic::params, Send_With_Handling(), skill_faces, skill_names, SockList_AddPrintf(), SockList_AddString(), SockList_Avail(), SockList_Init(), and SockList_Term().
Referenced by request_info_cmd().
void send_spell_paths | ( | socket_struct * | ns | ) |
This sends the spell path to name mapping.
ns | where to write the information. |
Definition at line 101 of file requestinfo.c.
References llevError, LOG(), NRSPELLPATHS, Send_With_Handling(), SockList_AddPrintf(), SockList_AddString(), SockList_Avail(), SockList_Init(), SockList_Term(), and spellpathnames.
Referenced by request_info_cmd().
|
static |
Definition at line 273 of file requestinfo.c.
Referenced by build_class_list_reply(), build_race_list_reply(), do_class_list(), do_map_info(), do_race_list(), and send_map_info().