| 188 | } |
| 189 | |
| 190 | int listComponents(std::unique_ptr<minifi::io::Socket> socket, std::ostream &out, bool show_header = true) { |
| 191 | socket->initialize(); |
| 192 | minifi::io::BufferStream stream; |
| 193 | uint8_t op = minifi::c2::Operation::DESCRIBE; |
| 194 | stream.write(&op, 1); |
| 195 | stream.write("components"); |
| 196 | if (socket->write(const_cast<uint8_t*>(stream.getBuffer()), gsl::narrow<int>(stream.size())) < 0) { |
| 197 | return -1; |
| 198 | } |
| 199 | uint16_t responses = 0; |
| 200 | socket->read(&op, 1); |
| 201 | socket->read(responses); |
| 202 | if (show_header) |
| 203 | out << "Components:" << std::endl; |
| 204 | |
| 205 | for (int i = 0; i < responses; i++) { |
| 206 | std::string name, status; |
| 207 | socket->read(name, false); |
| 208 | socket->read(status, false); |
| 209 | out << name << ", running: " << status << std::endl; |
| 210 | } |
| 211 | return 0; |
| 212 | } |
| 213 | |
| 214 | int listConnections(std::unique_ptr<minifi::io::Socket> socket, std::ostream &out, bool show_header = true) { |
| 215 | socket->initialize(); |
no test coverage detected