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

Method AddTcp6Connections

WinSysCore/ActiveConnectionTracker.cpp:166–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166void ActiveConnectionTracker::AddTcp6Connections(PMIB_TCP6TABLE_OWNER_MODULE table, ConnectionMap& map, ConnectionVec& local, bool first) {
167 auto count = table->dwNumEntries;
168 const auto& items = table->table;
169
170 for (DWORD i = 0; i < count; i++) {
171 const auto& item = items[i];
172 std::shared_ptr<Connection> conn;
173 if (first) {
174 conn = std::make_shared<Connection>();
175 InitTcp6Connection(conn.get(), item);
176 _connections.push_back(conn);
177 _connectionMap.insert({ *conn,conn });
178 }
179 else {
180 Connection key;
181 key.LocalPort = item.dwLocalPort;
182 ::memcpy(key.ucLocalAddress, item.ucLocalAddr, sizeof(key.ucLocalAddress));
183 ::memcpy(key.ucRemoteAddress, item.ucRemoteAddr, sizeof(key.ucRemoteAddress));
184 key.RemotePort = item.dwOwningPid;
185 key.Pid = item.dwOwningPid;
186 key.Type = ConnectionType::TcpV6;
187
188 if (auto it = map.find(key); it != map.end()) {
189 conn = it->second;
190 map.erase(key);
191 }
192 else {
193 conn = std::make_shared<Connection>();
194 InitTcp6Connection(conn.get(), item);
195 _connectionMap.insert({ *conn,conn });
196 _newConnections.push_back(conn);
197 }
198 conn->State = (MIB_TCP_STATE)item.dwState;
199 local.push_back(conn);
200 }
201 }
202}
203
204void ActiveConnectionTracker::AddUdp4Connections(PMIB_UDPTABLE_OWNER_MODULE table, ConnectionMap& map, ConnectionVec& local, bool first) {
205 auto count = table->dwNumEntries;

Callers

nothing calls this directly

Calls 2

push_backMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected