UbixOS V2 2.0

Data Structures | Macros | Functions | Variables
arp.c File Reference
`#include <sys/types.h>`
`#include <lib/kprintf.h>`
`#include "net/debug.h"`
`#include "net/ipv4/inet.h"`
`#include "netif/arp.h"`
`#include "net/ipv4/ip.h"`
Include dependency graph for arp.c:

Go to the source code of this file.

## Data Structures
struct | arp_entry
struct | arp_hdr
struct | ethip_hdr

## Macros
#define | ARP_MAXAGE 2 /* 120 * 10 seconds = 20 minutes. */
#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
struct pbuf * | arp_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)
struct eth_addr * | arp_lookup (struct ip_addr *ipaddr)
struct pbuf * | arp_query (struct netif *netif, struct eth_addr *ethaddr, struct ip_addr *ipaddr)
void | arp_tmr (void)

## Variables
PACK_STRUCT_BEGIN struct arp_hdr | PACK_STRUCT_STRUCT

## Macro Definition Documentation

## ◆ ARP_MAXAGE

#define ARP_MAXAGE 2 /* 120 * 10 seconds = 20 minutes. */

Definition at line 46 of file arp.c.

## ◆ ARP_REPLY

#define ARP_REPLY 2

Definition at line 51 of file arp.c.

## ◆ ARP_REQUEST

#define ARP_REQUEST 1

Definition at line 50 of file arp.c.

## ◆ ARPH_HWLEN

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

Definition at line 68 of file arp.c.

## ◆ ARPH_HWLEN_SET

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

Definition at line 72 of file arp.c.

## ◆ ARPH_PROTOLEN

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

Definition at line 69 of file arp.c.

## ◆ ARPH_PROTOLEN_SET

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

Definition at line 73 of file arp.c.

## ◆ HWTYPE_ETHERNET

#define HWTYPE_ETHERNET 1

Definition at line 48 of file arp.c.

## Function Documentation

## ◆ arp_arp_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 ARP_REPLY, ARP_REQUEST, ARPH_HWLEN_SET, ARPH_PROTOLEN_SET, ETHTYPE_ARP, ETHTYPE_IP, htons, HWTYPE_ETHERNET, ip_addr_cmp, ip_addr_set, kprintf(), NULL, pbuf::payload, pbuf_free(), and pbuf::tot_len.

Here is the call graph for this function:

## ◆ arp_init()

void arp_init | ( | void |  | ) |

Definition at line 93 of file arp.c.

References ARP_TABLE_SIZE, and ip_addr_set.

## ◆ arp_ip_input()

void arp_ip_input | ( | struct netif * | netif,
|  | struct pbuf * | p
| ) |  |

Definition at line 181 of file arp.c.

References pbuf::payload.

## ◆ arp_lookup()

struct eth_addr* arp_lookup | ( | struct ip_addr * | ipaddr | ) |

Definition at line 260 of file arp.c.

References ARP_TABLE_SIZE, and ip_addr_cmp.

## ◆ arp_query()

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

Definition at line 273 of file arp.c.

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

Here is the call graph for this function:

## ◆ arp_tmr()

void arp_tmr | ( | void |  | ) |

Definition at line 104 of file arp.c.

## Variable Documentation

## ◆ PACK_STRUCT_STRUCT

PACK_STRUCT_BEGIN struct arp_hdr PACK_STRUCT_STRUCT