proxygen
TestSendMsgParamsCallback Class Reference

#include <AsyncSocketTest.h>

Inheritance diagram for TestSendMsgParamsCallback:
folly::AsyncSocket::SendMsgParamsCallback

Public Member Functions

 TestSendMsgParamsCallback (int flags, uint32_t dataSize, void *data)
 
void reset (int flags)
 
int getFlagsImpl (folly::WriteFlags flags, int) noexceptoverride
 
void getAncillaryData (folly::WriteFlags flags, void *data) noexceptoverride
 
uint32_t getAncillaryDataSize (folly::WriteFlags flags) noexceptoverride
 
- Public Member Functions inherited from folly::AsyncSocket::SendMsgParamsCallback
virtual ~SendMsgParamsCallback ()=default
 
int getFlags (folly::WriteFlags flags, bool zeroCopyEnabled) noexcept
 

Public Attributes

int flags_
 
folly::WriteFlags writeFlags_
 
uint32_t dataSize_
 
void * data_
 
bool queriedFlags_
 
bool queriedData_
 

Additional Inherited Members

- Static Public Attributes inherited from folly::AsyncSocket::SendMsgParamsCallback
static const size_t maxAncillaryDataSize {0x5000}
 

Detailed Description

Definition at line 209 of file AsyncSocketTest.h.

Constructor & Destructor Documentation

TestSendMsgParamsCallback::TestSendMsgParamsCallback ( int  flags,
uint32_t  dataSize,
void *  data 
)
inline

Definition at line 212 of file AsyncSocketTest.h.

Member Function Documentation

void TestSendMsgParamsCallback::getAncillaryData ( folly::WriteFlags  ,
void *   
)
inlineoverridevirtualnoexcept

getAncillaryData() will be invoked to initialize ancillary data buffer referred by "msg_control" field of msghdr structure passed to sendmsg() system call. The function assumes that the size of buffer is not smaller than the value returned by getAncillaryDataSize() method for the same combination of flags.

Parameters
flagsWrite flags requested for the given write operation
dataPointer to ancillary data buffer to initialize.

Reimplemented from folly::AsyncSocket::SendMsgParamsCallback.

Definition at line 239 of file AsyncSocketTest.h.

References data, data_, and folly::NONE.

239  {
240  queriedData_ = true;
242  writeFlags_ = flags;
243  } else {
244  assert(flags == writeFlags_);
245  }
246  assert(data != nullptr);
247  memcpy(data, data_, dataSize_);
248  }
flags
Definition: http_parser.h:127
folly::WriteFlags writeFlags_
static constexpr uint64_t data[1]
Definition: Fingerprint.cpp:43
uint32_t TestSendMsgParamsCallback::getAncillaryDataSize ( folly::WriteFlags  )
inlineoverridevirtualnoexcept

getAncillaryDataSize() will be invoked to retrieve the size of ancillary data buffer which should be passed to sendmsg() system call

Parameters
flagsWrite flags requested for the given write operation

Reimplemented from folly::AsyncSocket::SendMsgParamsCallback.

Definition at line 250 of file AsyncSocketTest.h.

References folly::NONE.

250  {
252  writeFlags_ = flags;
253  } else {
254  assert(flags == writeFlags_);
255  }
256  return dataSize_;
257  }
flags
Definition: http_parser.h:127
folly::WriteFlags writeFlags_
int TestSendMsgParamsCallback::getFlagsImpl ( folly::WriteFlags  ,
int  defaultFlags 
)
inlineoverridevirtualnoexcept

getFlagsImpl() will be invoked by getFlags(folly::WriteFlags flags) method to retrieve the flags to be passed to sendmsg() system call. SendMsgParamsCallback::getFlags() is calling this method, and returns its results directly to the caller in AsyncSocket. Classes inheriting from SendMsgParamsCallback are welcome to override this method to force SendMsgParamsCallback to return its own set of flags.

Parameters
flagsWrite flags requested for the given write operation
defaultflagsA set of message flags returned by getDefaultFlags() method for the given "flags" mask.

Reimplemented from folly::AsyncSocket::SendMsgParamsCallback.

Definition at line 227 of file AsyncSocketTest.h.

References folly::NONE.

229  {
230  queriedFlags_ = true;
232  writeFlags_ = flags;
233  } else {
234  assert(flags == writeFlags_);
235  }
236  return flags_;
237  }
flags
Definition: http_parser.h:127
folly::WriteFlags writeFlags_
void TestSendMsgParamsCallback::reset ( int  flags)
inline

Definition at line 220 of file AsyncSocketTest.h.

References folly::NONE.

Referenced by TEST().

Member Data Documentation

void* TestSendMsgParamsCallback::data_

Definition at line 262 of file AsyncSocketTest.h.

uint32_t TestSendMsgParamsCallback::dataSize_

Definition at line 261 of file AsyncSocketTest.h.

int TestSendMsgParamsCallback::flags_

Definition at line 259 of file AsyncSocketTest.h.

bool TestSendMsgParamsCallback::queriedData_

Definition at line 264 of file AsyncSocketTest.h.

Referenced by TEST().

bool TestSendMsgParamsCallback::queriedFlags_

Definition at line 263 of file AsyncSocketTest.h.

Referenced by TEST().

folly::WriteFlags TestSendMsgParamsCallback::writeFlags_

Definition at line 260 of file AsyncSocketTest.h.


The documentation for this class was generated from the following file: