arp.c File Reference

#include <ubixos/types.h>
#include <lib/kprintf.h>
#include "net/debug.h"
#include "net/ipv4/inet.h"
#include "netif/arp.h"
#include "net/ipv4/ip.h"

Go to the source code of this file.

Data Structures

struct  arp_entry
struct  arp_hdr
struct  ethip_hdr

Defines

#define ARP_MAXAGE   2
#define ARP_REPLY   2
#define ARP_REQUEST   1
#define ARPH_HWLEN(hdr)   (NTOHS((hdr)->_hwlen_protolen) >> 8)
#define ARPH_HWLEN_SET(hdr, len)   (hdr)->_hwlen_protolen = HTONS(ARPH_PROTOLEN(hdr) | ((len) << 8))
#define ARPH_PROTOLEN(hdr)   (NTOHS((hdr)->_hwlen_protolen) & 0xff)
#define ARPH_PROTOLEN_SET(hdr, len)   (hdr)->_hwlen_protolen = HTONS((len) | (ARPH_HWLEN(hdr) << 8))
#define HWTYPE_ETHERNET   1

Functions

static void add_arp_entry (struct ip_addr *ipaddr, struct eth_addr *ethaddr)
pbufarp_arp_input (struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p)
void arp_init (void)
void arp_ip_input (struct netif *netif, struct pbuf *p)
eth_addrarp_lookup (struct ip_addr *ipaddr)
pbufarp_query (struct netif *netif, struct eth_addr *ethaddr, struct ip_addr *ipaddr)
void arp_tmr (void)

Variables

static struct arp_entry arp_table [ARP_TABLE_SIZE]
static uInt8 ctime
PACK_STRUCT_BEGIN struct arp_hdr PACK_STRUCT_STRUCT


Define Documentation

#define ARP_MAXAGE   2

Definition at line 46 of file arp.c.

Referenced by arp_tmr().

#define ARP_REPLY   2

Definition at line 51 of file arp.c.

Referenced by arp_arp_input().

#define ARP_REQUEST   1

Definition at line 50 of file arp.c.

Referenced by arp_arp_input(), and arp_query().

#define ARPH_HWLEN ( hdr   )     (NTOHS((hdr)->_hwlen_protolen) >> 8)

Definition at line 68 of file arp.c.

#define ARPH_HWLEN_SET ( hdr,
len   )     (hdr)->_hwlen_protolen = HTONS(ARPH_PROTOLEN(hdr) | ((len) << 8))

Definition at line 72 of file arp.c.

Referenced by arp_arp_input(), and arp_query().

#define ARPH_PROTOLEN ( hdr   )     (NTOHS((hdr)->_hwlen_protolen) & 0xff)

Definition at line 69 of file arp.c.

#define ARPH_PROTOLEN_SET ( hdr,
len   )     (hdr)->_hwlen_protolen = HTONS((len) | (ARPH_HWLEN(hdr) << 8))

Definition at line 73 of file arp.c.

Referenced by arp_arp_input(), and arp_query().

#define HWTYPE_ETHERNET   1

Definition at line 48 of file arp.c.

Referenced by arp_arp_input(), and arp_query().


Function Documentation

static void add_arp_entry ( struct ip_addr ipaddr,
struct eth_addr ethaddr 
) [static]

Definition at line 120 of file arp.c.

References arp_table, ARP_TABLE_SIZE, ctime, arp_entry::ctime, arp_entry::ethaddr, ip_addr_cmp, ip_addr_isany, ip_addr_set, and arp_entry::ipaddr.

Referenced by arp_arp_input(), and arp_ip_input().

struct pbuf* arp_arp_input ( struct netif netif,
struct eth_addr ethaddr,
struct pbuf p 
)

Definition at line 197 of file arp.c.

References add_arp_entry(), ARP_REPLY, ARP_REQUEST, ARPH_HWLEN_SET, ARPH_PROTOLEN_SET, ETHTYPE_ARP, ETHTYPE_IP, htons, HWTYPE_ETHERNET, netif::ip_addr, ip_addr_cmp, ip_addr_set, kprintf(), NULL, pbuf::payload, pbuf_free(), and pbuf::tot_len.

Referenced by ethernetif_input().

void arp_init ( void   ) 

Definition at line 93 of file arp.c.

References arp_table, ARP_TABLE_SIZE, IP_ADDR_ANY, ip_addr_set, and arp_entry::ipaddr.

Referenced by ethernetif_init().

void arp_ip_input ( struct netif netif,
struct pbuf p 
)

Definition at line 181 of file arp.c.

References add_arp_entry(), ARP_DEBUG, DEBUGF, netif::ip_addr, ip_addr_maskcmp, netif::netmask, and pbuf::payload.

Referenced by ethernetif_input().

struct eth_addr* arp_lookup ( struct ip_addr ipaddr  ) 

Definition at line 253 of file arp.c.

References arp_table, ARP_TABLE_SIZE, ip_addr_cmp, and NULL.

Referenced by ethernetif_output().

struct pbuf* arp_query ( struct netif netif,
struct eth_addr ethaddr,
struct ip_addr ipaddr 
)

Definition at line 266 of file arp.c.

References ARP_REQUEST, ARPH_HWLEN_SET, ARPH_PROTOLEN_SET, ETHTYPE_ARP, ETHTYPE_IP, htons, HWTYPE_ETHERNET, netif::ip_addr, ip_addr_set, NULL, pbuf::payload, pbuf_alloc(), PBUF_LINK, and PBUF_RAM.

Referenced by ethernetif_output().

void arp_tmr ( void   ) 

Definition at line 104 of file arp.c.

References ARP_DEBUG, ARP_MAXAGE, arp_table, ARP_TABLE_SIZE, ctime, DEBUGF, IP_ADDR_ANY, ip_addr_isany, ip_addr_set, and arp_entry::ipaddr.

Referenced by arp_timer().


Variable Documentation

struct arp_entry arp_table[ARP_TABLE_SIZE] [static]

Definition at line 88 of file arp.c.

Referenced by add_arp_entry(), arp_init(), arp_lookup(), and arp_tmr().

uInt8 ctime [static]

Definition at line 89 of file arp.c.

Referenced by add_arp_entry(), and arp_tmr().

PACK_STRUCT_BEGIN struct arp_hdr PACK_STRUCT_STRUCT


Generated on Sun Dec 3 02:38:10 2006 for UbixOS V2 by  doxygen 1.4.7