blob: 874e3da05c4c03341c3e4d7cc112697e779ebe31 [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.net;
enum AddrInfoStatus {
ok = 0;
// invalid flags
bad_flags = 1;
// missing node name or service name
no_name = 2;
// temporary failure
again = 3;
// non-recoverable failure
fail = 4;
// no address found for node name
no_data = 5;
// argument buffer overflow
buffer_overflow = 6;
// system error
system_error = 7;
};
struct AddrInfoHints {
int32 flags;
int32 family;
int32 sock_type;
int32 protocol;
};
struct AddrStorage {
array<uint8>:16 val;
uint32 len;
};
struct AddrInfo {
int32 flags;
int32 family;
int32 sock_type;
int32 protocol;
AddrStorage addr; // TODO(FIDL-323): replace with vector<uint8>:16.
uint16 port;
};
/// SocketProvider implements the POSIX sockets API.
[Discoverable, Layout = "Simple"]
protocol SocketProvider {
/// Retrieves information about the address of a node and/or service. The number of valid
/// results in `res` is given by the `count` return value.
// TODO(FIDL-323): use vector<AddInfo>:4.
GetAddrInfo(string:256? node, string:256? service, AddrInfoHints? hints)
-> (AddrInfoStatus status, uint32 nres, array<AddrInfo>:4 res);
};