28#include "ove_config.h"
41#define OVE_SOCK_STREAM ((ove_sock_type_t)1)
42#define OVE_SOCK_DGRAM ((ove_sock_type_t)2)
44#define OVE_AF_INET ((ove_af_t)2)
45#define OVE_AF_INET6 ((ove_af_t)10)
205 uint64_t timeout_ns);
229 uint64_t timeout_ns);
308#ifndef CONFIG_OVE_NET
311} ove_socket_storage_t;
314} ove_netif_storage_t;
380 ove_socket_storage_t *client_storage, uint64_t timeout_ns)
384 (void)client_storage;
435 uint8_t d, uint16_t port)
int ove_socket_listen(ove_socket_t sock, int backlog)
Mark a bound socket as listening for incoming connections.
int ove_socket_recv(ove_socket_t sock, void *buf, size_t len, size_t *received, uint64_t timeout_ns)
Receive data from a connected socket.
void ove_netif_deinit(ove_netif_t netif)
De-initialise a network interface.
int ove_socket_sendto(ove_socket_t sock, const void *data, size_t len, size_t *sent, const ove_sockaddr_t *dest)
Send a datagram to a specific destination.
void ove_socket_close(ove_socket_t sock)
Close a socket.
int ove_netif_create(ove_netif_t *netif)
Heap-allocate and initialise a network interface.
int ove_netif_up(ove_netif_t netif, const ove_netif_config_t *cfg)
Bring the network interface up.
int ove_netif_get_addr(ove_netif_t netif, ove_sockaddr_t *ip, ove_sockaddr_t *gateway, ove_sockaddr_t *netmask)
Query the current addresses of a network interface.
ove_sock_type_t
Socket type.
Definition net.h:47
int ove_dns_resolve(const char *hostname, ove_sockaddr_t *addr, uint64_t timeout_ns)
Resolve a hostname to an address.
void ove_socket_destroy(ove_socket_t sock)
Destroy a heap-allocated socket.
ove_af_t
Address family.
Definition net.h:53
int ove_socket_open(ove_socket_t *sock, ove_socket_storage_t *storage, ove_af_t af, ove_sock_type_t type)
Open a socket from caller-supplied storage.
void ove_sockaddr_ipv4(ove_sockaddr_t *addr, uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint16_t port)
Fill a sockaddr from IPv4 address components.
int ove_socket_bind(ove_socket_t sock, const ove_sockaddr_t *addr)
Bind a socket to a local address.
int ove_socket_accept(ove_socket_t sock, ove_socket_t *client, ove_socket_storage_t *client_storage, uint64_t timeout_ns)
Accept an incoming connection on a listening socket.
int ove_socket_recvfrom(ove_socket_t sock, void *buf, size_t len, size_t *received, ove_sockaddr_t *src, uint64_t timeout_ns)
Receive a datagram and the sender's address.
int ove_socket_connect(ove_socket_t sock, const ove_sockaddr_t *addr, uint64_t timeout_ns)
Connect a socket to a remote address.
void ove_netif_down(ove_netif_t netif)
Tear down the network interface.
void ove_netif_destroy(ove_netif_t netif)
Destroy a heap-allocated network interface.
int ove_socket_send(ove_socket_t sock, const void *data, size_t len, size_t *sent)
Send data on a connected socket.
int ove_socket_create(ove_socket_t *sock, ove_af_t af, ove_sock_type_t type)
Heap-allocate and open a socket.
int ove_netif_init(ove_netif_t *netif, ove_netif_storage_t *storage)
Initialise a network interface from caller-supplied storage.
@ OVE_SOCK_DGRAM
Definition net.h:49
@ OVE_SOCK_STREAM
Definition net.h:48
@ OVE_AF_INET
Definition net.h:54
@ OVE_AF_INET6
Definition net.h:55
struct ove_netif * ove_netif_t
Opaque handle for a network interface.
Definition types.h:250
struct ove_socket * ove_socket_t
Opaque handle for a network socket.
Definition types.h:247
@ OVE_ERR_NOT_SUPPORTED
Definition types.h:98
Network interface configuration.
Definition net.h:71
ove_sockaddr_t static_ip
Definition net.h:73
ove_sockaddr_t gateway
Definition net.h:74
ove_sockaddr_t dns
Definition net.h:76
int use_dhcp
Definition net.h:72
ove_sockaddr_t netmask
Definition net.h:75
Generic socket address (large enough for IPv4 or IPv6).
Definition net.h:62
ove_af_t family
Definition net.h:63
uint16_t port
Definition net.h:64