Fix public API: const refs, return by value, ip_address for addrs, remove void* dispatch

This commit is contained in:
Ian Gulliver
2026-04-05 15:32:20 +09:00
parent 732ea4250d
commit b7fd5f7668
3 changed files with 107 additions and 210 deletions

View File

@@ -188,36 +188,36 @@ void init_critical_section();
void reset();
void init();
bool check();
void init_net(net_info info);
void init_net(const net_info& info);
void soft_reset();
int8_t init_buffers(uint8_t* txsize, uint8_t* rxsize);
void clear_interrupt(intr_kind intr);
void soft_reset();
int8_t init_buffers(std::span<const uint8_t> txsize, std::span<const uint8_t> rxsize);
void clear_interrupt(intr_kind intr);
intr_kind get_interrupt();
void set_interrupt_mask(intr_kind intr);
void set_interrupt_mask(intr_kind intr);
intr_kind get_interrupt_mask();
int8_t get_phy_link();
int8_t get_phy_power_mode();
void reset_phy();
void set_phy_conf(phy_conf* conf);
void get_phy_conf(phy_conf* conf);
void get_phy_status(phy_conf* conf);
void set_phy_power_mode(uint8_t pmode);
void reset_phy();
void set_phy_conf(const phy_conf& conf);
phy_conf get_phy_conf();
phy_conf get_phy_status();
void set_phy_power_mode(uint8_t pmode);
void set_net_info(net_info* info);
void get_net_info(net_info* info);
void set_net_info(const net_info& info);
net_info get_net_info();
void set_net_mode(netmode_type mode);
netmode_type get_net_mode();
void set_timeout(net_timeout* timeout);
void get_timeout(net_timeout* timeout);
void set_timeout(const net_timeout& timeout);
net_timeout get_timeout();
int8_t send_arp(arp_request* arp);
int8_t send_ping(ping_request* ping);
int8_t send_dad(uint8_t* ipv6);
int8_t send_slaac(prefix* pfx);
int8_t send_arp(arp_request& arp);
int8_t send_ping(const ping_request& ping);
int8_t send_dad(std::span<const uint8_t, 16> ipv6);
int8_t send_slaac(prefix& pfx);
int8_t send_unsolicited();
int8_t get_prefix(prefix* pfx);
int8_t get_prefix(prefix& pfx);
std::expected<socket_id, sock_error> open_socket(socket_id sn, protocol proto, port_num port, sock_flag flag);
std::expected<void, sock_error> close(socket_id sn);
@@ -226,9 +226,9 @@ std::expected<void, sock_error> disconnect(socket_id sn);
std::expected<uint16_t, sock_error> send(socket_id sn, std::span<const uint8_t> buf);
std::expected<uint16_t, sock_error> recv(socket_id sn, std::span<uint8_t> buf);
std::expected<void, sock_error> connect(socket_id sn, uint8_t* addr, port_num port, uint8_t addrlen);
std::expected<uint16_t, sock_error> sendto(socket_id sn, std::span<const uint8_t> buf, uint8_t* addr, port_num port, uint8_t addrlen);
std::expected<uint16_t, sock_error> recvfrom(socket_id sn, std::span<uint8_t> buf, uint8_t* addr, port_num* port, uint8_t* addrlen);
std::expected<void, sock_error> connect(socket_id sn, const ip_address& addr, port_num port);
std::expected<uint16_t, sock_error> sendto(socket_id sn, std::span<const uint8_t> buf, const ip_address& addr, port_num port);
std::expected<uint16_t, sock_error> recvfrom(socket_id sn, std::span<uint8_t> buf, ip_address& addr, port_num& port);
std::expected<void, sock_error> set_socket_io_mode(socket_id sn, sock_io_mode mode);
sock_io_mode get_socket_io_mode(socket_id sn);