| Index: runtime/bin/socket.cc
|
| diff --git a/runtime/bin/socket.cc b/runtime/bin/socket.cc
|
| index a5e64dd2095f712c06bc49b5ae86eb603353494e..eccf606682b27ac36a0fe8c7569c2e69dcec1b1b 100644
|
| --- a/runtime/bin/socket.cc
|
| +++ b/runtime/bin/socket.cc
|
| @@ -486,6 +486,30 @@ static CObject* LookupRequest(const CObjectArray& request) {
|
| }
|
|
|
|
|
| +static CObject* ReverseLookupRequest(const CObjectArray& request) {
|
| + if (request.Length() == 2 &&
|
| + request[1]->IsTypedData()) {
|
| + CObjectUint8Array addr_object(request[1]);
|
| + RawAddr addr;
|
| + memmove(reinterpret_cast<void *>(&addr),
|
| + addr_object.Buffer(),
|
| + addr_object.Length());
|
| + OSError* os_error = NULL;
|
| + const intptr_t kMaxHostLength = 1025;
|
| + char host[kMaxHostLength];
|
| + if (Socket::ReverseLookup(addr, host, kMaxHostLength, &os_error)) {
|
| + return new CObjectString(CObject::NewString(host));
|
| + } else {
|
| + CObject* result = CObject::NewOSError(os_error);
|
| + delete os_error;
|
| + return result;
|
| + }
|
| + }
|
| + return CObject::IllegalArgumentError();
|
| +}
|
| +
|
| +
|
| +
|
| static CObject* ListInterfacesRequest(const CObjectArray& request) {
|
| if (request.Length() == 2 &&
|
| request[1]->IsInt32()) {
|
| @@ -552,6 +576,9 @@ void SocketService(Dart_Port dest_port_id,
|
| case Socket::kListInterfacesRequest:
|
| response = ListInterfacesRequest(request);
|
| break;
|
| + case Socket::kReverseLookupRequest:
|
| + response = ReverseLookupRequest(request);
|
| + break;
|
| default:
|
| UNREACHABLE();
|
| }
|
|
|