Commit Graph

17 Commits (85511a642f851100d0d856f4ecbe7fea7a7bb049)

Author SHA1 Message Date
Loïc Blot 85511a642f Cleanup various headers to reduce compilation times (#6255)
* Cleanup various headers to reduce compilation times
2017-08-16 22:11:45 +02:00
Loïc Blot 7ddf67aa14 Chat protocol rewrite (#5117)
* New TOCLIENT_CHAT_MESSAGE packet

* Rename old packet to TOCLIENT_CHAT_MESSAGE_OLD for compat
* Handle TOCLIENT_CHAT_MESSAGE new structure client side
* Client chat queue should use a specific object
* SendChatMessage: use the right packet depending on protocol version (not complete yet)
* Add chatmessage(type) objects and handle them client side (partially)
* Use ChatMessage instead of std::wstring server side

* Update with timestamp support
2017-07-16 10:47:31 +02:00
Vincent Glize 8daf5b5338 C++11 cleanup on constructors dir network (#6021)
* C++11 cleanup on constructors dir network
2017-06-21 08:28:57 +02:00
Loic Blot b1e6c2a9b8
NetworkPacket: don't copy push std::string and std::wstring 2017-04-14 18:26:24 +02:00
sfan5 7279f0b373 Add particle animation, glow
This is implemented by reusing and extending the
TileAnimation code for the methods used by particles.
2017-01-18 23:21:01 +01:00
gregorycu e7e9171f37 Fix for commit 87dcee6 It uses the wrong variable and only covers some use cases. This change covers all use cases. 2016-01-04 07:50:39 +01:00
gregorycu 87dcee6ac2 Prevent technically unsafe access with empty vector 2016-01-03 15:37:49 +01:00
kwolekr 1c408c4f1d Make NetworkPacket respect serialized string size limits 2015-08-10 02:16:55 -04:00
kwolekr bd0b469d3d Fix critical vulnerabilities and bugs with NetworkPacket 2015-08-06 00:10:57 -04:00
Jay Arndt 2923eafaca Stop NetworkPacket methods from producing bloated packets 2015-05-05 01:47:41 +02:00
Loic Blot aa340fd857 Create PacketError exception and use it with ACTIVEOBJECT_REMOVE_ADD handler which can be unreliable 2015-04-03 08:53:31 +02:00
Loic Blot 113bdd3ec0 NetworkPacket: reading outside packet is now clearer.
Use a common function to check the reading offset
2015-04-01 14:47:46 +02:00
Loic Blot 1fe4256462 Connection::Receive(): receive Network Packet instead of SharedBuffer<u8>.
Because we get a Buffer<u8> from ConnectionEvent, don't convert it to SharedBuffer<u8> and return it to Server/Client::Receive which will convert it to NetworkPacket
Instead, put the Buffer<u8> directly to NetworkPacket and return it to packet processing
This remove a long existing memory copy
Also check the packet size directly into Connection::Receive instead of packet processing
2015-03-31 11:01:08 +02:00
Loic Blot 6a48844eba Use Buffer not SharedBuffer in NetworkPacket::oldForgePacket 2015-03-30 19:55:14 +02:00
Loic Blot 61f2d0ca34 Remove unused ConnectionCommand::sendToAll function. NetworkPacket::oldForgePacket returns Buffer instead of SharedBuffer and is used in ConnectionCommand instead of Connection::Send
This remove the NetworkPacket buffer => SharedBuffer => Buffer copy. Now NetworkPacket => Buffer
2015-03-22 12:18:16 +01:00
Loic Blot ed04e8e9e4 [Patch 2/4] Network rework: packet writing, sending and cleanups
NetworkPacket.cpp:
* Remove some deprecated functions, we must use streaming interface
* m_data converted from u8* to std::vector<u8>
* Add an exporter to forge packet to Connection object
* implement operator << std::wstring. n
* implement operator << std::string
* dynamic resize when write packet content.
* fix string writing and performances.
* create ServerCommandFactory, used by client to get useful informations about packet processing (sending).
  * Reliability
  * Transmit channel
* Implement putRawString for some ugly char (_INIT packet), and use it.
* Many packet read and write migrated
* Implement oldForgePacket to interface writing with current connection
* fix U8/char/bool writing
* fix string writing and performances.
* add some missing functions
* Use v3s16 read instead of reading x,y,z separately
* Add irr::video::SColor support into packets
* Add some missing handlers
* Add a template function to increase offset
* Throw a serialization error on packet reading (must be improved)

PacketFactories:
* Create ServerCommandFactory, used by client to get useful informations about packet processing (sending).
* Create ClientCommandFactory, used by server to get useful informations about packet processing (sending).

Client.cpp:
* implement NetworkPacket ::Send interface.
* Move packet handlers to a dedicated file
* Remove Client::Send(SharedBuffer)

Server.cpp:
* implement NetworkPacket ::Send interface.
* Rewrite all packets using NetworkPacket
* Move packet handlers to a dedicated file
* Remove Server::Send(SharedBuffer)

ClientIface.cpp:
* Remove sendToAll(SharedBuffer<u8>)

Connection.hpp rework:
* Remove duplicate include
* Remove duplicate negation
* Remove a useless variable
* Improve code performance by using a m_peers_list instead of scanning m_peers map
* Remove Connection::Send(SharedBuffer)
* Fix useafterfree into NetworkPacket Sending
* Remove unused Connection::sendToAll

Test.cpp:
* Remove dead code
* Update tests to use NetworkPackets

Misc:
* add new wrappers to Send packets in client, using NetworkPacket
* Add NetworkPacket methods for Connection
* coding style fix
* dead code since changes cleanup
* Use v3s16 read instead of reading x,y,z separately in some packets
* Use different files to handle packets received by client and server
* Cleanup: Remove useless includes

ok @Zeno-
Tested by @Zeno- @VanessaE and @nerzhul on running servers
2015-02-16 11:00:55 +01:00
Loic Blot a704c04f00 Network Layer 7 rework (Packet handling)
* Move networkcode to a dedicated directory
* Rename clientserver.h to network/networkprotocol.h (Better name) and sanitize some includes
* Create object NetworkPacket
  * It stores command (opcode) and data separated
  * It also stores peer_id
  * Data reading can be done by using a streaming interface
* Change packet routing analysis
  * Remove old conditional analysis
  * Now uses function pointed analysis and add connection state ({Client,Server}::handlers)
  * Connection state permit to categorize condition to handle before analyze packets
  * Create a handler for depreciated messages, instead of duplicating code
2015-02-10 20:04:08 +10:00