src/net/dns/record_rdata_unittest.cc
// Appends an IP address in network byte order, prepended by one byte
// containing its version number, to |*serialized_addresses|. Appends
// the corresponding IPAddress object to |*address_objects|.
Appends an IP address in network byte order, prepended by one byte
containing its version number, to |*serialized_addresses|. Appends
the corresponding IPAddress object to |*address_objects|.
Appends an IP address in network byte order prepended by one byte containing its version number to | * serialized_addresses| . Appends the corresponding IPAddress object to | * address_objects| .
void AppendAnotherIPAddress(std::vector<uint8_t>* serialized_addresses,
                            std::vector<IPAddress>* address_objects,
                            int ip_version) {
  CHECK(serialized_addresses);
  CHECK(address_objects);
  static uint8_t next_octet;
  CHECK(ip_version == 4 || ip_version == 6);
  const int address_num_bytes = ip_version == 4 ? 4 : 16;
  std::vector<uint8_t> address_bytes;
  for (int i = 0; i < address_num_bytes; ++i)
    address_bytes.push_back(next_octet++);
  IPAddress address(address_bytes.data(), address_num_bytes);
  serialized_addresses->push_back(ip_version);
  serialized_addresses->insert(serialized_addresses->end(),
                               address_bytes.begin(), address_bytes.end());
  address_objects->push_back(address);
}
void AppendAnotherIPAddress ( std :: vector < uint8_t > * serialized_addresses , std :: vector < IPAddress > * address_objects , int ip_version ) { CHECK ( serialized_addresses ) ; CHECK ( address_objects ) ; static uint8_t next_octet ; CHECK ( ip_version == 4 || ip_version == 6 ) ; const int address_num_bytes = ip_version == 4 ? 4 : 16 ; std :: vector < uint8_t > address_bytes ; for ( int i = 0 ; i < address_num_bytes ; ++ i ) address_bytes . push_back ( next_octet ++ ) ; IPAddress address ( address_bytes . data ( ) , address_num_bytes ) ; serialized_addresses -> push_back ( ip_version ) ; serialized_addresses -> insert ( serialized_addresses -> end ( ) , address_bytes . begin ( ) , address_bytes . end ( ) ) ; address_objects -> push_back ( address ) ; }
Appends an IP address in network byte order, prepended by one byte
containing its version number, to |*serialized_addresses|.
Appends an IP address in network byte order prepended by one byte containing its version number to | * serialized_addresses| .
// To make the addresses vary, but in a deterministic manner, assign octets // in increasing order as they're requested, potentially eventually wrapping // to 0.