Initial checkin.

This commit is contained in:
Pim van Pelt
2018-01-05 16:58:15 +01:00
commit 4679636fdc
42 changed files with 9600 additions and 0 deletions

32
unittest/mgos_net.h Normal file
View File

@ -0,0 +1,32 @@
#ifndef __MGOS_NET_H
#define __MGOS_NET_H
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#define MGOS_NET_IF_WIFI_STA 0
#define MGOS_NET_IF_WIFI_AP 1
enum mgos_net_if_type {
MGOS_NET_IF_TYPE_WIFI,
MGOS_NET_IF_TYPE_ETHERNET,
MGOS_NET_IF_TYPE_PPP,
/* This is a sentinel in case all networking interface types are disabled. */
MGOS_NET_IF_MAX,
};
struct mgos_net_ip_info {
struct sockaddr_in ip;
struct sockaddr_in netmask;
struct sockaddr_in gw;
};
bool mgos_net_get_ip_info(enum mgos_net_if_type if_type, int if_instance,
struct mgos_net_ip_info *ip_info);
void mgos_net_ip_to_str(const struct sockaddr_in *sin, char *out);
#endif // __MGOS_NET_H