2 //==========================================================================
6 // Misc network support
8 //==========================================================================
9 //####BSDCOPYRIGHTBEGIN####
11 // -------------------------------------------
13 // Portions of this software may have been derived from OpenBSD or other sources,
14 // and are covered by the appropriate copyright disclaimers included herein.
16 // -------------------------------------------
18 //####BSDCOPYRIGHTEND####
19 //==========================================================================
20 //#####DESCRIPTIONBEGIN####
23 // Contributors: gthomas, andrew.lunn@ascom.ch
29 //####DESCRIPTIONEND####
31 //==========================================================================
36 #define NO_LIBKERN_INLINE // Avoid kernel inline functions
38 #include <pkgconf/system.h>
39 #include <pkgconf/net.h>
40 #include <pkgconf/io_eth_drivers.h>
42 #include <sys/param.h>
43 #include <sys/socket.h>
44 #include <sys/ioctl.h>
45 #include <sys/errno.h>
48 #include <netinet/in.h>
49 #include <netinet/ip.h>
50 #include <netinet/ip_icmp.h>
51 #include <net/route.h>
54 #include <cyg/infra/diag.h>
55 #include <cyg/kernel/kapi.h>
60 #ifdef CYGHWR_NET_DRIVER_ETH0
61 extern struct bootp eth0_bootp_data;
62 extern cyg_bool_t eth0_up;
63 extern const char *eth0_name;
65 #ifdef CYGHWR_NET_DRIVER_ETH1
66 extern struct bootp eth1_bootp_data;
67 extern cyg_bool_t eth1_up;
68 extern const char *eth1_name;
71 __externC void init_all_network_interfaces(void);
73 __externC void cyg_route_reinit(void);
74 __externC void perror(const char *) __THROW;
75 __externC int close(int);
76 __externC ssize_t read(int, void *, size_t);
77 __externC ssize_t write(int, const void *, size_t);
78 __externC int select(int, fd_set *, fd_set *, fd_set *, struct timeval *tv);
80 // This API is for our own automated network tests.
81 // It's not at all supported.
82 #define CYG_NET_GET_MEM_STATS_MISC 0 // Misc mpool
83 #define CYG_NET_GET_MEM_STATS_MBUFS 1 // Mbufs pool
84 #define CYG_NET_GET_MEM_STATS_CLUST 2 // Clust pool
85 int cyg_net_get_mem_stats( int which, cyg_mempool_info *p );
87 #ifdef CYGPKG_NET_INET6
88 #ifdef CYGOPT_NET_IPV6_ROUTING_THREAD
89 __externC void ipv6_start_routing_thread(void);
90 __externC int cyg_net_get_ipv6_advrouter(struct sockaddr_in6 * addr);