Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals

uIP Address Resolution Protocol
[The uIP TCP/IP stack]


Detailed Description

The Address Resolution Protocol ARP is used for mapping between IP addresses and link level addresses such as the Ethernet MAC addresses. ARP uses broadcast queries to ask for the link level address of a known IP address and the host which is configured with the IP address for which the query was meant, will respond with its link level address.

ARP (ÁÖ¼Ò °áÁ¤ ÇÁ·ÎÅäÄÝ)Àº IP ÁÖ¼Ò¿Í ÀÌ´õ³Ý MAC ÁÖ¼Ò¿Í °°Àº ¸µÅ©·¹º§ ÁÖ¼Ò¿ÍÀÇ ¸ÅÇÎÀ» À§Çؼ­ »ç¿ëµÈ´Ù. ARP´Â ¾Ë·ÁÁø IP ÁÖ¼ÒÀÇ ¸µÅ©·¹º§ ÁÖ¼Ò¸¦ ¿äûÇϱâ À§ÇÑ Äõ¸®¸¦ ºê·ÎƮij½ºÆ®·Î »ç¿ëÇϰí Äõ¸®¿¡ ¿äûµÈ IP ÁÖ¼Ò·Î ¼³Á¤µÈ È£½ºÆ®´Â ¸µÅ©·¹º§ ÁÖ¼Ò¸¦ ÀÀ´äÇÒ °ÍÀÌ´Ù.


Note:
This ARP implementation only supports Ethernet.

ÀÌ ARP´Â ¿ÀÁ÷ ÀÌ´õ³Ý¸¸À» Áö¿øÇÏ°Ô ±¸ÇöµÇ¾ú´Ù.


Files

file  uip_arp.c
 Implementation of the ARP Address Resolution Protocol.
ARP(ÁÖ¼Ò °áÁ¤ ÇÁ·ÎÅäÄÝ)ÀÇ ±¸Çö.

file  uip_arp.h
 Macros and definitions for the ARP module.
ARP ¸ðµâÀ» À§ÇÑ ¸ÅÅ©·Î¿Í Á¤ÀÇ.


Data Structures

struct  uip_eth_addr
 Representation of a 48-bit Ethernet address.
48-bit ÀÌ´õ³Ý ÁÖ¼ÒÀÇ Ç¥Çö. More...

struct  uip_eth_hdr
 The Ethernet header.
ÀÌ´õ³Ý Çì´õ More...


Functions

void uip_arp_init (void)
 Initialize the ARP module.
ARP ¸ðµâÀÇ ÃʱâÈ­.

void uip_arp_ipin (void)
 ARP processing for incoming IP packets.
µé¾î¿À´Â IP ÆÐŶ¿¡ ´ëÇÑ ARP ó¸®.

void uip_arp_arpin (void)
 ARP processing for incoming ARP packets.
µé¾î¿À´Â ARP ÆÐŶ¿¡ ´ëÇÑ ARP ó¸®

void uip_arp_out (void)
 Prepend Ethernet header to an outbound IP packet and see if we need to send out an ARP request.
³ª°¡´Â IP ÆÐŶ¿¡ ´ëÇÑ ÀÌ´õ³Ý Çì´õÀÇ »ðÀÔ°ú ARP ¿äû Àü¼ÛÀÌ ÇÊ¿äÇÒ °æ¿ì º»´Ù.

void uip_arp_timer (void)
 Periodic ARP processing function.
ÁÖ±âÀû ARP ó¸® ÇÔ¼ö.


Function Documentation

void uip_arp_arpin void   ) 
 

ARP processing for incoming ARP packets.

µé¾î¿À´Â ARP ÆÐŶ¿¡´ëÇÑ ARP ÇÁ·Î¼¼½Ì


This function should be called by the device driver when an ARP packet has been received. The function will act differently depending on the ARP packet type: if it is a reply for a request that we previously sent out, the ARP cache will be filled in with the values from the ARP reply. If the incoming ARP packet is an ARP request for our IP address, an ARP reply packet is created and put into the uip_buf[] buffer.

ÀÌ ÇÔ¼ö´Â ARP ÆÐŶÀ» ¹Þ¾ÒÀ»¶§ µð¹ÙÀ̽º µå¶óÀ̹ö¿¡ ÀÇÇØ¼­ È£ÃâµÈ´Ù. ÀÌ ÇÔ¼ö´Â ARP ÆÐŶ ŸÀÔ¿¡ µû¶ó¼­ ´Ù¸£°Ô µ¿ÀÛÇÒ °ÍÀÌ´Ù. ¸¸¾à ¾Õ¼­ Àü¼ÛµÈ ¿äû¿¡ ´ëÇÑ ÀÀ´äÀÏ °æ¿ì ARP ij½¬´Â ARP ÀÀ´ä¿¡ ´ëÇÑ °ªÀ¸·Î ä¿öÁú °ÍÀÌ´Ù. ¸¸¾à µé¾î¿À´Â ARP ÆÐŶÀÌ ¿ì¸®ÀÇ IP ÁÖ¼Ò¿¡ ´ëÇÑ ARP ¿äûÀϰæ¿ì ARP ÀÀ´ä ÆÐŶÀÌ »ý¼ºµÇ°í uip_buf[] ¹öÆÛ¿¡ ä¿öÁø´Ù.


When the function returns, the value of the global variable uip_len indicates whether the device driver should send out a packet or not. If uip_len is zero, no packet should be sent. If uip_len is non-zero, it contains the length of the outbound packet that is present in the uip_buf[] buffer.

ÇÔ¼ö°¡ ¸®Å쵃 °æ¿ì Àü¿ª º¯¼ö uip_lenÀÇ °ªÀº µð¹ÙÀ̽º µå¶óÀ̹ö°¡ ÆÐŶÀ» º¸³Â´ÂÁö ¾Æ´ÑÁö¸¦ °¡¸£Å²´Ù. ¸¸¾à uip_lenÀÌ 0ÀÌ¸é ÆÐŶÀº Àü¼ÛµÇÁö ¾Ê¾Ò´Ù. ¸¸¾à uip_lenÀÌ 0ÀÌ ¾Æ´Ï¸é ±×°ÍÀº uip_buf[] ¹öÆÛ¿¡ Á¸ÀçÇÏ´Â ¿ÜºÎ·Î Àü¼ÛµÈ ÆÐŶÀÇ ±æÀ̸¦ Æ÷ÇÔÇÑ´Ù.


This function expects an ARP packet with a prepended Ethernet header in the uip_buf[] buffer, and the length of the packet in the global variable uip_len.

ÀÌ ÇÔ¼ö´Â uip_buf ¹öÆÛ¿¡ ÀÌ´õ³Ý Çì´õ¸¦ Ãß°¡ÇÑ ARP ÆÐŶ°ú Àü¿ª º¯¼ö uip_len¿¡´Â ÆÐŶÀÇ ±æÀ̸¦ ¿ä±¸ÇÑ´Ù.

void uip_arp_ipin void   ) 
 

ARP processing for incoming IP packets.

µé¾î¿À´Â IP ÆÐŶÀ» À§ÇÑ ARP ó¸®.


This function should be called by the device driver when an IP packet has been received. The function will check if the address is in the ARP cache, and if so the ARP cache entry will be refreshed. If no ARP cache entry was found, a new one is created.

ÀÌ ÇÔ¼ö´Â IP ÆÐŶÀÌ ÁÖ¾î Á³À»¶§ µð¹ÙÀ̽º µå¶óÀ̹ö¿¡ ÀÇÇØ È£ÃâµÇ¾î¾ß ÇÕ´Ï´Ù. ±× ÁÖ¼Ò°¡ ARP ij½Ã¿¡ ÀÖ´ÂÁö °Ë»ç ÇÕ´Ï´Ù. ÀÖ´Ù¸é ARP ij½Ã¸¦ RefreshÇÕ´Ï´Ù.


This function expects an IP packet with a prepended Ethernet header in the uip_buf[] buffer, and the length of the packet in the global variable uip_len.

ÀÌ ÇÔ¼ö´Â uip_buf[] ¹öÆÛ, ±×¸®°í Àü¿ª º¯¼ö uip_len¿¡ ÀÖ´Â ÆÐŶÀÇ ±æÀÌ¿¡¼­ ÀÌ´õ³Ý Çì´õ¸¦ Àß¶ó³¾ IP ÆÐŶÀ» ±â´Ù¸³´Ï´Ù.

void uip_arp_out void   ) 
 

Prepend Ethernet header to an outbound IP packet and see if we need to send out an ARP request.

¿ÜºÎ·Î ³ª°¡´Â ÆÐŶ¿¡ ÀÌ´õ³Ý Çì´õ¸¦ Ãß°¡ÇÏ°í ³ª°¡´Â ARP ¿äûÀÌ ÇÊ¿äÇÒ°æ¿ì º»´Ù.


This function should be called before sending out an IP packet. The function checks the destination IP address of the IP packet to see what Ethernet MAC address that should be used as a destination MAC address on the Ethernet.

ÀÌ ÇÔ¼ö´Â IP ÆÐŶÀ» Àü¼ÛÇϱâ Àü¿¡ È£ÃâµÇ¾î¾ß ÇÑ´Ù. ÇÔ¼ö´Â ÀÌ´õ³Ý ¸ñÀûÁö MAC ÁÖ¼Ò·Î »ç¿ëµÉ ÀÌ´õ³Ý MAC ÁÖ¼Ò¸¦ º¸±â À§ÇÑ IP ÆÐŶÀÇ ¸ñÀûÁö IP ÁÖ¼Ò¸¦ üũÇÑ´Ù.


If the destination IP address is in the local network (determined by logical ANDing of netmask and our IP address), the function checks the ARP cache to see if an entry for the destination IP address is found. If so, an Ethernet header is prepended and the function returns. If no ARP cache entry is found for the destination IP address, the packet in the uip_buf[] is replaced by an ARP request packet for the IP address. The IP packet is dropped and it is assumed that they higher level protocols (e.g., TCP) eventually will retransmit the dropped packet.

¸¸¾à ¸ñÀûÁö IP ÁÖ¼Ò°¡ ·ÎÄà ³×Æ®¿öÅ©(³í¸® ³Ý¸¶½ºÅ©ÀÇ ANDing°ú ¿ì¸®ÀÇ IP ÁÖ¼Ò¿¡ ÀÇÇØ¼­ °áÁ¤)À̸é ÇÔ¼ö´Â ¸ñÀûÁö IP ÁÖ¼ÒÀÇ ¿£Æ²°¡ ¹ß°ßµÉ °æ¿ì ARP ij½¬¸¦ üũÇÑ´Ù. ¸¸¾à ÀÌ´õ³Ý Çì´õ°¡ Ãß°¡µÇ¸é ÇÔ¼ö´Â ¸®ÅÏÇÑ´Ù. ¸¸¾à ARP ij½¬ ¿£Æ®¸®°¡ ¸ñÀûÁö IPÁÖ¼Ò¸¦ À§Çؼ­ ¹ß°ßµÇÁö ¾ÊÀ¸¸é uip_buf[]¿¡ ÆÐŶÀº IP address¸¦ À§ÇÑ ARP ¿äû ÆÐŶ¿¡ ÀÇÇØ¼­ ±³Ã¼µÈ´Ù. IP ÆÐŶÀº µå¶øµÇ°í °á±¹Àº ´õ »óÀ§ ·¹º§ÀÇ ÇÁ·ÎÅäÄÝ( TCP¿Í °°Àº)¿¡¼­ µå¶øµÈ ÆÐŶÀ» ÀçÀü¼Û ÇÒ °ÍÀÌ´Ù.


If the destination IP address is not on the local network, the IP address of the default router is used instead.

¸¸¾à ¸ñÀûÁö IP ÁÖ¼Ò°¡ ·ÎÄà ³×Æ®¿öÅ©¿¡ ÀÖÁö ¾ÊÀ¸¸é ±âº» ¶ó¿ìÅÍÀÇ IP ÁÖ¼Ò°¡ ´ë½Å »ç¿ëµÈ´Ù.


When the function returns, a packet is present in the uip_buf[] buffer, and the length of the packet is in the global variable uip_len.

ÇÔ¼ö°¡ ¸®Åϵɶ§ ÆÐŶÀº uip_buf[] ¹öÆÛ¿¡ Á¸ÀçÇÏ°í ÆÐŶÀÇ ±æÀÌ´Â Àü¿ª º¯¼ö uip_len¿¡ Á¸ÀçÇÑ´Ù.

void uip_arp_timer void   ) 
 

Periodic ARP processing function.

ÁÖ±âÀûÀÎ ARP ó¸® ÇÔ¼ö


This function performs periodic timer processing in the ARP module and should be called at regular intervals. The recommended interval is 10 seconds between the calls.

ÀÌ ÇÔ¼ö´Â ARP ¸ðµâÀÇ ÁÖ±âÀûÀΠŸÀÌ¸Ó ÇÁ·Î¼¼½ÌÀ» ¼öÇàÇϰí Á¤±âÀûÀÎ °£°Ý¿¡ ÀÇÇØ¼­ È£ÃâµÇ¾î¾ß ÇÑ´Ù. È£ÃâµÇ´Â ½Ã°£ÀÇ ±ÇÀå °£°ÝÀº 10ÃÊÀÌ´Ù.


Generated on Tue Oct 7 15:51:44 2003 for uIP 0.9 by doxygen 1.3.3