blob: 34b8f23f4f07d27c7c0580211af159ed7cd4a1c8 [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;
// Legacy interface to create a socket
enum SocketDomain {
inet = 2;
inet6 = 10;
};
enum SocketType {
stream = 1;
dgram = 2;
};
enum SocketProtocol {
ip = 0;
icmp = 1;
tcp = 6;
udp = 17;
ipv6 = 41;
icmpv6 = 58;
};
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(tamird): use vector<uint8>:16 addr when we can?
uint16 port;
};
[Discoverable, Layout = "Simple"]
interface LegacySocketProvider {
1: OpenSocket(SocketDomain domain, SocketType type, SocketProtocol protocol)
-> (handle<socket>? s, int32 status);
2: GetAddrInfo(string:256? node, string:256? service, AddrInfoHints? hints)
-> (AddrInfoStatus status, uint32 nres, array<AddrInfo>:4 res);
// TODO(tamird): change (nres, res) to a vector once we can.
};