[96b39164] | 1 | /* |
---|
| 2 | * $Id$ |
---|
| 3 | */ |
---|
| 4 | |
---|
[39e6e65a] | 5 | #ifndef _RTEMS_BSDNET_ |
---|
| 6 | #define _RTEMS_BSDNET_ |
---|
| 7 | |
---|
| 8 | #include <rtems.h> |
---|
| 9 | |
---|
[11f84b3c] | 10 | /* |
---|
| 11 | * If this file is included from inside the Network Stack proper or |
---|
| 12 | * a device driver, then __INSIDE_RTEMS_BSD_TCPIP_STACK__ should be |
---|
| 13 | * defined. This triggers a number of internally used definitions. |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | #if defined(__INSIDE_RTEMS_BSD_TCPIP_STACK__) |
---|
| 17 | #undef _COMPILING_BSD_KERNEL_ |
---|
| 18 | #undef KERNEL |
---|
| 19 | #undef INET |
---|
| 20 | #undef NFS |
---|
| 21 | #undef DIAGNOSTIC |
---|
| 22 | #undef BOOTP_COMPAT |
---|
| 23 | |
---|
| 24 | #define _COMPILING_BSD_KERNEL_ |
---|
| 25 | #define KERNEL |
---|
| 26 | #define INET |
---|
| 27 | #define NFS |
---|
| 28 | #define DIAGNOSTIC |
---|
| 29 | #define BOOTP_COMPAT |
---|
| 30 | #endif |
---|
| 31 | |
---|
[39e6e65a] | 32 | /* |
---|
| 33 | * Values that may be obtained by BOOTP |
---|
| 34 | */ |
---|
| 35 | extern struct in_addr rtems_bsdnet_bootp_server_address; |
---|
[847375f] | 36 | extern char *rtems_bsdnet_bootp_server_name; |
---|
[39e6e65a] | 37 | extern char *rtems_bsdnet_bootp_boot_file_name; |
---|
[a0af97d] | 38 | extern struct in_addr rtems_bsdnet_ntpserver[]; |
---|
| 39 | extern int rtems_bsdnet_ntpserver_count; |
---|
| 40 | extern long rtems_bsdnet_timeoffset; |
---|
[39e6e65a] | 41 | |
---|
| 42 | /* |
---|
| 43 | * Manipulate routing tables |
---|
| 44 | */ |
---|
| 45 | struct sockaddr; |
---|
| 46 | struct rtentry; |
---|
| 47 | int rtems_bsdnet_rtrequest ( |
---|
| 48 | int req, |
---|
| 49 | struct sockaddr *dst, |
---|
| 50 | struct sockaddr *gateway, |
---|
| 51 | struct sockaddr *netmask, |
---|
| 52 | int flags, |
---|
| 53 | struct rtentry **net_nrt); |
---|
| 54 | |
---|
| 55 | /* |
---|
| 56 | * Diagnostics |
---|
| 57 | */ |
---|
| 58 | void rtems_bsdnet_show_inet_routes (void); |
---|
| 59 | void rtems_bsdnet_show_mbuf_stats (void); |
---|
| 60 | void rtems_bsdnet_show_if_stats (void); |
---|
| 61 | void rtems_bsdnet_show_ip_stats (void); |
---|
| 62 | void rtems_bsdnet_show_icmp_stats (void); |
---|
| 63 | void rtems_bsdnet_show_udp_stats (void); |
---|
| 64 | void rtems_bsdnet_show_tcp_stats (void); |
---|
| 65 | |
---|
| 66 | /* |
---|
| 67 | * Network configuration |
---|
| 68 | */ |
---|
| 69 | struct rtems_bsdnet_ifconfig { |
---|
| 70 | /* |
---|
| 71 | * These two entries must be supplied for each interface. |
---|
| 72 | */ |
---|
| 73 | char *name; |
---|
| 74 | int (*attach)(struct rtems_bsdnet_ifconfig *conf); |
---|
| 75 | |
---|
| 76 | /* |
---|
| 77 | * Link to next interface |
---|
| 78 | */ |
---|
| 79 | struct rtems_bsdnet_ifconfig *next; |
---|
| 80 | |
---|
| 81 | /* |
---|
| 82 | * The following entries may be obtained |
---|
| 83 | * from BOOTP or explicitily supplied. |
---|
| 84 | */ |
---|
| 85 | char *ip_address; |
---|
| 86 | char *ip_netmask; |
---|
| 87 | void *hardware_address; |
---|
| 88 | |
---|
| 89 | /* |
---|
| 90 | * The driver assigns defaults values to the following |
---|
| 91 | * entries if they are not explicitly supplied. |
---|
| 92 | */ |
---|
| 93 | int ignore_broadcast; |
---|
| 94 | int mtu; |
---|
| 95 | int rbuf_count; |
---|
| 96 | int xbuf_count; |
---|
[d9d75fc] | 97 | |
---|
[4cf89a8] | 98 | /* |
---|
| 99 | * For external ethernet controller board the following |
---|
| 100 | * parameters are needed |
---|
| 101 | */ |
---|
| 102 | unsigned int port; /* port of the board */ |
---|
| 103 | unsigned int irno; /* irq of the board */ |
---|
| 104 | unsigned int bpar; /* memory of the board */ |
---|
[d9d75fc] | 105 | |
---|
[39e6e65a] | 106 | }; |
---|
| 107 | |
---|
| 108 | struct rtems_bsdnet_config { |
---|
| 109 | /* |
---|
| 110 | * This entry points to the head of the ifconfig chain. |
---|
| 111 | */ |
---|
| 112 | struct rtems_bsdnet_ifconfig *ifconfig; |
---|
| 113 | |
---|
| 114 | /* |
---|
| 115 | * This entry should be rtems_bsdnet_do_bootp if BOOTP |
---|
| 116 | * is being used to configure the network, and NULL |
---|
| 117 | * if BOOTP is not being used. |
---|
| 118 | */ |
---|
| 119 | void (*bootp)(void); |
---|
| 120 | |
---|
| 121 | /* |
---|
| 122 | * The remaining items can be initialized to 0, in |
---|
| 123 | * which case the default value will be used. |
---|
| 124 | */ |
---|
| 125 | rtems_task_priority network_task_priority; /* 100 */ |
---|
| 126 | unsigned long mbuf_bytecount; /* 64 kbytes */ |
---|
| 127 | unsigned long mbuf_cluster_bytecount; /* 128 kbytes */ |
---|
| 128 | char *hostname; /* BOOTP */ |
---|
| 129 | char *domainname; /* BOOTP */ |
---|
| 130 | char *gateway; /* BOOTP */ |
---|
| 131 | char *log_host; /* BOOTP */ |
---|
| 132 | char *name_server[3]; /* BOOTP */ |
---|
[a0af97d] | 133 | char *ntp_server[3]; /* BOOTP */ |
---|
[39e6e65a] | 134 | }; |
---|
| 135 | extern struct rtems_bsdnet_config rtems_bsdnet_config; |
---|
| 136 | int rtems_bsdnet_initialize_network (void); |
---|
| 137 | void rtems_bsdnet_do_bootp (void); |
---|
[cbccd37] | 138 | int rtems_bsdnet_synchronize_ntp (int interval, rtems_task_priority priority); |
---|
[39e6e65a] | 139 | |
---|
| 140 | #endif /* _RTEMS_BSDNET_ */ |
---|