| 1 | // Copyright (C) Microsoft Corporation. All rights reserved. |
| 2 | #pragma once |
| 3 | |
| 4 | #include <functional> |
| 5 | #include <sys/types.h> |
| 6 | #include "Fwd.h" |
| 7 | |
| 8 | class NetlinkTransaction |
| 9 | { |
| 10 | public: |
| 11 | NetlinkTransaction(NetlinkChannel& channel, std::vector<char>&& request, __u32 seq); |
| 12 | |
| 13 | void Execute(const std::function<void(const NetlinkResponse&)>& routine = [](const auto&) {}); |
| 14 | |
| 15 | // Useful for debugging how netlink requests are composed |
| 16 | void PrintRequest() const; |
| 17 | std::string GetRawRequestString() const; |
| 18 | |
| 19 | private: |
| 20 | NetlinkChannel& m_channel; |
| 21 | std::vector<char> m_request; |
| 22 | __u32 m_seq; |
| 23 | }; |