Crossfire Server  1.75.0
sockproto.h
Go to the documentation of this file.
1 /* image.c */
2 int is_valid_faceset(int fsn);
3 void set_face_mode_cmd(char *buf, int len, socket_struct *ns);
4 void send_face_cmd(char *buff, int len, socket_struct *ns);
5 void esrv_send_face(socket_struct *ns, const Face *face, int nocache);
7 void send_image_sums(socket_struct *ns, char *params);
8 /* info.c */
9 void print_ext_msg(socket_struct *ns, int color, uint8_t type, uint8_t subtype, const char *message);
10 void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message);
11 void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format, ...) PRINTF_ARGS(6, 7);
12 void ext_info_map(int color, const mapstruct *map, uint8_t type, uint8_t subtype, const char *str1);
13 void ext_info_map_except(int color, const mapstruct *map, const object *op, uint8_t type, uint8_t subtype, const char *str1);
14 void ext_info_map_except2(int color, const mapstruct *map, const object *op1, const object *op2, int type, int subtype, const char *str1);
15 void rangetostring(const object *pl, char *obuf, size_t len);
16 void set_title(const object *pl, char *buf, size_t len);
17 void magic_mapping_mark(object *pl, char *map_mark, int strength);
18 void draw_magic_map(object *pl);
19 /* init.c */
20 void init_connection(socket_struct *ns, const char *from_ip);
22 void init_server(void);
23 void free_all_newserver(void);
25 void final_free_player(player *pl);
26 /* item.c */
27 void esrv_draw_look(object *pl);
28 void esrv_send_inventory(object *pl, object *op);
29 void esrv_update_item(int flags, object *pl, object *op);
30 void esrv_send_item(object *pl, object *op);
31 void esrv_del_item(player *pl, object *ob);
32 void examine_cmd(char *buf, int len, player *pl);
33 void apply_cmd(char *buf, int len, player *pl);
34 void lock_item_cmd(uint8_t *data, int len, player *pl);
35 void mark_item_cmd(uint8_t *data, int len, player *pl);
36 void look_at(object *op, int dx, int dy);
37 void look_at_cmd(char *buf, int len, player *pl);
38 void esrv_move_object(object *pl, tag_t to, tag_t tag, long nrof);
39 void inscribe_scroll_cmd(char *buf, int len, player *pl);
40 /* loop.c */
41 void request_info_cmd(char *buf, int len, socket_struct *ns);
42 bool handle_client(socket_struct *ns, player *pl);
43 void watchdog(void);
44 void do_server(void);
45 void update_players(void);
46 /* lowlevel.c */
47 void SockList_Init(SockList *sl);
48 void SockList_Term(SockList *sl);
49 void SockList_Reset(SockList *sl);
51 void SockList_AddChar(SockList *sl, unsigned char c);
52 void SockList_AddShort(SockList *sl, uint16_t data);
53 void SockList_AddInt(SockList *sl, uint32_t data);
54 void SockList_AddInt64(SockList *sl, uint64_t data);
55 size_t SockList_Avail(const SockList *sl);
56 void SockList_AddString(SockList *sl, const char *data);
57 void SockList_AddData(SockList *sl, const void *data, size_t len);
58 void SockList_AddLen8Data(SockList *sl, const void *data, size_t len);
59 void SockList_AddLen16Data(SockList *sl, const void *data, size_t len);
60 void SockList_AddPrintf(SockList *sl, const char *format, ...);
63 int GetInt_String(const unsigned char *data);
64 short GetShort_String(const unsigned char *data);
65 int SockList_ReadPacket(int fd, SockList *sl, int len);
67 void reset_stats(struct CS_Stats *stats);
68 void write_cs_stats(void);
69 /* metaserver.c */
70 int count_players(void);
71 void metaserver_update(void);
72 int metaserver2_init(void);
73 void metaserver2_exit();
74 /* request.c */
75 void set_up_cmd(char *buf, int len, socket_struct *ns);
76 void add_me_cmd(char *buf, int len, socket_struct *ns);
77 void toggle_extended_infos_cmd(char *buf, int len, socket_struct *ns);
78 void toggle_extended_text_cmd(char *buf, int len, socket_struct *ns);
79 void ask_smooth_cmd(char *buf, int len, socket_struct *ns);
80 void new_player_cmd(uint8_t *buf, int len, player *pl);
81 void reply_cmd(char *buf, int len, player *pl);
82 void version_cmd(char *buf, int len, socket_struct *ns);
83 void set_sound_cmd(char *buf, int len, socket_struct *ns);
85 void move_cmd(char *buf, int len, player *pl);
86 void send_query(socket_struct *ns, uint8_t flags, const char *text);
87 void esrv_update_stats(player *pl);
88 void esrv_new_player(player *pl, uint32_t weight);
89 void esrv_send_animation(socket_struct *ns, const Animations *anim);
90 void draw_client_map(object *pl);
91 void esrv_map_scroll(socket_struct *ns, int dx, int dy);
92 void send_plugin_custom_message(object *pl, char *buf);
94 void send_skill_info(socket_struct *ns, char *params);
95 void send_skill_extra(socket_struct *ns, char *params);
98 void send_race_info(socket_struct *ns, char *params);
100 void send_class_info(socket_struct *ns, char *params);
101 void esrv_update_spells(player *pl);
102 void esrv_remove_spell(player *pl, object *spell);
103 void esrv_send_pickup(player *pl);
104 void esrv_add_spells(player *pl, object *spell);
105 void send_tick(player *pl);
106 void send_file(socket_struct *ns, const char *file);
107 void account_login_cmd(char *buf, int len, socket_struct *ns);
108 void account_new_cmd(char *buf, int len, socket_struct *ns);
109 void account_add_player_cmd(char *buf, int len, socket_struct *ns);
110 void account_play_cmd(char *buf, int len, socket_struct *ns);
112 void create_player_cmd(char *buf, int len, socket_struct *ns);
113 void account_password(char *buf, int len, socket_struct *ns);
114 /* requestinfo.c */
116 void send_map_info(socket_struct *ns);
117 /* sounds.c */
118 void play_sound_player_only(player *pl, int8_t sound_type, object *emitter, int dir, const char *action);
119 void play_sound_map(int8_t sound_type, object *emitter, int dir, const char *action);
120 void send_background_music(player *pl, const char *music);
121 void player_update_bg_music(object *player);
static event_registration c
Definition: citylife.cpp:424
void SockList_AddPrintf(SockList *sl, const char *format,...)
Adds a printf like formatted string.
Definition: lowlevel.cpp:202
void do_server(void)
This checks the sockets for input and exceptions, does the right thing.
Definition: loop.cpp:527
void SockList_Reset(SockList *sl)
Resets the length of the stored data for writing.
Definition: lowlevel.cpp:74
This represents one animation.
Definition: face.h:25
void SockList_Init(SockList *sl)
Initializes the SockList instance.
Definition: lowlevel.cpp:55
void esrv_send_item(object *pl, object *op)
Sends item's info to player.
Definition: main.cpp:354
void send_skill_extra(socket_struct *ns, char *params)
Send extra skill information.
void metaserver2_exit()
Stop metaserver updates.
Definition: metaserver.cpp:492
void set_face_mode_cmd(char *buf, int len, socket_struct *ns)
void account_login_cmd(char *buf, int len, socket_struct *ns)
Handles the account login.
Definition: request.cpp:2230
void request_info_cmd(char *buf, int len, socket_struct *ns)
request_info_cmd is sort of a meta command.
Definition: loop.cpp:136
void SockList_ResetRead(SockList *sl)
Resets the length of the stored data for reading.
Definition: lowlevel.cpp:83
int GetInt_String(const unsigned char *data)
Basically does the reverse of SockList_AddInt, but on strings instead.
Definition: lowlevel.cpp:254
void mark_item_cmd(uint8_t *data, int len, player *pl)
Client wants to mark some object.
Definition: item.cpp:767
void look_at_cmd(char *buf, int len, player *pl)
Client wants to look at some object.
Definition: item.cpp:869
void version_cmd(char *buf, int len, socket_struct *ns)
Client tells its version.
Definition: request.cpp:651
void metaserver_update(void)
Updates our info in the metaserver Note that this is used for both metaserver1 and metaserver2 - for ...
Definition: metaserver.cpp:80
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
New face structure - this enforces the notion that data is face by face only - you can not change the...
Definition: face.h:14
void print_ext_msg(socket_struct *ns, int color, uint8_t type, uint8_t subtype, const char *message)
Draws an extended message on the client.
Definition: info.cpp:62
void esrv_update_item(int flags, object *pl, object *op)
Updates object *op for player *pl.
Definition: main.cpp:359
void magic_mapping_mark(object *pl, char *map_mark, int strength)
Creates magic map for player.
Definition: info.cpp:428
void send_map_info(socket_struct *ns)
Send information on available start maps.
void send_image_sums(socket_struct *ns, char *params)
Sends requested face information.
Definition: image.cpp:138
void init_server(void)
This sets up the listening socket.
Definition: init.cpp:283
void SockList_AddShort(SockList *sl, uint16_t data)
Adds a 16 bit value.
Definition: lowlevel.cpp:116
Socket structure, represents a client-server connection.
Definition: newserver.h:93
void SockList_AddLen16Data(SockList *sl, const void *data, size_t len)
Adds a data block prepended with an 16 bit length field.
Definition: lowlevel.cpp:191
int count_players(void)
Definition: metaserver.cpp:48
void esrv_send_inventory(object *pl, object *op)
Sends inventory of a container.
Definition: item.cpp:316
void update_players(void)
Send updates to players.
Definition: loop.cpp:677
void send_account_players(socket_struct *ns)
Upon successful login/account creation, we send a list of characters associated with the account to t...
Definition: request.cpp:2103
void new_player_cmd(uint8_t *buf, int len, player *pl)
This handles the commands issued by the player (ie, north, fire, cast, etc.).
Definition: request.cpp:527
void SockList_AddInt(SockList *sl, uint32_t data)
Adds a 32 bit value.
Definition: lowlevel.cpp:127
void draw_magic_map(object *pl)
Creates and sends magic map to player.
Definition: info.cpp:475
void inscribe_scroll_cmd(char *buf, int len, player *pl)
Definition: item.cpp:964
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
Sends message to player(s).
Definition: main.cpp:308
void send_skill_info(socket_struct *ns, char *params)
This sends the skill number to name mapping.
Definition: requestinfo.cpp:71
#define PRINTF_ARGS(x, y)
Used for printf-like functions, mostly LOG and draw_ext_info_format.
Definition: global.h:46
void esrv_add_spells(player *pl, object *spell)
This tells the client to add the spell *spell, if spell is NULL, then add all spells in the player's ...
Definition: request.cpp:1994
void free_newsocket(socket_struct *ns)
Frees a socket.
Definition: init.cpp:418
void free_all_newserver(void)
Free's all the memory that ericserver allocates.
Definition: init.cpp:401
void esrv_del_item(player *pl, object *ob)
Tells the client to delete an item.
Definition: main.cpp:381
void map_newmap_cmd(socket_struct *ns)
Sound related function.
Definition: request.cpp:687
void esrv_new_player(player *pl, uint32_t weight)
Tells the client that here is a player it should start using.
Definition: request.cpp:1008
void send_plugin_custom_message(object *pl, char *buf)
GROS: The following one is used to allow a plugin to send a generic cmd to a player.
Definition: request.cpp:1791
void SockList_AddData(SockList *sl, const void *data, size_t len)
Adds a data block.
Definition: lowlevel.cpp:167
int is_valid_faceset(int fsn)
Checks specified faceset is valid.
Definition: image.cpp:117
void send_query(socket_struct *ns, uint8_t flags, const char *text)
Asks the client to query the user.
Definition: request.cpp:745
void send_background_music(player *pl, const char *music)
Sends background music to client.
Definition: sounds.cpp:150
short GetShort_String(const unsigned char *data)
Definition: lowlevel.cpp:258
void SockList_Term(SockList *sl)
Frees all resources allocated by a SockList instance.
Definition: lowlevel.cpp:65
void send_exp_table(socket_struct *ns)
This sends the experience table the sever is using.
void account_password(char *buf, int len, socket_struct *ns)
Handles the account password change.
Definition: request.cpp:3097
This is a game-map.
Definition: map.h:320
void init_listening_socket(socket_struct *ns)
This opens *ns for listening to connections.
Definition: init.cpp:192
void ext_info_map_except(int color, const mapstruct *map, const object *op, uint8_t type, uint8_t subtype, const char *str1)
Writes to everyone on the map except *op.
Definition: info.cpp:220
void SockList_AddString(SockList *sl, const char *data)
Adds a string without length.
Definition: lowlevel.cpp:157
void look_at(object *op, int dx, int dy)
Prints items on the specified square.
Definition: item.cpp:798
void account_new_cmd(char *buf, int len, socket_struct *ns)
Handles the account creation This function shares a fair amount of the same logic as account_login_cm...
Definition: request.cpp:2329
size_t SockList_Avail(const SockList *sl)
Returns the available bytes in a SockList instance.
Definition: lowlevel.cpp:246
void send_race_info(socket_struct *ns, char *params)
Sends information on specified race to the client.
uint32_t tag_t
Object tag, unique during the whole game.
Definition: object.h:14
void reset_stats(struct CS_Stats *stats)
void send_image_info(socket_struct *ns)
Sends the number of images, checksum of the face file, and the image_info file information.
Definition: image.cpp:113
void esrv_map_scroll(socket_struct *ns, int dx, int dy)
Definition: request.cpp:1753
void send_class_info(socket_struct *ns, char *params)
Send information on the specified class.
void set_sound_cmd(char *buf, int len, socket_struct *ns)
void set_up_cmd(char *buf, int len, socket_struct *ns)
This is the Setup cmd - easy first implementation.
Definition: request.cpp:143
static const flag_definition flags[]
Flag mapping.
void SockList_AddChar(SockList *sl, unsigned char c)
Adds an 8 bit value.
Definition: lowlevel.cpp:106
void draw_client_map(object *pl)
Draws client map.
Definition: request.cpp:1692
void toggle_extended_infos_cmd(char *buf, int len, socket_struct *ns)
void esrv_draw_look(object *pl)
Send the look window.
Definition: item.cpp:193
void send_spell_paths(socket_struct *ns)
This sends the spell path to name mapping.
void esrv_send_animation(socket_struct *ns, const Animations *anim)
Need to send an animation sequence to the client.
Definition: request.cpp:1038
void play_sound_player_only(player *pl, int8_t sound_type, object *emitter, int dir, const char *action)
Plays a sound for specified player only.
Definition: sounds.cpp:51
void esrv_send_face(socket_struct *ns, const Face *face, int nocache)
Sends a face to a client if they are in pixmap mode, nothing gets sent in bitmap mode.
Definition: image.cpp:72
void init_connection(socket_struct *ns, const char *from_ip)
Initializes a connection.
Definition: init.cpp:96
void send_tick(player *pl)
Definition: request.cpp:2048
void send_class_list(socket_struct *ns)
Sends the list of classes to the client.
void send_race_list(socket_struct *ns)
Send the list of player races to the client.
void lock_item_cmd(uint8_t *data, int len, player *pl)
Client wants to apply some object.
Definition: item.cpp:708
void write_cs_stats(void)
Statistics for the last CS_LOGTIME seconds on the server.
Definition: newclient.h:734
bool handle_client(socket_struct *ns, player *pl)
Handle commands from a client.
Definition: loop.cpp:257
void ask_smooth_cmd(char *buf, int len, socket_struct *ns)
Tells client the picture it has to use to smooth a picture number given as argument.
Definition: request.cpp:503
void SockList_AddLen8Data(SockList *sl, const void *data, size_t len)
Adds a data block prepended with an 8 bit length field.
Definition: lowlevel.cpp:179
void esrv_remove_spell(player *pl, object *spell)
Definition: request.cpp:1857
void send_file(socket_struct *ns, const char *file)
Sends the desired file to the client.
void toggle_extended_text_cmd(char *buf, int len, socket_struct *ns)
void examine_cmd(char *buf, int len, player *pl)
Client wants to examine some object.
Definition: item.cpp:646
void ext_info_map_except2(int color, const mapstruct *map, const object *op1, const object *op2, int type, int subtype, const char *str1)
Writes to everyone on the map except op1 and op2.
Definition: info.cpp:246
void apply_cmd(char *buf, int len, player *pl)
Client wants to apply some object.
Definition: item.cpp:668
void account_add_player_cmd(char *buf, int len, socket_struct *ns)
Handle accountaddplayer from server (add a character to this account).
Definition: request.cpp:2443
void esrv_send_pickup(player *pl)
Sends the "pickup" state to pl if client wants it requested.
Definition: request.cpp:1880
void watchdog(void)
void final_free_player(player *pl)
Sends the 'goodbye' command to the player, and closes connection.
Definition: init.cpp:453
void player_update_bg_music(object *player)
Definition: sounds.cpp:170
void add_me_cmd(char *buf, int len, socket_struct *ns)
The client has requested to be added to the game.
Definition: request.cpp:415
One player.
Definition: player.h:107
void set_title(const object *pl, char *buf, size_t len)
Sets player title.
Definition: info.cpp:335
void reply_cmd(char *buf, int len, player *pl)
This is a reply to a previous query.
Definition: request.cpp:589
void send_new_char_info(socket_struct *ns)
Sends information related to creating a new character to the client.
void play_sound_map(int8_t sound_type, object *emitter, int dir, const char *action)
Plays a sound on a map.
Definition: sounds.cpp:113
StringBuffer * buf
Definition: readable.cpp:1563
void SockList_AddStringBuffer(SockList *sl, StringBuffer *sb)
Deallocates string buffer instance and appends its contents.
Definition: lowlevel.cpp:225
A buffer that will be expanded as content is added to it.
int metaserver2_init(void)
This initializes the metaserver2 logic - it reads the metaserver2 file, storing the values away...
Definition: metaserver.cpp:331
void rangetostring(const object *pl, char *obuf, size_t len)
Get player's current range attack in obuf.
Definition: info.cpp:265
void esrv_update_spells(player *pl)
This looks for any spells the player may have that have changed their stats.
Definition: main.cpp:386
Contains the base information we use to make up a packet we want to send.
Definition: newclient.h:721
void SockList_AddInt64(SockList *sl, uint64_t data)
Adds a 64 bit value.
Definition: lowlevel.cpp:140
void SockList_NullTerminate(SockList *sl)
Adds a NUL byte without changing the length.
Definition: lowlevel.cpp:237
void void ext_info_map(int color, const mapstruct *map, uint8_t type, uint8_t subtype, const char *str1)
Writes to everyone on the specified map.
Definition: main.cpp:334
void esrv_update_stats(player *pl)
Sends a statistics update.
Definition: request.cpp:866
int SockList_ReadPacket(int fd, SockList *sl, int len)
This reads from fd and puts the data in sl.
Definition: lowlevel.cpp:275
void send_face_cmd(char *buff, int len, socket_struct *ns)
Client has requested pixmap that it somehow missed getting.
Definition: image.cpp:45
void move_cmd(char *buf, int len, player *pl)
Moves an object (typically, container to inventory).
Definition: request.cpp:708
void create_player_cmd(char *buf, int len, socket_struct *ns)
We have received a createplayer command.
Definition: request.cpp:2677
void Send_With_Handling(socket_struct *ns, SockList *sl)
Calls Write_To_Socket to send data to the client.
Definition: lowlevel.cpp:447
void esrv_move_object(object *pl, tag_t to, tag_t tag, long nrof)
Move an object to a new location.
Definition: item.cpp:899
void account_play_cmd(char *buf, int len, socket_struct *ns)
We have received an accountplay command.
Definition: request.cpp:2572