11285115cSWilliam A. Kennington III /*
21285115cSWilliam A. Kennington III  * Copyright 2021 Google LLC
31285115cSWilliam A. Kennington III  *
41285115cSWilliam A. Kennington III  * Licensed under the Apache License, Version 2.0 (the "License");
51285115cSWilliam A. Kennington III  * you may not use this file except in compliance with the License.
61285115cSWilliam A. Kennington III  * You may obtain a copy of the License at
71285115cSWilliam A. Kennington III  *
81285115cSWilliam A. Kennington III  *      http://www.apache.org/licenses/LICENSE-2.0
91285115cSWilliam A. Kennington III  *
101285115cSWilliam A. Kennington III  * Unless required by applicable law or agreed to in writing, software
111285115cSWilliam A. Kennington III  * distributed under the License is distributed on an "AS IS" BASIS,
121285115cSWilliam A. Kennington III  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
131285115cSWilliam A. Kennington III  * See the License for the specific language governing permissions and
141285115cSWilliam A. Kennington III  * limitations under the License.
151285115cSWilliam A. Kennington III  */
161285115cSWilliam A. Kennington III 
171285115cSWilliam A. Kennington III #pragma once
181285115cSWilliam A. Kennington III 
191285115cSWilliam A. Kennington III #include <net_iface.h>
201285115cSWilliam A. Kennington III 
21adb8ffe4SWilly Tu #include <string>
221285115cSWilliam A. Kennington III #include <vector>
231285115cSWilliam A. Kennington III 
241285115cSWilliam A. Kennington III namespace mock
251285115cSWilliam A. Kennington III {
261285115cSWilliam A. Kennington III 
271285115cSWilliam A. Kennington III class IFace : public net::IFaceBase
281285115cSWilliam A. Kennington III {
291285115cSWilliam A. Kennington III   public:
302be45238SPatrick Williams     IFace() : net::IFaceBase("mock0") {}
312be45238SPatrick Williams     explicit IFace(const std::string& name) : net::IFaceBase(name) {}
32*a9a98258SWilly Tu     int bind_sock(int sockfd) const override;
331285115cSWilliam A. Kennington III 
341285115cSWilliam A. Kennington III     mutable std::vector<int> bound_socks;
351285115cSWilliam A. Kennington III     int index;
361285115cSWilliam A. Kennington III     mutable short flags = 0;
371285115cSWilliam A. Kennington III 
381285115cSWilliam A. Kennington III   private:
391285115cSWilliam A. Kennington III     int ioctl_sock(int sockfd, int request, struct ifreq* ifr) const override;
401285115cSWilliam A. Kennington III     int ioctl(int request, struct ifreq* ifr) const override;
411285115cSWilliam A. Kennington III };
421285115cSWilliam A. Kennington III 
431285115cSWilliam A. Kennington III } // namespace mock
44