OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [libnetworking/] [rtems/] [rtems_bsdnet.h] - Blame information for rev 1778

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*
2
 *  rtems_bsdnet.h,v 1.11 2002/04/13 16:41:43 joel Exp
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
 */
35
extern struct in_addr rtems_bsdnet_bootp_server_address;
36
extern char *rtems_bsdnet_bootp_server_name;
37
extern char *rtems_bsdnet_bootp_boot_file_name;
38
extern struct in_addr rtems_bsdnet_ntpserver[];
39
extern int rtems_bsdnet_ntpserver_count;
40
extern long rtems_bsdnet_timeoffset;
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 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
   * Driver control block pointer. Typcially this points to the driver's
115
   * controlling structure. You set this when you have the structure allocated
116
   * externally to the driver.
117
   */
118
  void *drv_ctrl;
119
 
120
};
121
 
122
struct rtems_bsdnet_config {
123
        /*
124
         * This entry points to the head of the ifconfig chain.
125
         */
126
        struct rtems_bsdnet_ifconfig *ifconfig;
127
 
128
        /*
129
         * This entry should be rtems_bsdnet_do_bootp if BOOTP
130
         * is being used to configure the network, and NULL
131
         * if BOOTP is not being used.
132
         */
133
        void                    (*bootp)(void);
134
 
135
        /*
136
         * The remaining items can be initialized to 0, in
137
         * which case the default value will be used.
138
         */
139
        rtems_task_priority     network_task_priority;  /* 100          */
140
        unsigned long           mbuf_bytecount;         /* 64 kbytes    */
141
        unsigned long           mbuf_cluster_bytecount; /* 128 kbytes   */
142
        char                    *hostname;              /* BOOTP        */
143
        char                    *domainname;            /* BOOTP        */
144
        char                    *gateway;               /* BOOTP        */
145
        char                    *log_host;              /* BOOTP        */
146
        char                    *name_server[3];        /* BOOTP        */
147
        char                    *ntp_server[3];         /* BOOTP        */
148
};
149
 
150
/*
151
 * Default global device configuration structure. This is scanned
152
 * by the initialize network function. Check the network demo's for
153
 * an example of the structure. Like the RTEMS configuration tables,
154
 * they are not part of RTEMS but part of your application or bsp
155
 * code.
156
 */
157
extern struct rtems_bsdnet_config rtems_bsdnet_config;
158
 
159
/*
160
 * Initialise the BSD stack, attach and `up' interfaces
161
 * in the `rtems_bsdnet_config'. RTEMS must already be initialised.
162
 */
163
int rtems_bsdnet_initialize_network (void);
164
 
165
/*
166
 * Dynamic interface control. Drivers must free any resources such as
167
 * memory, interrupts, io regions claimed during the `attach' and/or
168
 * `up' operations when asked to `detach'.
169
 * You must configure the interface after attaching it.
170
 */
171
void rtems_bsdnet_attach (struct rtems_bsdnet_ifconfig *ifconfig);
172
void rtems_bsdnet_detach (struct rtems_bsdnet_ifconfig *ifconfig);
173
 
174
/*
175
 * Interface configuration. The commands are listed in `sys/sockio.h'.
176
 */
177
int rtems_bsdnet_ifconfig (const char *ifname, unsigned32 cmd, void *param);
178
 
179
void rtems_bsdnet_do_bootp (void);
180
void rtems_bsdnet_do_bootp_and_rootfs (void);
181
 
182
int rtems_bsdnet_synchronize_ntp (int interval, rtems_task_priority priority);
183
 
184
#endif /* _RTEMS_BSDNET_ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.