MCPcopy Create free account
hub / github.com/apple/foundationdb / makeIPAddressForSim

Function makeIPAddressForSim

fdbserver/SimulatedCluster.actor.cpp:1066–1078  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1064}
1065
1066IPAddress makeIPAddressForSim(bool isIPv6, std::array<int, 4> parts) {
1067 if (isIPv6) {
1068 IPAddress::IPAddressStore addrStore{ 0xAB, 0xCD };
1069 uint16_t* ptr = (uint16_t*)addrStore.data();
1070 ptr[4] = (uint16_t)(parts[0] << 8);
1071 ptr[5] = (uint16_t)(parts[1] << 8);
1072 ptr[6] = (uint16_t)(parts[2] << 8);
1073 ptr[7] = (uint16_t)(parts[3] << 8);
1074 return IPAddress(addrStore);
1075 } else {
1076 return IPAddress(parts[0] << 24 | parts[1] << 16 | parts[2] << 8 | parts[3]);
1077 }
1078}
1079
1080#include "fdbclient/MonitorLeader.h"
1081

Callers 1

setupSimulatedSystemFunction · 0.85

Calls 2

IPAddressClass · 0.50
dataMethod · 0.45

Tested by

no test coverage detected