![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include "shared.h"#include "connection.h"#include "diptreaty.h"#include "effects.h"#include "events.h"#include "improvement.h"#include "player.h"#include "requirements.h"#include "spaceship.h"#include "team.h"#include "tile.h"#include "traderoutes.h"#include "unittype.h"#include "worklist.h"#include "packets_gen.h"
Include dependency graph for packets.h:Go to the source code of this file.
Classes | |
| struct | packet_handlers |
Macros | |
| #define | MAX_LEN_MSG 1536 |
| #define | MAX_LEN_ROUTE 2000 /* MAX_LEN_PACKET / 2 - header */ |
| #define | ATTRIBUTE_CHUNK_SIZE (1400) |
| #define | get_packet_from_connection(pc, ptype) get_packet_from_connection_raw(pc, ptype) |
| #define | SEND_PACKET_START(packet_type) |
| #define | SEND_PACKET_END(packet_type) |
| #define | RECEIVE_PACKET_START(packet_type, result) |
| #define | RECEIVE_PACKET_END(result) |
| #define | RECEIVE_PACKET_FIELD_ERROR(field, ...) |
Enumerations | |
| enum | report_type { REPORT_WONDERS_OF_THE_WORLD , REPORT_TOP_5_CITIES , REPORT_DEMOGRAPHIC , REPORT_ACHIEVEMENTS } |
| enum | unit_info_use { UNIT_INFO_IDENTITY , UNIT_INFO_CITY_SUPPORTED , UNIT_INFO_CITY_PRESENT } |
| enum | authentication_type { AUTH_LOGIN_FIRST , AUTH_NEWUSER_FIRST , AUTH_LOGIN_RETRY , AUTH_NEWUSER_RETRY } |
Functions | |
| void * | get_packet_from_connection_raw (struct connection *pc, enum packet_type *ptype) |
| Read and return a packet from the connection 'pc'. More... | |
| void | remove_packet_from_buffer (struct socket_packet_buffer *buffer) |
| Remove the packet from the buffer. More... | |
| void | send_attribute_block (const struct player *pplayer, struct connection *pconn) |
| Split the attribute block into chunks and send them over pconn. More... | |
| void | generic_handle_player_attribute_chunk (struct player *pplayer, const struct packet_player_attribute_chunk *chunk) |
| Updates pplayer->attribute_block according to the given packet. More... | |
| void | packet_handlers_fill_initial (struct packet_handlers *phandlers) |
| void | packet_handlers_fill_capability (struct packet_handlers *phandlers, const char *capability) |
| const char * | packet_name (enum packet_type type) |
| bool | packet_has_game_info_flag (enum packet_type type) |
| void | packet_header_init (struct packet_header *packet_header) |
| Set the packet header field lengths used for the login protocol, before the capability of the connection could be checked. More... | |
| void | post_send_packet_server_join_reply (struct connection *pconn, const struct packet_server_join_reply *packet) |
| Modify if needed the packet header field lengths. More... | |
| void | post_receive_packet_server_join_reply (struct connection *pconn, const struct packet_server_join_reply *packet) |
| Modify if needed the packet header field lengths. More... | |
| void | pre_send_packet_player_attribute_chunk (struct connection *pc, struct packet_player_attribute_chunk *packet) |
| Test and log for sending player attribute_block. More... | |
| const struct packet_handlers * | packet_handlers_initial () |
| Returns the packet handlers variant with no special capability. More... | |
| const struct packet_handlers * | packet_handlers_get (const char *capability) |
| Returns the packet handlers variant for 'capability'. More... | |
| void | packets_deinit () |
| Call when there is no longer a requirement for protocol processing. More... | |
| int | send_packet_data (struct connection *pc, unsigned char *data, int len, enum packet_type packet_type) |
| It returns the request id of the outgoing packet (or 0 if is_server()). More... | |
| bool | packet_check (struct data_in *din, struct connection *pc) |
| Sanity check packet. More... | |
| void | packet_strvec_compute (char str[MAX_LEN_PACKET], QVector< QString > *qstrvec) |
| QVector< QString > * | packet_strvec_extract (const char *str) |
| void | qstrvec_from_str (QVector< QString > *, char separator, const char *str) |
| Build the string vector from a string until 'str_size' bytes are read. More... | |
| #define get_packet_from_connection | ( | pc, | |
| ptype | |||
| ) | get_packet_from_connection_raw(pc, ptype) |
| #define MAX_LEN_ROUTE 2000 /* MAX_LEN_PACKET / 2 - header */ |
| #define RECEIVE_PACKET_END | ( | result | ) |
| #define RECEIVE_PACKET_FIELD_ERROR | ( | field, | |
| ... | |||
| ) |
| #define RECEIVE_PACKET_START | ( | packet_type, | |
| result | |||
| ) |
| #define SEND_PACKET_END | ( | packet_type | ) |
| #define SEND_PACKET_START | ( | packet_type | ) |
| enum authentication_type |
| enum report_type |
| enum unit_info_use |
| void generic_handle_player_attribute_chunk | ( | struct player * | pplayer, |
| const struct packet_player_attribute_chunk * | chunk | ||
| ) |
Updates pplayer->attribute_block according to the given packet.
Definition at line 639 of file packets.cpp.
Referenced by handle_player_attribute_chunk().
| void* get_packet_from_connection_raw | ( | struct connection * | pc, |
| enum packet_type * | ptype | ||
| ) |
Read and return a packet from the connection 'pc'.
The type of the packet is written in 'ptype'. On error, the connection is closed and the function returns nullptr.
Definition at line 329 of file packets.cpp.
| bool packet_check | ( | struct data_in * | din, |
| struct connection * | pc | ||
| ) |
Sanity check packet.
Definition at line 617 of file packets.cpp.
| void packet_handlers_fill_capability | ( | struct packet_handlers * | phandlers, |
| const char * | capability | ||
| ) |
Referenced by packet_handlers_get().
| void packet_handlers_fill_initial | ( | struct packet_handlers * | phandlers | ) |
Referenced by packet_handlers_initial().
| const struct packet_handlers* packet_handlers_get | ( | const char * | capability | ) |
Returns the packet handlers variant for 'capability'.
Definition at line 766 of file packets.cpp.
Referenced by conn_set_capability().
| const struct packet_handlers* packet_handlers_initial | ( | ) |
Returns the packet handlers variant with no special capability.
Definition at line 749 of file packets.cpp.
Referenced by init_packet_hashs(), and packet_handlers_get().
| bool packet_has_game_info_flag | ( | enum packet_type | type | ) |
Referenced by conn_reset_delta_state().
| void packet_header_init | ( | struct packet_header * | packet_header | ) |
Set the packet header field lengths used for the login protocol, before the capability of the connection could be checked.
NB: These values cannot be changed for backward compatibility reasons.
Definition at line 572 of file packets.cpp.
Referenced by connection_common_init().
| const char* packet_name | ( | enum packet_type | type | ) |
Referenced by client_packet_input(), get_packet_from_connection_raw(), send_packet_data(), and server_packet_input().
| void packet_strvec_compute | ( | char | str[MAX_LEN_PACKET], |
| QVector< QString > * | qstrvec | ||
| ) |
Definition at line 806 of file packets.cpp.
Referenced by send_ruleset_buildings(), send_ruleset_extras(), send_ruleset_goods(), send_ruleset_governments(), send_ruleset_multipliers(), send_ruleset_specialists(), send_ruleset_techs(), send_ruleset_terrain(), send_ruleset_unit_classes(), and send_ruleset_units().
| QVector<QString>* packet_strvec_extract | ( | const char * | str | ) |
Definition at line 819 of file packets.cpp.
Referenced by handle_ruleset_building(), handle_ruleset_extra(), handle_ruleset_goods(), handle_ruleset_government(), handle_ruleset_multiplier(), handle_ruleset_specialist(), handle_ruleset_tech(), handle_ruleset_terrain(), handle_ruleset_unit(), and handle_ruleset_unit_class().
| void packets_deinit | ( | ) |
Call when there is no longer a requirement for protocol processing.
All connections must have been closed.
Definition at line 804 of file packets.cpp.
Referenced by at_exit(), and close_connections_and_socket().
| void post_receive_packet_server_join_reply | ( | struct connection * | pconn, |
| const struct packet_server_join_reply * | packet | ||
| ) |
Modify if needed the packet header field lengths.
Definition at line 606 of file packets.cpp.
| void post_send_packet_server_join_reply | ( | struct connection * | pconn, |
| const struct packet_server_join_reply * | packet | ||
| ) |
Modify if needed the packet header field lengths.
Definition at line 595 of file packets.cpp.
| void pre_send_packet_player_attribute_chunk | ( | struct connection * | pc, |
| struct packet_player_attribute_chunk * | packet | ||
| ) |
Test and log for sending player attribute_block.
Definition at line 725 of file packets.cpp.
| void qstrvec_from_str | ( | QVector< QString > * | psv, |
| char | separator, | ||
| const char * | str | ||
| ) |
Build the string vector from a string until 'str_size' bytes are read.
Passing -1 for 'str_size' will assume 'str' as the expected format. Note it's a bit dangerous.
This string format is a list of strings separated by 'separator'.
See also strvec_to_str().
Definition at line 838 of file packets.cpp.
Referenced by packet_strvec_extract().
| void remove_packet_from_buffer | ( | struct socket_packet_buffer * | buffer | ) |
Remove the packet from the buffer.
Definition at line 553 of file packets.cpp.
| void send_attribute_block | ( | const struct player * | pplayer, |
| struct connection * | pconn | ||
| ) |
Split the attribute block into chunks and send them over pconn.
Definition at line 681 of file packets.cpp.
Referenced by attribute_flush(), handle_player_attribute_block(), and send_all_info().
| int send_packet_data | ( | struct connection * | pc, |
| unsigned char * | data, | ||
| int | len, | ||
| enum packet_type | packet_type | ||
| ) |
It returns the request id of the outgoing packet (or 0 if is_server()).
Definition at line 176 of file packets.cpp.