net: Implement net_available
This commit is contained in:
parent
b108afb6e7
commit
8435b3f5fd
|
@ -1,6 +1,7 @@
|
||||||
#ifndef NET_H
|
#ifndef NET_H
|
||||||
#define NET_H
|
#define NET_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
@ -71,7 +72,7 @@ struct net_socket;
|
||||||
int net_init(void);
|
int net_init(void);
|
||||||
void net_deinit(void);
|
void net_deinit(void);
|
||||||
int net_update(struct net_socket *s);
|
int net_update(struct net_socket *s);
|
||||||
|
bool net_available(enum net_domain d);
|
||||||
struct net_socket *net_server(const union net_server *srv);
|
struct net_socket *net_server(const union net_server *srv);
|
||||||
struct net_socket *net_connect(const union net_connect *c);
|
struct net_socket *net_connect(const union net_connect *c);
|
||||||
int net_read(struct net_socket *s, void *buf, size_t n);
|
int net_read(struct net_socket *s, void *buf, size_t n);
|
||||||
|
|
|
@ -109,3 +109,8 @@ void net_deinit(void)
|
||||||
net_deinit_ipv4();
|
net_deinit_ipv4();
|
||||||
net_deinit_serial();
|
net_deinit_serial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool net_available(const enum net_domain d)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
#include <net/serial.h>
|
#include <net/serial.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
int net_read(struct net_socket *const h, void *const buf, const size_t n)
|
int net_read(struct net_socket *const h, void *const buf, const size_t n)
|
||||||
|
@ -42,6 +43,11 @@ void net_deinit(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool net_available(const enum net_domain d)
|
||||||
|
{
|
||||||
|
return d == NET_DOMAIN_SERIAL;
|
||||||
|
}
|
||||||
|
|
||||||
const char *const *net_serial_devices(size_t *const n)
|
const char *const *net_serial_devices(size_t *const n)
|
||||||
{
|
{
|
||||||
static const char *const dev[] =
|
static const char *const dev[] =
|
||||||
|
|
Loading…
Reference in New Issue