1/*
2 * Copyright 2019, Data61
3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO)
4 * ABN 41 687 119 230.
5 *
6 * This software may be distributed and modified according to the terms of
7 * the GNU General Public License version 2. Note that NO WARRANTY is provided.
8 * See "LICENSE_GPLv2.txt" for details.
9 *
10 * @TAG(DATA61_GPL)
11 */
12
13procedure PicoControl {
14    include "picoserver_peer.h";
15    include "picoserver_event.h";
16    /* Only support IPv4 and UDP/TCP at the moment */
17    int open(in bool is_udp);
18    /* 
19     * For bind and connect, the addresses will be expected in network order (1.2.3.4 -> 0x04030201),
20     * ports in non-network order (port 9000 -> (uint16_t) 9000)
21     */
22    int bind(in int socket_fd, in uint32_t local_addr, in uint16_t port);
23    int connect(in int socket_fd, in uint32_t server_addr, in uint16_t port);
24    int listen(in int socket_fd, in int backlog);
25    picoserver_peer_t accept(in int socket_fd);
26    int shutdown(in int socket_fd, in int mode);
27    int close(in int socket_fd);
28    picoserver_event_t event_poll(void);
29    int get_ipv4(out uint32_t ipaddr);
30    int set_async(in int socket_fd, in bool enabled);
31};
32