proxygen
MockAsyncUDPSocket.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-present Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
20 
21 namespace folly {
22 namespace test {
23 
25  explicit MockAsyncUDPSocket(EventBase* evb) : AsyncUDPSocket(evb) {}
26  ~MockAsyncUDPSocket() override {}
27 
29  MOCK_METHOD1(bind, void(const SocketAddress&));
32  write,
33  ssize_t(const SocketAddress&, const std::unique_ptr<IOBuf>&));
35  writeGSO,
36  ssize_t(
37  const folly::SocketAddress&,
38  const std::unique_ptr<folly::IOBuf>&,
39  int));
41  writev,
42  ssize_t(const SocketAddress&, const struct iovec*, size_t));
44  MOCK_METHOD0(pauseRead, void());
45  MOCK_METHOD0(close, void());
46  MOCK_CONST_METHOD0(getFD, int());
47  MOCK_METHOD1(setReusePort, void(bool));
48  MOCK_METHOD1(setReuseAddr, void(bool));
49  MOCK_METHOD1(dontFragment, void(bool));
51  MOCK_METHOD1(connect, int(const SocketAddress&));
52  MOCK_CONST_METHOD0(isBound, bool());
53  MOCK_METHOD0(getGSO, int());
54  MOCK_METHOD1(setGSO, bool(int));
55 };
56 
57 } // namespace test
58 } // namespace folly
virtual const folly::SocketAddress & address() const
void setFD(int fd, FDOwnership ownership)
MOCK_METHOD3(writeGSO, ssize_t(const folly::SocketAddress &, const std::unique_ptr< folly::IOBuf > &, int))
virtual void pauseRead()
virtual ssize_t writeGSO(const folly::SocketAddress &address, const std::unique_ptr< folly::IOBuf > &buf, int gso)
virtual void resumeRead(ReadCallback *cob)
virtual ssize_t writev(const folly::SocketAddress &address, const struct iovec *vec, size_t veclen, int gso)
virtual void setErrMessageCallback(ErrMessageCallback *errMessageCallback)
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29
virtual ssize_t write(const folly::SocketAddress &address, const std::unique_ptr< folly::IOBuf > &buf)
MOCK_METHOD1(bind, void(const SocketAddress &))
MOCK_METHOD0(pauseRead, void())
virtual void bind(const folly::SocketAddress &address)
MOCK_METHOD2(setFD, void(NetworkSocket, AsyncUDPSocket::FDOwnership))
MOCK_CONST_METHOD0(address, const SocketAddress &())
virtual int getFD() const
virtual bool isBound() const
virtual void dontFragment(bool df)
virtual void setReusePort(bool reusePort)
virtual void setReuseAddr(bool reuseAddr)
virtual int connect(const folly::SocketAddress &address)