The network configuration is specified by declaring
and initializing the rtems_bsdnet_config
structure.
struct rtems_bsdnet_config { /* * This entry points to the head of the ifconfig chain. */ struct rtems_bsdnet_ifconfig *ifconfig; /* * This entry should be rtems_bsdnet_do_bootp if BOOTP * is being used to configure the network, and NULL * if BOOTP is not being used. */ void (*bootp)(void); /* * The remaining items can be initialized to 0, in * which case the default value will be used. */ rtems_task_priority network_task_priority; /* 100 */ unsigned long mbuf_bytecount; /* 64 kbytes */ unsigned long mbuf_cluster_bytecount; /* 128 kbytes */ char *hostname; /* BOOTP */ char *domainname; /* BOOTP */ char *gateway; /* BOOTP */ char *log_host; /* BOOTP */ char *name_server[3]; /* BOOTP */ char *ntp_server[3]; /* BOOTP */ unsigned long sb_efficiency; /* 2 */ /* UDP TX: 9216 bytes */ unsigned long udp_tx_buf_size; /* UDP RX: 40 * (1024 + sizeof(struct sockaddr_in)) */ unsigned long udp_rx_buf_size; /* TCP TX: 16 * 1024 bytes */ unsigned long tcp_tx_buf_size; /* TCP TX: 16 * 1024 bytes */ unsigned long tcp_rx_buf_size; };
The structure entries are described in the following table. If your application uses BOOTP/DHCP to obtain network configuration information and if you are happy with the default values described below, you need to provide only the first two entries in this structure.
struct rtems_bsdnet_ifconfig *ifconfig
void (*bootp)(void)
rtems_bsdnet_do_bootp
if your
application by default uses the BOOTP/DHCP client protocol to obtain
network configuration information. It should be set to NULL
if
your application does not use BOOTP/DHCP.
You can also use rtems_bsdnet_do_bootp_rootfs
to have a set of
standard files created with the information return by the BOOTP/DHCP
protocol. The IP address is added to `/etc/hosts
' with the host
name and domain returned. If no host name or domain is returned
me.mydomain
is used. The BOOTP/DHCP server's address is also
added to `/etc/hosts
'. The domain name server listed in the
BOOTP/DHCP information are added to `/etc/resolv.conf
'. A
search
record is also added if a domain is returned. The files
are created if they do not exist.
The default rtems_bsdnet_do_bootp
and
rtems_bsdnet_do_bootp_rootfs
handlers will loop for-ever
waiting for a BOOTP/DHCP server to respond. If an error is detected
such as not valid interface or valid hardware address the target will
reboot allowing any hardware reset to correct itself.
You can provide your own custom handler which allows you to perform an initialization that meets your specific system requirements. For example you could try BOOTP/DHCP then enter a configuration tool if no server is found allowing the user to switch to a static configuration.
int network_task_priority
unsigned long mbuf_bytecount
unsigned long mbuf_cluster_bytecount
char *hostname
NULL
the value
may be obtained from a BOOTP/DHCP server.
char *domainname
char *gateway
129.128.4.1
) form.
char *log_host
syslog
messages
will be sent.
char *name_server[3]
char *ntp_server[3]
unsigned long sb_efficiency
8
to 2
.
The user should also be aware of the SO_SNDBUF
and SO_RCVBUF
IO control operations. These can be used to specify the
send and receive buffer sizes for a specific socket. There
is no standard IO control to change the sb_efficiency
factor.
The sb_efficiency
parameter is a buffering factor used
in the implementation of the TCP/IP stack. The default is 2
which indicates double buffering. When allocating memory for each
socket, this number is multiplied by the buffer sizes for that socket.
unsigned long udp_tx_buf_size
unsigned long udp_rx_buf_size
40 * (1024 + sizeof(struct sockaddr_in)
unsigned long tcp_tx_buf_size
unsigned long tcp_rx_buf_size
In addition, the following fields in the rtems_bsdnet_ifconfig
are of interest.
Copyright © 1988-2008 OAR Corporation