MCPcopy Create free account
hub / github.com/BeneficialCode/WinArk / AddUdp4Connections

Method AddUdp4Connections

WinSysCore/ActiveConnectionTracker.cpp:204–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202}
203
204void ActiveConnectionTracker::AddUdp4Connections(PMIB_UDPTABLE_OWNER_MODULE table, ConnectionMap& map, ConnectionVec& local, bool first) {
205 auto count = table->dwNumEntries;
206 const auto& items = table->table;
207
208 for (DWORD i = 0; i < count; i++) {
209 const auto& item = items[i];
210 std::shared_ptr<Connection> conn;
211 if (first) {
212 conn = std::make_shared<Connection>();
213 InitUdp4Connection(conn.get(), item);
214 _connections.push_back(conn);
215 _connectionMap.insert({ *conn,conn });
216 }
217 else {
218 Connection key;
219 key.LocalAddress = item.dwLocalAddr;
220 key.LocalPort = item.dwLocalPort;
221 key.Pid = item.dwOwningPid;
222 key.Type = ConnectionType::Udp;
223
224 if (auto it = map.find(key); it != map.end()) {
225 conn = it->second;
226 map.erase(key);
227 }
228 else {
229 conn = std::make_shared<Connection>();
230 InitUdp4Connection(conn.get(), item);
231 _connectionMap.insert({ key,conn });
232 _newConnections.push_back(conn);
233 }
234 local.push_back(conn);
235 }
236 }
237}
238
239void ActiveConnectionTracker::AddUdp6Connections(PMIB_UDP6TABLE_OWNER_MODULE table, ConnectionMap& map, ConnectionVec& local, bool first) {
240 auto count = table->dwNumEntries;

Callers

nothing calls this directly

Calls 2

push_backMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected