Lines Matching defs:netif
33 #include <lwip/netif.h>
55 driverif_init_ifname(struct netif *netif)
57 struct netif *tmpnetif = NULL;
58 const char *prefix = (netif->link_layer_type == WIFI_DRIVER_IF) ? "wlan" : "eth";
60 netif->name[0] = prefix[0];
61 netif->name[1] = prefix[1];
64 if (snprintf_s(netif->full_name, sizeof(netif->full_name), sizeof(netif->full_name) - 1,
69 NETIF_FOREACH(tmpnetif, get_net_group_from_netif(netif)) {
73 if (strcmp(tmpnetif->full_name, netif->full_name) == 0) {
81 netif->full_name[0] = '\0';
89 * @param netif the lwip network interface structure for this driverif
101 driverif_output(struct netif *netif, struct pbuf *p)
103 LWIP_DEBUGF(DRIVERIF_DEBUG, ("driverif_output : going to send packet pbuf 0x%p of length %"U16_F" through netif 0x%p\n", \
104 (void *)p, p->tot_len, (void *)netif));
110 (void)raw_pkt_input(p, netif, NULL);
118 netif->drv_send(netif, p);
123 MIB2_STATS_NETIF_ADD(netif, ifoutoctets, p->tot_len);
137 * @param netif the lwip network interface structure for this driverif
141 driverif_input(struct netif *netif, struct pbuf *p)
154 LWIP_ERROR("driverif_input : invalid arguments", ((netif != NULL) && (p != NULL)), return);
156 LWIP_DEBUGF(DRIVERIF_DEBUG, ("driverif_input : going to receive input packet. netif 0x%p, pbuf 0x%p, \
157 packet_length %"U16_F"\n", (void *)netif, (void *)p, p->tot_len));
160 MIB2_STATS_NETIF_ADD(netif, ifinoctets, p->tot_len);
172 LWIP_DEBUGF(DRIVERIF_DEBUG, ("driverif_input : received packet of type %"U16_F" netif->input=%p\n", ethhdr_type, netif->input));
176 if (netif->input) {
177 ret = netif->input(p, netif);
205 if (netif->input != NULL) {
206 ret = netif->input(p, netif);
215 MIB2_STATS_NETIF_INC(netif, ifinoverruns);
242 * @param netif the lwip network interface structure for this driverif
248 driverif_init(struct netif *netif)
252 if (netif == NULL) {
255 link_layer_type = netif->link_layer_type;
256 LWIP_ERROR("driverif_init : invalid link_layer_type in netif", \
260 LWIP_ERROR("driverif_init : netif hardware length is greater than maximum supported", \
261 (netif->hwaddr_len <= NETIF_MAX_HWADDR_LEN), return ERR_IF);
263 LWIP_ERROR("driverif_init : drv_send is null", (netif->drv_send != NULL), return ERR_IF);
266 LWIP_ERROR("driverif_init : drv_config is null", (netif->drv_config != NULL), return ERR_IF);
271 netif->hostname = LWIP_NETIF_HOSTNAME_DEFAULT;
275 * Initialize the snmp variables and counters inside the struct netif.
279 NETIF_INIT_SNMP(netif, snmp_ifType_ethernet_csmacd, LINK_SPEED_OF_YOUR_NETIF_IN_BPS);
281 netif->output = etharp_output;
282 netif->linkoutput = driverif_output;
284 /* init the netif's full name */
285 driverif_init_ifname(netif);
288 netif->mtu = IP_FRAG_MAX_MTU;
292 netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP |
319 netif->waketime = -1;
321 LWIP_DEBUGF(DRIVERIF_DEBUG, ("driverif_init : Initialized netif 0x%p\n", (void *)netif));
326 static err_t netif_veth_output(struct netif *netif, struct pbuf *p, const ip4_addr_t *addr)
329 return netif_loop_output(netif->peer, p);
332 static void veth_init_fullname(struct netif *netif)
334 struct netif *tmpnetif = NULL;
337 if (snprintf_s(netif->full_name, sizeof(netif->full_name), sizeof(netif->full_name) - 1,
341 NETIF_FOREACH(tmpnetif, get_net_group_from_netif(netif)) {
342 if (strcmp(tmpnetif->full_name, netif->full_name) == 0) {
350 netif->full_name[0] = '\0';
353 static err_t netif_vethif_init(struct netif *netif)
355 LWIP_ASSERT("netif_vethif_init: invalid netif", netif != NULL);
357 /* initialize the snmp variables and counters inside the struct netif
360 MIB2_INIT_NETIF(netif, snmp_ifType_other, 0);
361 netif->link_layer_type = VETH_DRIVER_IF;
363 netif->name[0] = 'v';
364 netif->name[1] = 'e';
366 veth_init_fullname(netif);
367 netif->output = netif_veth_output;
369 netif_set_flags(netif, NETIF_FLAG_IGMP);
370 NETIF_SET_CHECKSUM_CTRL(netif, NETIF_CHECKSUM_DISABLE_ALL);
374 void veth_init(struct netif *netif, struct net_group *group)
376 netif_add_noaddr(netif, group, NULL, netif_vethif_init, tcpip_input);
377 netif_set_link_up(netif);
378 netif_set_up(netif);