cueOS  2.4
cueOS - Universal Show Control OS for ARM
net.h
1
7#ifndef _NET_H_
8#define _NET_H_
9
10#include "lwip/opt.h"
11#include "lwip/mem.h"
12#include "lwip/memp.h"
13#include "netif/etharp.h"
14#include "lwip/dhcp.h"
15#include "lwip/netif.h"
16#include "lwip/timeouts.h"
17#include "ethernet_driver.h"
18#include "lwip/tcpip.h"
19
20#define NET_DEFAULT {{},{},{},{},{},NET_LINK_DOWN,NET_UNBOUND,NET_MODE_ETHERNET};
21#define ETHERNETIF_LINKTHR_ATTR {.stack_size = 128,.priority = (osPriority_t) osPriorityNormal}
22
23
27typedef enum{
31
35typedef enum{
37 NET_LINK_DOWN = 0
39
43typedef enum{
47
48
56typedef struct net{
57 struct netif ethernetif;
58 struct netif wirelessif;
59 ip4_addr_t ip_addr;
60 ip4_addr_t netmask;
61 ip4_addr_t gateway;
65 void( *net_ready_callback)(void);
67
68void net_init(net_mode_e mode, void *net_ready_callback);
69ip4_addr_t net_get_ip_addr(void);
70ip4_addr_t net_get_gateway(void);
71void net_set_mode(net_mode_e mode);
72
73#endif
74
net_bound_state_e
conveys information regarding the network's DHCP state
Definition: net.h:27
net_mode_e
used to set net's prefferred/current network interface
Definition: net.h:43
struct net net_s
Defines the system's network interfaces.
void net_init(net_mode_e mode, void *net_ready_callback)
Initialises network.
Definition: net.c:138
net_link_state_e
conveys information relative the network's link state
Definition: net.h:35
ip4_addr_t net_get_ip_addr(void)
Returns the active network interface IP address.
Definition: net.c:168
void net_set_mode(net_mode_e mode)
Sets the network mode to either ethernet or wireless.
Definition: net.c:187
ip4_addr_t net_get_gateway(void)
Returns the active network interface gateway address.
Definition: net.c:177
@ NET_UNBOUND
Definition: net.h:29
@ NET_BOUND
Definition: net.h:28
@ NET_MODE_ETHERNET
Definition: net.h:44
@ NET_MODE_WIRELESS
Definition: net.h:45
@ NET_LINK_UP
Definition: net.h:36
@ NET_LINK_DOWN
Definition: net.h:37
Defines the system's network interfaces.
Definition: net.h:56
net_mode_e mode
Definition: net.h:64
void(* net_ready_callback)(void)
Definition: net.h:65
struct netif ethernetif
Definition: net.h:57
ip4_addr_t ip_addr
Definition: net.h:59
net_link_state_e link_state
Definition: net.h:62
ip4_addr_t netmask
Definition: net.h:60
net_bound_state_e bound_state
Definition: net.h:63
ip4_addr_t gateway
Definition: net.h:61
struct netif wirelessif
Definition: net.h:58