Prusa MINI Firmware overview
|
◆ netif_is_up
Ask if an interface is up
◆ netif_add()
Add a network interface to the list of lwIP netifs.
- Parameters
-
netif | a pre-allocated netif structure |
ipaddr | IP address for the new netif |
netmask | network mask for the new netif |
gw | default gateway IP address for the new netif |
state | opaque data passed to the new netif |
init | callback function that initializes the interface |
input | callback function that is called to pass ingress packets up in the protocol layer stack.
It is recommended to use a function that passes the input directly to the stack (netif_input(), NO_SYS=1 mode) or via sending a message to TCPIP thread (tcpip_input(), NO_SYS=0 mode).
These functions use netif flags NETIF_FLAG_ETHARP and NETIF_FLAG_ETHERNET to decide whether to forward to ethernet_input() or ip_input(). In other words, the functions only work when the netif driver is implemented correctly!
Most members of struct netif should be be initialized by the netif init function = netif driver (init parameter of this function).
IPv6: Don't forget to call netif_create_ip6_linklocal_address() after setting the MAC address in struct netif.hwaddr (IPv6 requires a link-local address). |
- Returns
- netif, or NULL if failed.
255 ip_addr_set_zero_ip4(&
netif->ip_addr);
256 ip_addr_set_zero_ip4(&
netif->netmask);
257 ip_addr_set_zero_ip4(&
netif->gw);
262 netif->ip6_addr_state[
i] = IP6_ADDR_INVALID;
264 netif->output_ip6 = netif_null_output_ip6;
268 #ifdef netif_get_client_data
269 memset(
netif->client_data, 0,
sizeof(
netif->client_data));
271 #if LWIP_IPV6_AUTOCONFIG
273 netif->ip6_autoconfig_enabled = 0;
275 #if LWIP_IPV6_SEND_ROUTER_SOLICIT
278 #if LWIP_NETIF_STATUS_CALLBACK
281 #if LWIP_NETIF_LINK_CALLBACK
287 #if LWIP_IPV6 && LWIP_IPV6_MLD
301 #if ENABLE_LOOPBACK && LWIP_LOOPBACK_MAX_PBUFS
302 netif->loop_cnt_current = 0;
◆ netif_remove()
Remove a network interface from the list of lwIP netifs.
- Parameters
-
netif | the network interface to remove |
388 if (!ip4_addr_isany_val(*netif_ip4_addr(
netif))) {
390 tcp_netif_ip_addr_changed(netif_ip_addr4(
netif),
NULL);
393 udp_netif_ip_addr_changed(netif_ip_addr4(
netif),
NULL);
396 raw_netif_ip_addr_changed(netif_ip_addr4(
netif),
NULL);
410 if (ip6_addr_isvalid(netif_ip6_addr_state(
netif,
i))) {
412 tcp_netif_ip_addr_changed(netif_ip_addr6(
netif,
i),
NULL);
415 udp_netif_ip_addr_changed(netif_ip_addr6(
netif,
i),
NULL);
418 raw_netif_ip_addr_changed(netif_ip_addr6(
netif,
i),
NULL);
444 struct netif * tmp_netif;
451 if (tmp_netif ==
NULL) {
456 #if LWIP_NETIF_REMOVE_CALLBACK
457 if (
netif->remove_callback) {
◆ netif_find()
Find a network interface by searching for its name
- Parameters
-
name | the name of the netif (like netif->name) plus concatenated number in ascii representation (e.g. 'en0') |
◆ netif_set_default()
void netif_set_default |
( |
struct netif * |
netif | ) |
|
Set a network interface as the default network interface (used to output all packets for which no specific route is found)
- Parameters
-
netif | the default network interface |
◆ netif_set_up()
Bring an interface up, available for processing traffic.
◆ netif_set_down()
Bring an interface down, disabling any traffic processing.
688 #if LWIP_IPV4 && LWIP_ARP
690 etharp_cleanup_netif(
netif);
695 nd6_cleanup_netif(
netif);
◆ netif_set_link_up()
void netif_set_link_up |
( |
struct netif * |
netif | ) |
|
Called by a driver when its link goes up
741 dhcp_network_changed(
netif);
745 autoip_network_changed(
netif);
◆ netif_set_link_down()
void netif_set_link_down |
( |
struct netif * |
netif | ) |
|
Called by a driver when its link goes down
#define NETIF_FLAG_UP
Definition: netif.h:78
#define NETIF_FLAG_IGMP
Definition: netif.h:98
void netif_set_down(struct netif *netif)
Definition: netif.c:682
#define ip_addr_set_zero_ip6(ipaddr)
Definition: ip_addr.h:310
ip4_addr_t ipaddr
Definition: lwip.c:73
#define LWIP_ASSERT(message, assertion)
Definition: debug.h:116
netif_input_fn input
Definition: netif.h:244
#define NETIF_FLAG_ETHARP
Definition: netif.h:91
#define NETIF_STATUS_CALLBACK(n)
Definition: netif.c:95
void * state
Definition: netif.h:279
#define mib2_netif_added(ni)
Definition: snmp.h:177
uint8_t i
Definition: screen_test_graph.c:72
static volatile fsensor_t state
Definition: filament_sensor.c:23
#define NETIF_SET_CHECKSUM_CTRL(netif, chksumflags)
Definition: netif.h:348
u8_t flags
Definition: netif.h:305
#define NETIF_REPORT_TYPE_IPV4
Definition: netif.c:113
#define NETIF_SET_HWADDRHINT(netif, hint)
Definition: netif.h:467
#define NULL
Definition: usbd_def.h:53
ip4_addr_t gw
Definition: lwip.c:75
u8_t num
Definition: netif.h:309
uint8_t u8_t
Definition: arch.h:119
ip4_addr_t netmask
Definition: lwip.c:74
#define mib2_add_route_ip4(dflt, ni)
Definition: snmp.h:187
struct netif * netif_list
Definition: netif.c:104
#define mib2_remove_route_ip4(dflt, ni)
Definition: snmp.h:188
char name[2]
Definition: netif.h:307
struct netif * netif_default
Definition: netif.c:105
#define mib2_netif_removed(ni)
Definition: snmp.h:178
struct netif * next
Definition: netif.h:227
int8_t s8_t
Definition: arch.h:120
void netif_set_default(struct netif *netif)
Definition: netif.c:604
static void netif_issue_reports(struct netif *netif, u8_t report_type)
Definition: netif.c:642
#define LWIP_ND6_MAX_MULTICAST_SOLICIT
Definition: opt.h:2319
static u8_t netif_num
Definition: netif.c:107
#define NETIF_DEBUG
Definition: opt.h:2638
#define NETIF_FLAG_LINK_UP
Definition: netif.h:87
#define LWIP_IPV6_NUM_ADDRESSES
Definition: opt.h:2160
#define MIB2_COPY_SYSUPTIME_TO(ptrToVal)
Definition: snmp.h:136
#define mib2_remove_ip4(ni)
Definition: snmp.h:186
#define LWIP_DEBUGF(debug, message)
Definition: debug.h:164
#define NETIF_REPORT_TYPE_IPV6
Definition: netif.c:114
#define NETIF_LINK_CALLBACK(n)
Definition: netif.c:101
#define netif_is_up(netif)
Definition: netif.h:401