Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
(ARM).Porting TCP-IP programmer's guide.Ver 1.6.pdf
Скачиваний:
43
Добавлен:
23.08.2013
Размер:
2.64 Mб
Скачать

TCP/IP Porting

2.5Specifying IP addresses

Before you can test your stack, you must set up some basic IP addressing information. The ARM stack offers the latest protocols for setting up IP addresses, but it still requires additional information from both the porting programmer and the end user.

2.5.1Porting programmer IP issues

You must first assign a valid IP address to each interface.

Caution

You must assign these addresses as part of the port. If the IP address values are not correctly set, your stack might not work and you might even disable other users on the net. If you do not know which values to use, ask your network administrator or refer to Internetworking with TCP/IP, by Douglas E. Comer, on IP addressing.

Fill in the n_ipaddr member of the net structure for each interface. (The net structure is discussed in detail in Network interfaces on page 3-14.) This must be done before or during the network interfaces n_init() call. You must also set the fields for n_defgw (default router) and snmask (subnet mask). These three values are collectively referred to as the IP addressing information.

Note

In little-endian systems, these addresses are stored in network byte order (big-endian format) rather than little-endian. Refer to the n_ipaddr setup code in \inet\macloop.c for a portable example that works on both big-endian and little-endian architectures.

2-18

Copyright © 1998-2001 ARM Limited. All rights reserved.

ARM DUI 0144B

TCP/IP Porting

2.5.2End user IP issues

A product issue you will encounter is how the end user assigns the IP addresses. Traditionally, the end user was required to sit down at a console attached to the device, usually a serial terminal attached to an RS-232 port, and key in an IP address, subnet mask, default router, and possibly other information. The IP address information was stored in permanent storage (NVRAM or disk) and read each time the machine was booted.

Although it is still a good idea to support manual IP address assignment, more recent IP technology has developed several easier ways to do this, most notably DHCP. For a description of the ARM DHCP client functions, see Chapter 4 DHCP Client Functions.

ARM DUI 0144B

Copyright © 1998-2001 ARM Limited. All rights reserved.

2-19