source: rtems/c/src/exec/libnetworking/rtems/rtems_bsdnet.h @ 6f93bb4

4.104.114.84.95
Last change on this file since 6f93bb4 was 6f93bb4, checked in by Joel Sherrill <joel.sherrill@…>, on 06/14/00 at 17:18:18

Patch from Chris Johns <cjohns@…> to enhance network
initialization. This adds an interface which makes it easier to
control the BSD stack from user code. The BSD stack initialise uses
it. It is a sort of `function' interface for an ifconfig
command.

I also added support for attaching and removing interfaces. With hot
swap PCI comming online support for hot swap PCI will be an important
factor in "state of art" RTOS's. This is also part of a general move on
my part to allow RTEMS to be configured at runtime by calls rather than
table driven at initialisation.

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