Lukáš Karas
22b4435c81
simplify tcp flag checks, fix stream_follower ( #334 )
...
* simplify tcp flag checks, fix stream_follower
On various places was used simple comparison for checking state of flags.
tcp.flags() == (TCP::SYN | TCP::ACK)
This is not what you want usually, because this check is false
in case that another flag is set also. Correct check for syn-ack
packet should be:
(tcp.flags() & (TCP::SYN | TCP::ACK)) == (TCP::SYN | TCP::ACK)
To simplify this kind of check, add new has_flags method:
bool TCP::has_flags(small_uint<12> check_flags) const
* remove duplicate TCP::SYN flag check
2019-03-14 18:18:12 -07:00
Ed Catmur
971fdf7d1c
Ignore (possibly malformed) options after EOL ( #281 )
2018-02-03 09:33:20 -08:00
Matias Fontanini
a6817528bc
Use absolute include paths
...
Fixes #250
2017-09-21 20:48:57 -07:00
Matias Fontanini
7250c7a03d
Performance improvements
...
* Remove option size memers on IP/TCP and instead calculate
these when they're needed
* Reorder members on IP/TCP so as to remove/decrease padding
* Move most memory helpers impl into header file so they
can be inlined
* Make PDUOption's move ctor/assignment operator noexcept
2017-05-13 16:21:18 -07:00
Matias Fontanini
60b5f3e6e4
Remove inclusion of algorithm almost everywhere
2017-04-30 18:51:55 -07:00
Matias Fontanini
a20f9d3e81
Move internals' PDU helpers into their own files
2017-04-30 13:49:50 -07:00
Matias Fontanini
589adba798
Move checksum utils into their own file
2017-04-30 11:59:02 -07:00
Matias Fontanini
c06787ca22
Update license date to 2017
2017-04-29 09:56:26 -07:00
Matias Fontanini
15a353c123
Remove parent parameter from write_serialization
...
This is no longer needed as each PDU knows its parent PDU already
2017-04-29 09:53:33 -07:00
Matias Fontanini
17da10d76e
Add extract_metadata to main PDU classes
2016-02-20 22:19:12 -08:00
Matias Fontanini
fb4e5086fd
Update copyright notice
2016-01-31 20:03:49 -08:00
Matias Fontanini
d84f10cf08
Code cleanup and use same syntax on the entire project
...
Initial code cleanup
More code cleanup
Cleanup more code
Cleanup Dot11 code
Fix OSX build issue
Cleanup examples
Fix ref and pointer declaration syntax
Fix braces
2016-01-09 10:01:58 -08:00
Matias Fontanini
67d31fd62c
Fix overall checksum calculation
2015-12-29 09:57:42 -03:00
Matias Fontanini
38239be472
Remove unused cassert header inclusions
2015-12-27 04:38:31 -08:00
Matias Fontanini
02e2b278de
Add OutputMemoryStream and port most classes to use it
2015-12-26 06:30:00 -08:00
Matias Fontanini
13c05fbdb1
Add input memory stream class and port some PDUs to use it
2015-12-24 15:21:07 -08:00
Matias Fontanini
6dec68128d
Add remove_option member to IP, TCP, Dot11, ICMPv6, DHCP and DHCPv6
2015-08-17 15:19:03 -07:00
Matias Fontanini
c42cd0114f
Fix compilation warnings on Windows x64.
2015-05-17 17:30:54 -07:00
Matias Fontanini
62260ab93b
Fix more compilation warnings on Windows.
2015-04-25 18:54:43 -07:00
Matias Fontanini
c108f6e4e6
Fix compilation warnings on Windows.
2015-04-25 18:44:38 -07:00
Matias Fontanini
a326463160
Add one integer field for all flags on TCP.
2015-04-05 11:53:12 -07:00
Matias Fontanini
2dff95700f
Updated copyright notice.
2014-07-13 11:04:29 -03:00
Matias Fontanini
201ea885a1
Added method in TCP and IP that emplaces an option.
2014-06-01 12:55:36 -03:00
Matias Fontanini
112a357726
Added PDUOption::to<>. TCP options now use this method when being converted to their appropriate types.
2013-12-16 14:11:53 -03:00
Matias Fontanini
a507355e27
Added tins_cast as a replacement for dynamic_cast when using it on PDU classes.
2013-10-18 09:28:43 -03:00
Matias Fontanini
01b2a9c7b2
Modified some examples fixed some doxygen documentation.
2013-10-06 23:00:20 -03:00
Matias Fontanini
d7d2dec5cb
Done some optimizations on TCP's constructor from buffer.
2013-09-15 16:01:00 -03:00
Matias Fontanini
f385e4e975
Added a const overload of TCP::get_flag. Added TCP::flags.
2013-06-17 21:25:30 -03:00
Matias Fontanini
5064a9255b
Fixed BSD notice. Updated AUTHORS file.
2013-04-23 20:33:00 -03:00
Matias Fontanini
0f2bc45059
Moved definitions inside TINS_IS_CXX11 into header files.
2013-04-23 13:04:57 -03:00
Matias Fontanini
9be4f0ca37
Removed IP, UDP and IP checksum setters. Added some checksum tests.
2013-04-22 20:06:35 -03:00
Matias Fontanini
d1b64ec48e
PDU::matches_response is now const.
2013-04-21 20:03:47 -03:00
Matias Fontanini
69968cbc5c
Removed deprecated methods/types.
2013-04-21 19:52:39 -03:00
Matias Fontanini
3fd1b3d37d
Added malformed_packet exception. Every class except Dot11* use it.
2013-04-18 00:12:20 -03:00
Matias Fontanini
f4522acd44
IP and TCP now calculate checksums always inside write_serialization.
2013-04-11 00:57:36 -03:00
Matias Fontanini
1fbef641da
TCP options now use PDUOption<>::length_field when it is != from data_size.
2013-04-10 18:44:00 -03:00
Matias Fontanini
ae1e1c2ce2
Modified some protocols' internal type names.
2013-04-09 15:40:58 -03:00
Matias Fontanini
20054e6c73
Several classes now use PDUOption::length_field instead of data_size.
2013-04-08 11:58:12 -03:00
Matias Fontanini
b32586e739
Fixed compilation error on IP and TCP.
2013-03-25 15:17:26 -03:00
Matias Fontanini
82ef41dd92
IP now fills automatically the sender address when no link layer PDU is present. Made some protocols work when using PacketSender::send_recv.
2013-03-25 14:08:59 -03:00
Matias Fontanini
d7dd1e131f
Added an overload of add_option that takes an rvalue-ref in IP, TCP, DHCP, ICMPv6 and Dot11.
2013-03-24 00:08:53 -03:00
Matias Fontanini
584fe81f04
Optimized TCP, IP and PDUOption<>.
2013-03-23 13:44:33 -03:00
Matias Fontanini
742276c251
libtins compiles and runs under windows. Packets apparently can't be sent yet.
2012-12-02 20:25:05 -03:00
Matias Fontanini
8276e7d086
Added IPv6 class. It's working, but there's no support for extension headers yet.
2012-11-21 22:09:58 -03:00
Matias Fontanini
1c22dab2dc
libtins now uses a BSD license.
2012-10-07 20:33:45 -03:00
Matias Fontanini
153bcecc35
Removed the useless PDU::flag member. Added a PDU concatenation operator.
2012-10-07 18:51:06 -03:00
Matias Fontanini
c49fbe9929
Added a generic PDUOption class. TCP, IP, DHCP and Dot11* now use this class to store their options.
2012-09-10 00:11:54 -03:00
Matias Fontanini
83ec6e6bad
Refactored TCP's interface.
2012-09-07 11:56:36 -03:00
Matias Fontanini
832a79a1e1
Moved endianness change functions to endianness.h.
2012-09-03 23:58:43 -03:00
Matias Fontanini
958edcc74a
Added small_uint class.
2012-09-02 18:24:59 -03:00