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

Method AddUdp6Connections

WinSysCore/ActiveConnectionTracker.cpp:239–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237}
238
239void ActiveConnectionTracker::AddUdp6Connections(PMIB_UDP6TABLE_OWNER_MODULE table, ConnectionMap& map, ConnectionVec& local, bool first) {
240 auto count = table->dwNumEntries;
241 const auto& items = table->table;
242
243 for (DWORD i = 0; i < count; i++) {
244 const auto& item = items[i];
245 std::shared_ptr<Connection> conn;
246 if (first) {
247 conn = std::make_shared<Connection>();
248 InitUdp6Connection(conn.get(), item);
249 _connections.push_back(conn);
250 _connectionMap.insert({ *conn, conn });
251 }
252 else {
253 Connection key;
254 ::memcpy(key.ucLocalAddress, item.ucLocalAddr, sizeof(item.ucLocalAddr));
255 key.LocalPort = item.dwLocalPort;
256 key.Pid = item.dwOwningPid;
257 key.Type = ConnectionType::UdpV6;
258
259 if (auto it = map.find(key); it != map.end()) {
260 conn = it->second;
261 map.erase(key);
262 }
263 else {
264 conn = std::make_shared<Connection>();
265 InitUdp6Connection(conn.get(), item);
266 _connectionMap.insert({ key, conn });
267 _newConnections.push_back(conn);
268 }
269 local.push_back(conn);
270 }
271 }
272}
273
274void WinSys::ActiveConnectionTracker::InitUdp4Connection(Connection* conn, const MIB_UDPROW_OWNER_MODULE& item) const {
275 DWORD size = 1 << 10;

Callers

nothing calls this directly

Calls 2

push_backMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected