xref: /openbmc/google-misc/nemora-postd/subprojects/ncsid/test/net_iface_mock.h (revision 7d6fa42fd19cf708de1257414bb375d5a552b722)
1 #pragma once
2 
3 #include <net_iface.h>
4 
5 #include <vector>
6 
7 namespace mock
8 {
9 
10 class IFace : public net::IFaceBase
11 {
12   public:
13     IFace() : net::IFaceBase("mock0")
14     {}
15     explicit IFace(const std::string& name) : net::IFaceBase(name)
16     {}
17     int bind_sock(int sockfd, struct sockaddr_ll* saddr) const override;
18 
19     mutable std::vector<int> bound_socks;
20     int index;
21     mutable short flags = 0;
22 
23   private:
24     int ioctl_sock(int sockfd, int request, struct ifreq* ifr) const override;
25     int ioctl(int request, struct ifreq* ifr) const override;
26 };
27 
28 } // namespace mock
29