@@ -48,12 +48,10 @@ RecordExtTCPRTT* TCPRTTPlugin::get_ext() const
48
48
return new RecordExtTCPRTT (m_pluginID);
49
49
}
50
50
51
- void TCPRTTPlugin::init ([[maybe_unused]]const char * params)
52
- {
53
- }
51
+ void TCPRTTPlugin::init ([[maybe_unused]] const char * params) {}
54
52
55
53
TCPRTTPlugin::TCPRTTPlugin (const TCPRTTPlugin& other) noexcept
56
- : ProcessPlugin(other.m_pluginID)
54
+ : ProcessPlugin(other.m_pluginID)
57
55
{
58
56
}
59
57
@@ -64,45 +62,46 @@ ProcessPlugin* TCPRTTPlugin::copy()
64
62
65
63
int TCPRTTPlugin::post_create (Flow& rec, const Packet& pkt)
66
64
{
67
- if (m_prealloced_extension == nullptr ) {
65
+ if (m_prealloced_extension == nullptr ) {
68
66
m_prealloced_extension.reset (get_ext ());
69
67
}
70
68
71
- if (pkt.ip_proto == IPPROTO_TCP) {
69
+ if (pkt.ip_proto == IPPROTO_TCP) {
72
70
rec.add_extension (m_prealloced_extension.release ());
73
- }
71
+ }
74
72
75
- update_tcp_rtt_record (rec, pkt);
73
+ update_tcp_rtt_record (rec, pkt);
76
74
return 0 ;
77
75
}
78
76
79
77
int TCPRTTPlugin::pre_update (Flow& rec, Packet& pkt)
80
78
{
81
- update_tcp_rtt_record (rec, pkt);
79
+ update_tcp_rtt_record (rec, pkt);
82
80
return 0 ;
83
81
}
84
82
85
83
constexpr static inline bool is_tcp_syn (uint8_t tcp_flags) noexcept
86
84
{
87
- return tcp_flags & 0b10 ;
85
+ return tcp_flags & 0b10 ;
88
86
}
89
87
90
88
constexpr static inline bool is_tcp_syn_ack (uint8_t tcp_flags) noexcept
91
89
{
92
- return (tcp_flags & 0b10 ) && (tcp_flags & 0b10000 );
90
+ return (tcp_flags & 0b10 ) && (tcp_flags & 0b10000 );
93
91
}
94
92
95
93
void TCPRTTPlugin::update_tcp_rtt_record (Flow& rec, const Packet& pkt) noexcept
96
94
{
97
95
auto * extension = static_cast <RecordExtTCPRTT*>(rec.get_extension (m_pluginID));
98
96
99
97
if (extension != nullptr && is_tcp_syn_ack (pkt.tcp_flags )) {
100
- extension->tcp_synack_timestamp = pkt.ts ;
98
+ extension->tcp_synack_timestamp = pkt.ts ;
101
99
} 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
+ }
104
102
}
105
103
106
- static const PluginRegistrar<TCPRTTPlugin, ProcessPluginFactory> tcpRttRegistrar (tcpRttPluginManifest);
104
+ static const PluginRegistrar<TCPRTTPlugin, ProcessPluginFactory>
105
+ tcpRttRegistrar (tcpRttPluginManifest);
107
106
108
- }
107
+ } // namespace ipxp
0 commit comments