Contiki-NG
ip64-arp.h
1 /*
2  * Copyright (c) 2001-2003, Adam Dunkels.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. The name of the author may not be used to endorse or promote
14  * products derived from this software without specific prior
15  * written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
18  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  *
29  * This file is part of the uIP TCP/IP stack.
30  *
31  * $Id: uip_arp.h,v 1.2 2006/08/26 23:58:45 oliverschmidt Exp $
32  *
33  */
34 
35 #ifndef IP64_ARP_H
36 #define IP64_ARP_H
37 
38 #include "net/ipv6/uip.h"
39 
40 #include "ip64/ip64-eth.h"
41 
42 
43 /* The uip_arp_init() function must be called before any of the other
44  ARP functions. */
45 void ip64_arp_init(void);
46 
47 /* The uip_arp_ipin() function should be called whenever an IP packet
48  arrives from the Ethernet. This function refreshes the ARP table or
49  inserts a new mapping if none exists. The function assumes that an
50  IP packet with an Ethernet header is present in the uip_buf buffer
51  and that the length of the packet is in the uip_len variable. */
52 void ip64_arp_ip_input(const uint8_t *packet, uint16_t packet_len);
53 
54 /* The uip_arp_arpin() should be called when an ARP packet is received
55  by the Ethernet driver. This function also assumes that the
56  Ethernet frame is present in the uip_buf buffer. When the
57  uip_arp_arpin() function returns, the contents of the uip_buf
58  buffer should be sent out on the Ethernet if the uip_len variable
59  is > 0. */
60 uint16_t ip64_arp_arp_input(const uint8_t *packet, uint16_t packet_len);
61 
62 /* The uip_arp_out() function should be called when an IP packet
63  should be sent out on the Ethernet. This function creates an
64  Ethernet header before the IP header in the uip_buf buffer. The
65  Ethernet header will have the correct Ethernet MAC destination
66  address filled in if an ARP table entry for the destination IP
67  address (or the IP address of the default router) is present. If no
68  such table entry is found, the IP packet is overwritten with an ARP
69  request and we rely on TCP to retransmit the packet that was
70  overwritten. In any case, the uip_len variable holds the length of
71  the Ethernet frame that should be transmitted. */
72 void ip64_arp_ip_output(uint8_t *packet, uint16_t packet_len);
73 
74 
75 int ip64_arp_create_ethhdr(uint8_t *link_header,
76  const uint8_t *network_header);
77 
78 int ip64_arp_create_arp_request(uint8_t *link_header,
79  const uint8_t *network_header);
80 
81 int ip64_arp_check_cache(const uint8_t *nlhdr);
82 
83 
84 #endif /* IP64_ARP_H */
Header file for the uIP TCP/IP stack.