Crossfire Server, Trunk  R20513
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, uint16_t face_num, 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, ...);
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);
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);
43 void watchdog(void);
44 void do_server(void);
45 /* lowlevel.c */
46 void SockList_Init(SockList *sl);
47 void SockList_Term(SockList *sl);
48 void SockList_Reset(SockList *sl);
50 void SockList_AddChar(SockList *sl, char c);
51 void SockList_AddShort(SockList *sl, uint16_t data);
52 void SockList_AddInt(SockList *sl, uint32_t data);
53 void SockList_AddInt64(SockList *sl, uint64_t data);
54 size_t SockList_Avail(const SockList *sl);
55 void SockList_AddString(SockList *sl, const char *data);
56 void SockList_AddData(SockList *sl, const void *data, size_t len);
57 void SockList_AddLen8Data(SockList *sl, const void *data, size_t len);
58 void SockList_AddLen16Data(SockList *sl, const void *data, size_t len);
59 void SockList_AddPrintf(SockList *sl, const char *format, ...);
62 int GetInt_String(const unsigned char *data);
63 short GetShort_String(const unsigned char *data);
64 int SockList_ReadPacket(int fd, SockList *sl, int len);
67 void write_cs_stats(void);
68 /* metaserver.c */
69 void metaserver_init(void);
70 void metaserver_update(void);
71 int metaserver2_init(void);
72 void *metaserver2_thread(void *junk);
73 /* request.c */
74 void set_up_cmd(char *buf, int len, socket_struct *ns);
75 void add_me_cmd(char *buf, int len, socket_struct *ns);
76 void toggle_extended_infos_cmd(char *buf, int len, socket_struct *ns);
77 void toggle_extended_text_cmd(char *buf, int len, socket_struct *ns);
78 void ask_smooth_cmd(char *buf, int len, socket_struct *ns);
79 void new_player_cmd(uint8_t *buf, int len, player *pl);
80 void reply_cmd(char *buf, int len, player *pl);
81 void version_cmd(char *buf, int len, socket_struct *ns);
82 void set_sound_cmd(char *buf, int len, socket_struct *ns);
84 void move_cmd(char *buf, int len, player *pl);
85 void send_query(socket_struct *ns, uint8_t flags, const char *text);
87 void esrv_new_player(player *pl, uint32_t weight);
88 void esrv_send_animation(socket_struct *ns, short anim_num);
89 void draw_client_map2(object *pl);
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);
93 void send_exp_table(socket_struct *ns, char *params);
94 void send_skill_info(socket_struct *ns, char *params);
95 void send_spell_paths(socket_struct *ns, char *params);
96 void send_race_list(socket_struct *ns, char *params);
97 void send_race_info(socket_struct *ns, char *params);
98 void send_class_list(socket_struct *ns, char *params);
99 void send_class_info(socket_struct *ns, char *params);
101 void esrv_remove_spell(player *pl, object *spell);
102 void esrv_send_pickup(player *pl);
103 void esrv_add_spells(player *pl, object *spell);
104 void send_tick(player *pl);
105 void send_file(socket_struct *ns, const char *file);
106 void account_login_cmd(char *buf, int len, socket_struct *ns);
107 void account_new_cmd(char *buf, int len, socket_struct *ns);
108 void account_add_player_cmd(char *buf, int len, socket_struct *ns);
109 void account_play_cmd(char *buf, int len, socket_struct *ns);
111 void create_player_cmd(char *buf, int len, socket_struct *ns);
112 void account_password(char *buf, int len, socket_struct *ns);
113 /* requestinfo.c */
115 void send_map_info(socket_struct *ns);
116 /* sounds.c */
117 void play_sound_player_only(player *pl, int8_t sound_type, object *emitter, int dir, const char *action);
118 void play_sound_map(int8_t sound_type, object *emitter, int dir, const char *action);
119 void send_background_music(player *pl, const char *music);
120 void player_update_bg_music(object player[static 1]);
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)
Sends message to player(s).
Definition: main.c:315
void SockList_AddPrintf(SockList *sl, const char *format,...)
Adds a printf like formatted string.
Definition: lowlevel.c:194
One player.
Definition: player.h:92
void do_server(void)
This checks the sockets for input and exceptions, does the right thing.
Definition: loop.c:501
void SockList_Reset(SockList *sl)
Resets the length of the stored data for writing.
Definition: lowlevel.c:66
void esrv_send_face(socket_struct *ns, uint16_t face_num, int nocache)
Sends a face to a client if they are in pixmap mode, nothing gets sent in bitmap mode.
Definition: image.c:70
void * metaserver2_thread(void *junk)
metserver2_thread is the function called from pthread_create.
Definition: metaserver.c:503
void SockList_Init(SockList *sl)
Initializes the SockList instance.
Definition: lowlevel.c:48
void esrv_send_item(object *pl, object *op)
Sends item's info to player.
Definition: main.c:339
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.c:2037
unsigned char uint8_t
Definition: win32.h:161
void request_info_cmd(char *buf, int len, socket_struct *ns)
request_info_cmd is sort of a meta command.
Definition: loop.c:133
void SockList_ResetRead(SockList *sl)
Resets the length of the stored data for reading.
Definition: lowlevel.c:75
int GetInt_String(const unsigned char *data)
Basically does the reverse of SockList_AddInt, but on strings instead.
Definition: lowlevel.c:246
void mark_item_cmd(uint8_t *data, int len, player *pl)
Client wants to mark some object.
Definition: item.c:723
void look_at_cmd(char *buf, int len, player *pl)
Client wants to look at some object.
Definition: item.c:819
void version_cmd(char *buf, int len, socket_struct *ns)
Client tells its version.
Definition: request.c:581
void metaserver_update(void)
Updates our info in the metaserver Note that this is used for both metaserver1 and metaserver2 - for ...
Definition: metaserver.c:49
void esrv_send_animation(socket_struct *ns, short anim_num)
Need to send an animation sequence to the client.
Definition: request.c:883
void player_update_bg_music(object player[static 1])
Definition: sounds.c:152
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.c:49
void esrv_update_item(int flags, object *pl, object *op)
Updates object *op for player *pl.
Definition: main.c:342
void magic_mapping_mark(object *pl, char *map_mark, int strength)
Creates magic map for player.
Definition: info.c:393
void send_map_info(socket_struct *ns)
Send information on the specified class.
Definition: requestinfo.c:404
void send_image_sums(socket_struct *ns, char *params)
Sends requested face information.
Definition: image.c:139
void init_server(void)
This sets up the socket and reads all the image information into memory.
Definition: init.c:262
void SockList_AddShort(SockList *sl, uint16_t data)
Adds a 16 bit value.
Definition: lowlevel.c:108
Socket structure, represents a client-server connection.
Definition: newserver.h:99
void SockList_AddLen16Data(SockList *sl, const void *data, size_t len)
Adds a data block prepended with an 16 bit length field.
Definition: lowlevel.c:183
void esrv_send_inventory(object *pl, object *op)
Sends inventory of a container.
Definition: item.c:307
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.c:1861
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.c:447
void SockList_AddInt(SockList *sl, uint32_t data)
Adds a 32 bit value.
Definition: lowlevel.c:119
void handle_client(socket_struct *ns, player *pl)
Handle commands from a client.
Definition: loop.c:234
void draw_magic_map(object *pl)
Creates and sends magic map to player.
Definition: info.c:440
void inscribe_scroll_cmd(char *buf, int len, player *pl)
Definition: item.c:908
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.c:310
void send_skill_info(socket_struct *ns, char *params)
This sends the skill number to name mapping.
Definition: requestinfo.c:67
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.c:1738
void send_class_list(socket_struct *ns, char *params)
Sends the list of classes to the client.
Definition: requestinfo.c:359
void free_newsocket(socket_struct *ns)
Frees a socket.
Definition: init.c:413
void free_all_newserver(void)
Free's all the memory that ericserver allocates.
Definition: init.c:395
void esrv_del_item(player *pl, object *ob)
Tells the client to delete an item.
Definition: main.c:355
void map_newmap_cmd(socket_struct *ns)
Sound related function.
Definition: request.c:615
void esrv_new_player(player *pl, uint32_t weight)
Tells the client that here is a player it should start using.
Definition: request.c:856
void draw_client_map2(object *pl)
Definition: request.c:1250
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.c:1537
void SockList_AddData(SockList *sl, const void *data, size_t len)
Adds a data block.
Definition: lowlevel.c:159
int is_valid_faceset(int fsn)
Checks specified faceset is valid.
Definition: image.c:563
void send_query(socket_struct *ns, uint8_t flags, const char *text)
Asks the client to query the user.
Definition: request.c:674
void send_exp_table(socket_struct *ns, char *params)
This sends the experience table the sever is using.
Definition: requestinfo.c:121
void send_background_music(player *pl, const char *music)
Sends background music to client.
Definition: sounds.c:132
short GetShort_String(const unsigned char *data)
Definition: lowlevel.c:250
void SockList_Term(SockList *sl)
Frees all resources allocated by a SockList instance.
Definition: lowlevel.c:58
void account_password(char *buf, int len, socket_struct *ns)
Handles the account password change.
Definition: request.c:2862
void write_socket_buffer(socket_struct *ns)
Writes data to socket.
Definition: lowlevel.c:424
void init_listening_socket(socket_struct *ns)
This opens *ns for listening to connections.
Definition: init.c:171
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.c:185
void SockList_AddString(SockList *sl, const char *data)
Adds a string without length.
Definition: lowlevel.c:149
void look_at(object *op, int dx, int dy)
Prints items on the specified square.
Definition: item.c:754
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.c:2163
size_t SockList_Avail(const SockList *sl)
Returns the available bytes in a SockList instance.
Definition: lowlevel.c:238
void send_race_info(socket_struct *ns, char *params)
Sends information on specified race to the client.
Definition: requestinfo.c:313
uint32_t tag_t
Object tag, unique during the whole game.
Definition: object.h:12
unsigned __int64 uint64_t
Definition: win32.h:167
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.c:112
void esrv_map_scroll(socket_struct *ns, int dx, int dy)
Definition: request.c:1499
void send_class_info(socket_struct *ns, char *params)
Send information on the specified class.
Definition: requestinfo.c:380
unsigned short uint16_t
Definition: win32.h:163
void set_sound_cmd(char *buf, int len, socket_struct *ns)
void SockList_AddChar(SockList *sl, char c)
Adds an 8 bit value.
Definition: lowlevel.c:98
void set_up_cmd(char *buf, int len, socket_struct *ns)
This is the Setup cmd - easy first implementation.
Definition: request.c:93
static const flag_definition flags[]
Flag mapping.
void draw_client_map(object *pl)
Draws client map.
Definition: request.c:1438
unsigned int uint32_t
Definition: win32.h:162
void toggle_extended_infos_cmd(char *buf, int len, socket_struct *ns)
void esrv_draw_look(object *pl)
Send the look window.
Definition: item.c:187
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.c:51
void init_connection(socket_struct *ns, const char *from_ip)
Initializes a connection.
Definition: init.c:63
signed char int8_t
Type definitions for fixed-size integer types.
Definition: win32.h:158
void send_tick(player *pl)
Definition: request.c:1797
void send_spell_paths(socket_struct *ns, char *params)
This sends the spell path to name mapping.
Definition: requestinfo.c:97
void lock_item_cmd(uint8_t *data, int len, player *pl)
Client wants to apply some object.
Definition: item.c:671
void write_cs_stats(void)
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.c:423
void SockList_AddLen8Data(SockList *sl, const void *data, size_t len)
Adds a data block prepended with an 8 bit length field.
Definition: lowlevel.c:171
void esrv_remove_spell(player *pl, object *spell)
Definition: request.c:1603
void send_file(socket_struct *ns, const char *file)
Sends the desired file to the client.
Definition: requestinfo.c:443
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.c:612
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.c:211
void apply_cmd(char *buf, int len, player *pl)
Client wants to apply some object.
Definition: item.c:631
void account_add_player_cmd(char *buf, int len, socket_struct *ns)
Handle accountaddplayer from server (add a character to this account).
Definition: request.c:2271
void esrv_send_pickup(player *pl)
Sends the "pickup" state to pl if client wants it requested.
Definition: request.c:1625
void watchdog(void)
void final_free_player(player *pl)
Sends the 'goodbye' command to the player, and closes connection.
Definition: init.c:444
void add_me_cmd(char *buf, int len, socket_struct *ns)
The client has requested to be added to the game.
Definition: request.c:347
void set_title(const object *pl, char *buf, size_t len)
Sets player title.
Definition: info.c:300
void send_race_list(socket_struct *ns, char *params)
Send the list of player races to the client.
Definition: requestinfo.c:292
void reply_cmd(char *buf, int len, player *pl)
This is a reply to a previous query.
Definition: request.c:509
void send_new_char_info(socket_struct *ns)
Sends information related to creating a new character to the client.
Definition: requestinfo.c:484
void metaserver_init(void)
void play_sound_map(int8_t sound_type, object *emitter, int dir, const char *action)
Plays a sound on a map.
Definition: sounds.c:101
void SockList_AddStringBuffer(SockList *sl, StringBuffer *sb)
Deallocates string buffer instance and appends its contents.
Definition: lowlevel.c:217
A buffer that will be expanded as content is added to it.
Definition: stringbuffer.c:25
int metaserver2_init(void)
This initializes the metaserver2 logic - it reads the metaserver2 file, storing the values away...
Definition: metaserver.c:163
void rangetostring(const object *pl, char *obuf, size_t len)
Get player's current range attack in obuf.
Definition: info.c:230
void esrv_update_spells(player *pl)
This looks for any spells the player may have that have changed their stats.
Definition: main.c:358
Contains the base information we use to make up a packet we want to send.
Definition: newclient.h:680
void SockList_AddInt64(SockList *sl, uint64_t data)
Adds a 64 bit value.
Definition: lowlevel.c:132
This is a game-map.
Definition: map.h:325
void SockList_NullTerminate(SockList *sl)
Adds a NUL byte without changing the length.
Definition: lowlevel.c:229
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.c:325
void esrv_update_stats(player *pl)
Sends a statistics update.
Definition: request.c:725
int SockList_ReadPacket(int fd, SockList *sl, int len)
This reads from fd and puts the data in sl.
Definition: lowlevel.c:267
void send_face_cmd(char *buff, int len, socket_struct *ns)
Client has requested pixmap that it somehow missed getting.
Definition: image.c:43
void move_cmd(char *buf, int len, player *pl)
Moves an object (typically, container to inventory).
Definition: request.c:636
void create_player_cmd(char *buf, int len, socket_struct *ns)
We have received a createplayer command.
Definition: request.c:2487
void Send_With_Handling(socket_struct *ns, SockList *sl)
Calls Write_To_Socket to send data to the client.
Definition: lowlevel.c:542
void esrv_move_object(object *pl, tag_t to, tag_t tag, long nrof)
Move an object to a new location.
Definition: item.c:843
void account_play_cmd(char *buf, int len, socket_struct *ns)
We have received an accountplay command.
Definition: request.c:2400