@@ -48,12 +48,10 @@ RecordExtTCPRTT* TCPRTTPlugin::get_ext() const
4848 return new RecordExtTCPRTT (m_pluginID);
4949}
5050
51- void TCPRTTPlugin::init ([[maybe_unused]]const char * params)
52- {
53- }
51+ void TCPRTTPlugin::init ([[maybe_unused]] const char * params) {}
5452
5553TCPRTTPlugin::TCPRTTPlugin (const TCPRTTPlugin& other) noexcept
56- : ProcessPlugin(other.m_pluginID)
54+ : ProcessPlugin(other.m_pluginID)
5755{
5856}
5957
@@ -64,45 +62,46 @@ ProcessPlugin* TCPRTTPlugin::copy()
6462
6563int TCPRTTPlugin::post_create (Flow& rec, const Packet& pkt)
6664{
67- if (m_prealloced_extension == nullptr ) {
65+ if (m_prealloced_extension == nullptr ) {
6866 m_prealloced_extension.reset (get_ext ());
6967 }
7068
71- if (pkt.ip_proto == IPPROTO_TCP) {
69+ if (pkt.ip_proto == IPPROTO_TCP) {
7270 rec.add_extension (m_prealloced_extension.release ());
73- }
71+ }
7472
75- update_tcp_rtt_record (rec, pkt);
73+ update_tcp_rtt_record (rec, pkt);
7674 return 0 ;
7775}
7876
7977int TCPRTTPlugin::pre_update (Flow& rec, Packet& pkt)
8078{
81- update_tcp_rtt_record (rec, pkt);
79+ update_tcp_rtt_record (rec, pkt);
8280 return 0 ;
8381}
8482
8583constexpr static inline bool is_tcp_syn (uint8_t tcp_flags) noexcept
8684{
87- return tcp_flags & 0b10 ;
85+ return tcp_flags & 0b10 ;
8886}
8987
9088constexpr static inline bool is_tcp_syn_ack (uint8_t tcp_flags) noexcept
9189{
92- return (tcp_flags & 0b10 ) && (tcp_flags & 0b10000 );
90+ return (tcp_flags & 0b10 ) && (tcp_flags & 0b10000 );
9391}
9492
9593void TCPRTTPlugin::update_tcp_rtt_record (Flow& rec, const Packet& pkt) noexcept
9694{
9795 auto * extension = static_cast <RecordExtTCPRTT*>(rec.get_extension (m_pluginID));
9896
9997 if (extension != nullptr && is_tcp_syn_ack (pkt.tcp_flags )) {
100- extension->tcp_synack_timestamp = pkt.ts ;
98+ extension->tcp_synack_timestamp = pkt.ts ;
10199 } else if (extension != nullptr && is_tcp_syn (pkt.tcp_flags )) {
102- extension->tcp_syn_timestamp = pkt.ts ;
103- }
100+ extension->tcp_syn_timestamp = pkt.ts ;
101+ }
104102}
105103
106- static const PluginRegistrar<TCPRTTPlugin, ProcessPluginFactory> tcpRttRegistrar (tcpRttPluginManifest);
104+ static const PluginRegistrar<TCPRTTPlugin, ProcessPluginFactory>
105+ tcpRttRegistrar (tcpRttPluginManifest);
107106
108- }
107+ } // namespace ipxp
0 commit comments