]> git.karo-electronics.de Git - karo-tx-redboot.git/blobdiff - packages/net/lwip_tcpip/v2_0/include/lwip/netif.h
unified MX27, MX25, MX37 trees
[karo-tx-redboot.git] / packages / net / lwip_tcpip / v2_0 / include / lwip / netif.h
index 3d571d7fa82e85fc1bc86f088d554b28e3d0b47c..d53ee6b9704044a57ba425afcff111fb827ec22a 100644 (file)
@@ -52,7 +52,8 @@
 
 /** whether the network interface is 'up'. this is
  * a software flag used to control whether this network
- * interface is enabled and processes traffic */
+ * interface is enabled and processes traffic.
+ */
 #define NETIF_FLAG_UP 0x1U
 /** if set, the netif has broadcast capability */
 #define NETIF_FLAG_BROADCAST 0x2U
 /** if set, the interface is configured using DHCP */
 #define NETIF_FLAG_DHCP 0x08U
 /** if set, the interface has an active link
- *  (set by the interface) */
+ *  (set by the network interface driver) */
 #define NETIF_FLAG_LINK_UP 0x10U
 
-/** generic data structure used for all lwIP network interfaces */
+/** Generic data structure used for all lwIP network interfaces.
+ *  The following fields should be filled in by the initialization
+ *  function for the device driver: hwaddr_len, hwaddr[], mtu, flags */
+
 struct netif {
   /** pointer to next in linked list */
   struct netif *next;
-  /** The following fields should be filled in by the
-      initialization function for the device driver. */
-  
+
   /** IP address configuration in network byte order */
   struct ip_addr ip_addr;
   struct ip_addr netmask;
   struct ip_addr gw;
 
   /** This function is called by the network device driver
-      to pass a packet up the TCP/IP stack. */
+   *  to pass a packet up the TCP/IP stack. */
   err_t (* input)(struct pbuf *p, struct netif *inp);
   /** This function is called by the IP module when it wants
-      to send a packet on the interface. This function typically
-      first resolves the hardware address, then sends the packet. */
+   *  to send a packet on the interface. This function typically
+   *  first resolves the hardware address, then sends the packet. */
   err_t (* output)(struct netif *netif, struct pbuf *p,
        struct ip_addr *ipaddr);
   /** This function is called by the ARP module when it wants
-      to send a packet on the interface. This function outputs
-      the pbuf as-is on the link medium. */
+   *  to send a packet on the interface. This function outputs
+   *  the pbuf as-is on the link medium. */
   err_t (* linkoutput)(struct netif *netif, struct pbuf *p);
   /** This field can be set by the device driver and could point
-      to state information for the device. */
+   *  to state information for the device. */
   void *state;
 #if LWIP_DHCP
   /** the DHCP client state information for this netif */
   struct dhcp *dhcp;
 #endif
   /** number of bytes used in hwaddr */
-  unsigned char hwaddr_len;
+  u8_t hwaddr_len;
   /** link level hardware address of this interface */
-  unsigned char hwaddr[NETIF_MAX_HWADDR_LEN];
+  u8_t hwaddr[NETIF_MAX_HWADDR_LEN];
   /** maximum transfer unit (in bytes) */
   u16_t mtu;
+  /** flags (see NETIF_FLAG_ above) */
+  u8_t flags;
+  /** link type */
+  u8_t link_type;
   /** descriptive abbreviation */
   char name[2];
   /** number of this interface */
   u8_t num;
-  /** NETIF_FLAG_* */
-  u8_t flags;
 };
 
 /** The list of network interfaces. */
@@ -115,29 +119,32 @@ extern struct netif *netif_list;
 extern struct netif *netif_default;
 
 /* netif_init() must be called first. */
-void netif_init(void);
+externC void netif_init(void);
 
-struct netif *netif_add(struct netif *netif, struct ip_addr *ipaddr, struct ip_addr *netmask,
+externC struct netif *netif_add(struct netif *netif, struct ip_addr *ipaddr, struct ip_addr *netmask,
       struct ip_addr *gw,
       void *state,
       err_t (* init)(struct netif *netif),
       err_t (* input)(struct pbuf *p, struct netif *netif));
 
-void
+externC void
 netif_set_addr(struct netif *netif,struct ip_addr *ipaddr, struct ip_addr *netmask,
     struct ip_addr *gw);
-void netif_remove(struct netif * netif);
+externC void netif_remove(struct netif * netif);
 
 /* Returns a network interface given its name. The name is of the form
    "et0", where the first two letters are the "name" field in the
    netif structure, and the digit is in the num field in the same
    structure. */
-struct netif *netif_find(char *name);
+externC struct netif *netif_find(char *name);
 
-void netif_set_default(struct netif *netif);
+externC void netif_set_default(struct netif *netif);
 
-void netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr);
-void netif_set_netmask(struct netif *netif, struct ip_addr *netmast);
-void netif_set_gw(struct netif *netif, struct ip_addr *gw);
+externC void netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr);
+externC void netif_set_netmask(struct netif *netif, struct ip_addr *netmast);
+externC void netif_set_gw(struct netif *netif, struct ip_addr *gw);
+externC void netif_set_up(struct netif *netif);
+externC void netif_set_down(struct netif *netif);
+externC u8_t netif_is_up(struct netif *netif);
 
 #endif /* __LWIP_NETIF_H__ */