Exemple #1
0
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"));
}
Exemple #2
0
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);
  }
}
Exemple #3
0
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_);
}
Exemple #4
0
IOBuf& IOBuf::operator=(const IOBuf& other) {
  if (this != &other) {
    *this = IOBuf(other);
  }
  return *this;
}
Exemple #5
0
IOBuf IOBuf::wrapBufferAsValue(const void* buf, uint64_t capacity) {
  return IOBuf(WrapBufferOp::WRAP_BUFFER, buf, capacity);
}