source: rtems/cpukit/libnetworking/rtems/rtems_bsdnet.h @ a3dfa39

4.104.114.84.95
Last change on this file since a3dfa39 was ce452f7, checked in by Eric Norum <WENorum@…>, on 11/01/02 at 18:43:57

* empty log message *

  • Property mode set to 100644
File size: 4.7 KB
Line 
1/*
2 *  $Id$
3 */
4
5#ifndef _RTEMS_BSDNET_
6#define _RTEMS_BSDNET_
7
8#include <rtems.h>
9
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
32/*
33 * Values that may be obtained by BOOTP
34 */
35extern struct in_addr rtems_bsdnet_bootp_server_address;
36extern char *rtems_bsdnet_bootp_server_name;
37extern char *rtems_bsdnet_bootp_boot_file_name;
38extern char *rtems_bsdnet_bootp_cmdline;
39extern struct in_addr rtems_bsdnet_ntpserver[];
40extern int rtems_bsdnet_ntpserver_count;
41extern long rtems_bsdnet_timeoffset;
42
43/*
44 * Manipulate routing tables
45 */
46struct sockaddr;
47struct rtentry;
48int rtems_bsdnet_rtrequest (
49    int req,
50    struct sockaddr *dst,
51    struct sockaddr *gateway,
52    struct sockaddr *netmask,
53    int flags,
54    struct rtentry **net_nrt);
55
56/*
57 * Diagnostics
58 */
59void rtems_bsdnet_show_inet_routes (void);
60void rtems_bsdnet_show_mbuf_stats (void);
61void rtems_bsdnet_show_if_stats (void);
62void rtems_bsdnet_show_ip_stats (void);
63void rtems_bsdnet_show_icmp_stats (void);
64void rtems_bsdnet_show_udp_stats (void);
65void rtems_bsdnet_show_tcp_stats (void);
66
67/*
68 * Network configuration
69 */
70struct rtems_bsdnet_ifconfig {
71        /*
72         * These three entries must be supplied for each interface.
73         */
74        char            *name;
75
76        /*
77         * This function now handles attaching and detaching an interface.
78         * The parameter attaching indicates the operation being invoked.
79         * For older attach functions which do not have the extra parameter
80         * it will be ignored.
81         */
82        int             (*attach)(struct rtems_bsdnet_ifconfig *conf, int attaching);
83
84        /*
85         * Link to next interface
86         */
87        struct rtems_bsdnet_ifconfig *next;
88
89        /*
90         * The following entries may be obtained
91         * from BOOTP or explicitily supplied.
92         */
93        char            *ip_address;
94        char            *ip_netmask;
95        void            *hardware_address;
96
97        /*
98         * The driver assigns defaults values to the following
99         * entries if they are not explicitly supplied.
100         */
101        int             ignore_broadcast;
102        int             mtu;
103        int             rbuf_count;
104        int             xbuf_count;
105
106        /*
107         * For external ethernet controller board the following
108         * parameters are needed
109         */
110        unsigned int    port;   /* port of the board */
111        unsigned int    irno;   /* irq of the board */
112        unsigned int    bpar;   /* memory of the board */
113
114  /*
115   * Driver control block pointer. Typcially this points to the driver's
116   * controlling structure. You set this when you have the structure allocated
117   * externally to the driver.
118   */
119  void *drv_ctrl;
120
121};
122
123struct rtems_bsdnet_config {
124        /*
125         * This entry points to the head of the ifconfig chain.
126         */
127        struct rtems_bsdnet_ifconfig *ifconfig;
128
129        /*
130         * This entry should be rtems_bsdnet_do_bootp if BOOTP
131         * is being used to configure the network, and NULL
132         * if BOOTP is not being used.
133         */
134        void                    (*bootp)(void);
135
136        /*
137         * The remaining items can be initialized to 0, in
138         * which case the default value will be used.
139         */
140        rtems_task_priority     network_task_priority;  /* 100          */
141        unsigned long           mbuf_bytecount;         /* 64 kbytes    */
142        unsigned long           mbuf_cluster_bytecount; /* 128 kbytes   */
143        char                    *hostname;              /* BOOTP        */
144        char                    *domainname;            /* BOOTP        */
145        char                    *gateway;               /* BOOTP        */
146        char                    *log_host;              /* BOOTP        */
147        char                    *name_server[3];        /* BOOTP        */
148        char                    *ntp_server[3];         /* BOOTP        */
149};
150
151/*
152 * Default global device configuration structure. This is scanned
153 * by the initialize network function. Check the network demo's for
154 * an example of the structure. Like the RTEMS configuration tables,
155 * they are not part of RTEMS but part of your application or bsp
156 * code.
157 */
158extern struct rtems_bsdnet_config rtems_bsdnet_config;
159
160/*
161 * Initialise the BSD stack, attach and `up' interfaces
162 * in the `rtems_bsdnet_config'. RTEMS must already be initialised.
163 */
164int rtems_bsdnet_initialize_network (void);
165
166/*
167 * Dynamic interface control. Drivers must free any resources such as
168 * memory, interrupts, io regions claimed during the `attach' and/or
169 * `up' operations when asked to `detach'.
170 * You must configure the interface after attaching it.
171 */
172void rtems_bsdnet_attach (struct rtems_bsdnet_ifconfig *ifconfig);
173void rtems_bsdnet_detach (struct rtems_bsdnet_ifconfig *ifconfig);
174
175/*
176 * Interface configuration. The commands are listed in `sys/sockio.h'.
177 */
178int rtems_bsdnet_ifconfig (const char *ifname, unsigned32 cmd, void *param);
179
180void rtems_bsdnet_do_bootp (void);
181void rtems_bsdnet_do_bootp_and_rootfs (void);
182
183int rtems_bsdnet_synchronize_ntp (int interval, rtems_task_priority priority);
184
185#endif /* _RTEMS_BSDNET_ */
Note: See TracBrowser for help on using the repository browser.