| 212 | } |
| 213 | |
| 214 | int listConnections(std::unique_ptr<minifi::io::Socket> socket, std::ostream &out, bool show_header = true) { |
| 215 | socket->initialize(); |
| 216 | minifi::io::BufferStream stream; |
| 217 | uint8_t op = minifi::c2::Operation::DESCRIBE; |
| 218 | stream.write(&op, 1); |
| 219 | stream.write("connections"); |
| 220 | if (socket->write(const_cast<uint8_t*>(stream.getBuffer()), gsl::narrow<int>(stream.size())) < 0) { |
| 221 | return -1; |
| 222 | } |
| 223 | uint16_t responses = 0; |
| 224 | socket->read(&op, 1); |
| 225 | socket->read(responses); |
| 226 | if (show_header) |
| 227 | out << "Connection Names:" << std::endl; |
| 228 | |
| 229 | for (int i = 0; i < responses; i++) { |
| 230 | std::string name; |
| 231 | socket->read(name, false); |
| 232 | out << name << std::endl; |
| 233 | } |
| 234 | return 0; |
| 235 | } |
| 236 | |
| 237 | std::shared_ptr<core::controller::ControllerService> getControllerService(const std::shared_ptr<minifi::Configure> &configuration, const std::string &service_name) { |
| 238 | |