void IPv6RAImpl::initPacket(const Interface* intf) { auto totalLength = IPv6RouteAdvertiser::getPacketSize(intf); buf_ = IOBuf(IOBuf::CREATE, totalLength); buf_.append(totalLength); RWPrivateCursor cursor(&buf_); IPv6RouteAdvertiser::createAdvertisementPacket( intf, &cursor, MacAddress("33:33:00:00:00:01"), IPAddressV6("ff02::1")); }
void IOBuf::cloneOneInto(IOBuf& other) const { SharedInfo* info = sharedInfo(); if (info) { setFlags(kFlagMaybeShared); } other = IOBuf(InternalConstructor(), flagsAndSharedInfo_, buf_, capacity_, data_, length_); if (info) { info->refcount.fetch_add(1, std::memory_order_acq_rel); } }
IOBuf IOBuf::cloneOneAsValue() const { if (SharedInfo* info = sharedInfo()) { setFlags(kFlagMaybeShared); info->refcount.fetch_add(1, std::memory_order_acq_rel); } return IOBuf( InternalConstructor(), flagsAndSharedInfo_, buf_, capacity_, data_, length_); }
IOBuf& IOBuf::operator=(const IOBuf& other) { if (this != &other) { *this = IOBuf(other); } return *this; }
IOBuf IOBuf::wrapBufferAsValue(const void* buf, uint64_t capacity) { return IOBuf(WrapBufferOp::WRAP_BUFFER, buf, capacity); }