#include "ip64.h"
#include "ip64-addr.h"
#include "ip64-addrmap.h"
#include "ip64-conf.h"
#include "ip64-special-ports.h"
#include "ip64-eth-interface.h"
#include "ip64-tap-driver.h"
#include "ip64-slip-interface.h"
#include "ip64-ipv4-dhcp.h"
#include "contiki-net.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "net/ip/uip-debug.h"
Data Structures | |
struct | icmpv4_hdr |
struct | icmpv6_hdr |
struct | ipv4_hdr |
struct | ipv6_hdr |
struct | tcp_hdr |
struct | udp_hdr |
Macros | |
#define | _DEBUG_ 0 |
#define | BUFSIZE UIP_BUFSIZE |
#define | DEFAULT_LIFETIME (CLOCK_SECOND * 60 * 5) |
#define | EPHEMERAL_PORTRANGE 1024 |
#define | ICMP6_ECHO 128 |
#define | ICMP6_ECHO_REPLY 129 |
#define | ICMP_ECHO 8 |
#define | ICMP_ECHO_REPLY 0 |
#define | IP_PROTO_ICMPV4 1 |
#define | IP_PROTO_ICMPV6 58 |
#define | IP_PROTO_TCP 6 |
#define | IP_PROTO_UDP 17 |
#define | IPV4_HDRLEN 20 |
#define | IPV6_HDRLEN 40 |
#define | PRINTF(...) |
#define | RST_LIFETIME (CLOCK_SECOND * 30) |
#define | SYN_LIFETIME (CLOCK_SECOND * 20) |
#define | TCP_FIN 0x01 |
#define | TCP_RST 0x04 |
#define | TCP_SYN 0x02 |
Functions | |
static uint16_t | chksum (uint16_t sum, const uint8_t *data, uint16_t len) |
static void | interface_init (void) |
static void | interface_output (void) |
int | ip64_4to6 (const uint8_t *ipv4packet, const uint16_t ipv4packet_len, uint8_t *resultpacket) |
int | ip64_6to4 (const uint8_t *ipv6packet, const uint16_t ipv6packet_len, uint8_t *resultpacket) |
void | ip64_conv (uip_ip4addr_t *addr, char ipadr[]) |
const uip_ip4addr_t * | ip64_get_draddr (void) |
const uip_ip4addr_t * | ip64_get_hostaddr (void) |
const uip_ip4addr_t * | ip64_get_netmask (void) |
int | ip64_hostaddr_is_configured (void) |
void | ip64_init (void) |
void | ip64_set_draddr (const uip_ip4addr_t *draddr) |
void | ip64_set_hostaddr (const uip_ip4addr_t *hostaddr) |
void | ip64_set_ipv4_address (const uip_ip4addr_t *addr, const uip_ip4addr_t *netmask) |
void | ip64_set_ipv6_address (const uip_ip6addr_t *addr) |
void | ip64_set_netmask (const uip_ip4addr_t *netmask) |
static uint16_t | ipv4_checksum (struct ipv4_hdr *hdr) |
static uint16_t | ipv4_transport_checksum (const uint8_t *packet, uint16_t len, uint8_t proto) |
static uint16_t | ipv6_transport_checksum (const uint8_t *packet, uint16_t len, uint8_t proto) |
Variables | |
static uip_ip4addr_t | ip64_draddr |
static uip_ip4addr_t | ip64_hostaddr |
static uint8_t | ip64_hostaddr_configured = 0 |
static uip_ip4addr_t | ip64_netmask |
uint8_t * | ip64_packet_buffer = ip64_packet_buffer_aligned.u8 |
uip_buf_t | ip64_packet_buffer_aligned |
uint16_t | ip64_packet_buffer_maxlen = BUFSIZE |
struct uip_fallback_interface | ip64_uip_fallback_interface |
static uint16_t | ipid |
static uip_ip4addr_t | ipv4_broadcast_addr |
static uip_ip6addr_t | ipv6_local_address |
static uint8_t | ipv6_local_address_configured = 0 |
#define _DEBUG_ 0 |
#define BUFSIZE UIP_BUFSIZE |
Referenced by ip64_4to6().
#define DEFAULT_LIFETIME (CLOCK_SECOND * 60 * 5) |
Referenced by ip64_6to4().
#define EPHEMERAL_PORTRANGE 1024 |
Referenced by ip64_4to6(), and ip64_6to4().
#define ICMP6_ECHO 128 |
Referenced by ip64_4to6().
#define ICMP6_ECHO_REPLY 129 |
Referenced by ip64_6to4().
#define ICMP_ECHO 8 |
Referenced by ip64_4to6().
#define ICMP_ECHO_REPLY 0 |
Referenced by ip64_6to4().
#define IP_PROTO_ICMPV4 1 |
Referenced by ip64_4to6(), ip64_6to4(), and ipv4_transport_checksum().
#define IP_PROTO_ICMPV6 58 |
Referenced by ip64_4to6(), and ip64_6to4().
#define IP_PROTO_TCP 6 |
Referenced by ip64_4to6(), and ip64_6to4().
#define IP_PROTO_UDP 17 |
Referenced by ip64_4to6(), and ip64_6to4().
#define IPV4_HDRLEN 20 |
Referenced by ip64_4to6(), ip64_6to4(), ipv4_checksum(), and ipv4_transport_checksum().
#define IPV6_HDRLEN 40 |
Referenced by ip64_4to6(), ip64_6to4(), and ipv6_transport_checksum().
#define PRINTF | ( | ... | ) |
Referenced by interface_output(), ip64_4to6(), ip64_6to4(), ip64_init(), and ip64_set_ipv6_address().
#define RST_LIFETIME (CLOCK_SECOND * 30) |
Referenced by ip64_6to4().
#define SYN_LIFETIME (CLOCK_SECOND * 20) |
Referenced by ip64_6to4().
#define TCP_FIN 0x01 |
Referenced by ip64_6to4().
#define TCP_RST 0x04 |
Referenced by ip64_6to4().
#define TCP_SYN 0x02 |
Referenced by ip64_6to4().
|
static |
References data.
Referenced by ipv4_checksum(), ipv4_transport_checksum(), and ipv6_transport_checksum().
|
static |
References IP64_CONF_UIP_FALLBACK_INTERFACE.
|
static |
References IP64_CONF_UIP_FALLBACK_INTERFACE, PRINTF, and uip_len.
int ip64_4to6 | ( | const uint8_t * | ipv4packet, |
const uint16_t | ipv4packet_len, | ||
uint8_t * | resultpacket | ||
) |
References BUFSIZE, ipv4_hdr::destipaddr, ipv6_hdr::destipaddr, tcp_hdr::destport, udp_hdr::destport, EPHEMERAL_PORTRANGE, ipv6_hdr::flow, ipv6_hdr::hoplim, ICMP6_ECHO, ICMP_ECHO, icmpv6_hdr::icmpchksum, ip64_addr_4to6(), ip64_addr_copy6(), ip64_addrmap_lookup_port(), ip64_special_ports_incoming_is_special(), ip64_special_ports_translate_incoming(), ip64_addrmap_entry::ip6addr, ip64_addrmap_entry::ip6port, IP_PROTO_ICMPV4, IP_PROTO_ICMPV6, IP_PROTO_TCP, IP_PROTO_UDP, IPV4_HDRLEN, IPV6_HDRLEN, ipv6_transport_checksum(), ipv4_hdr::len, ipv6_hdr::len, NULL, ipv6_hdr::nxthdr, PRINTF, ipv4_hdr::proto, ipv4_hdr::srcipaddr, ipv6_hdr::srcipaddr, ipv6_hdr::tcflow, tcp_hdr::tcpchksum, ipv4_hdr::ttl, icmpv4_hdr::type, icmpv6_hdr::type, uip_ip4addr_t::u16, udp_hdr::udpchksum, uip_create_linklocal_allnodes_mcast, uip_htons(), uip_ip4addr_cmp, uip_ipaddr_maskcmp, uip_ipaddr_to_quad, uip_ntohs, and ipv6_hdr::vtc.
Referenced by input_callback(), and ip64_eth_interface_input().
int ip64_6to4 | ( | const uint8_t * | ipv6packet, |
const uint16_t | ipv6packet_len, | ||
uint8_t * | resultpacket | ||
) |
References DEFAULT_LIFETIME, ipv4_hdr::destipaddr, ipv6_hdr::destipaddr, udp_hdr::destport, EPHEMERAL_PORTRANGE, tcp_hdr::flags, ipv6_hdr::hoplim, ICMP6_ECHO_REPLY, ICMP_ECHO_REPLY, icmpv4_hdr::icmpchksum, ip64_addr_6to4(), ip64_addr_copy4(), ip64_addrmap_create(), ip64_addrmap_lookup(), ip64_addrmap_set_lifetime(), ip64_addrmap_set_recycleble(), ip64_special_ports_outgoing_is_special(), ip64_special_ports_translate_outgoing(), IP_PROTO_ICMPV4, IP_PROTO_ICMPV6, IP_PROTO_TCP, IP_PROTO_UDP, ipv4_hdr::ipchksum, ipv4_hdr::ipid, ipv4_hdr::ipoffset, ipv4_checksum(), IPV4_HDRLEN, ipv4_transport_checksum(), IPV6_HDRLEN, ipv6_transport_checksum(), ipv4_hdr::len, ipv6_hdr::len, ip64_addrmap_entry::mapped_port, NULL, ipv6_hdr::nxthdr, PRINTF, ipv4_hdr::proto, RST_LIFETIME, ipv4_hdr::srcipaddr, ipv6_hdr::srcipaddr, udp_hdr::srcport, SYN_LIFETIME, TCP_FIN, TCP_RST, TCP_SYN, tcp_hdr::tcpchksum, ipv4_hdr::tos, ipv4_hdr::ttl, icmpv4_hdr::type, icmpv6_hdr::type, udp_hdr::udpchksum, uip_debug_ipaddr_print(), UIP_HTONS, uip_htons(), uip_ip4addr_cmp, uip_ntohs, and ipv4_hdr::vhl.
Referenced by output().
void ip64_conv | ( | uip_ip4addr_t * | addr, |
char | ipadr[] | ||
) |
References i, NULL, str, and uip_ip4addr_t::u8.
Referenced by ip64_init().
const uip_ip4addr_t* ip64_get_draddr | ( | void | ) |
References ip64_draddr.
Referenced by ip64_arp_check_cache(), ip64_arp_create_arp_request(), and ip64_arp_create_ethhdr().
const uip_ip4addr_t* ip64_get_hostaddr | ( | void | ) |
References ip64_hostaddr.
Referenced by ip64_arp_arp_input(), ip64_arp_check_cache(), ip64_arp_create_arp_request(), and ip64_arp_create_ethhdr().
const uip_ip4addr_t* ip64_get_netmask | ( | void | ) |
References ip64_netmask.
Referenced by ip64_arp_check_cache(), ip64_arp_create_arp_request(), and ip64_arp_create_ethhdr().
int ip64_hostaddr_is_configured | ( | void | ) |
References ip64_hostaddr_configured.
Referenced by PROCESS_THREAD().
void ip64_init | ( | void | ) |
References addr, uip_ds6_netif::addr_list, ADDR_PREFERRED, ADDR_TENTATIVE, i, ip64_conv(), ip64_ipv4_dhcp_init(), ip64_set_draddr(), ip64_set_ipv4_address(), ip64_set_ipv6_address(), uip_ds6_addr::ipaddr, uip_ds6_addr::isused, netmask, PRINTF, uip_ds6_addr::state, state, UIP_DS6_ADDR_NB, uip_ds6_if, and uip_ipaddr.
Referenced by PROCESS_THREAD().
void ip64_set_draddr | ( | const uip_ip4addr_t * | draddr | ) |
References ip64_addr_copy4().
Referenced by ip64_dhcpc_configured(), and ip64_init().
void ip64_set_hostaddr | ( | const uip_ip4addr_t * | hostaddr | ) |
References ip64_addr_copy4().
Referenced by ip64_dhcpc_configured(), and ip64_set_ipv4_address().
void ip64_set_ipv4_address | ( | const uip_ip4addr_t * | addr, |
const uip_ip4addr_t * | netmask | ||
) |
References ip64_set_hostaddr(), ip64_set_netmask(), printf, and uip_ip4addr_t::u8.
Referenced by ip64_init().
void ip64_set_ipv6_address | ( | const uip_ip6addr_t * | addr | ) |
References ip64_addr_copy6(), PRINTF, and uip_debug_ipaddr_print().
Referenced by ip64_init().
void ip64_set_netmask | ( | const uip_ip4addr_t * | netmask | ) |
References ip64_addr_copy4().
Referenced by ip64_dhcpc_configured(), and ip64_set_ipv4_address().
|
static |
References chksum(), IPV4_HDRLEN, and uip_htons().
Referenced by ip64_6to4().
|
static |
References chksum(), IP_PROTO_ICMPV4, IPV4_HDRLEN, ipv4_hdr::proto, ipv4_hdr::srcipaddr, and uip_htons().
Referenced by ip64_6to4().
|
static |
References chksum(), ipv6_hdr::destipaddr, IPV6_HDRLEN, ipv6_hdr::srcipaddr, and uip_htons().
Referenced by ip64_4to6(), and ip64_6to4().
|
static |
Referenced by ip64_get_draddr().
|
static |
Referenced by ip64_get_hostaddr().
|
static |
Referenced by ip64_hostaddr_is_configured().
|
static |
Referenced by ip64_get_netmask().
uint8_t* ip64_packet_buffer = ip64_packet_buffer_aligned.u8 |
Referenced by input_callback(), output(), and PROCESS_THREAD().
uip_buf_t ip64_packet_buffer_aligned |
uint16_t ip64_packet_buffer_maxlen = BUFSIZE |
Referenced by PROCESS_THREAD().
struct uip_fallback_interface ip64_uip_fallback_interface |
|
static |
|
static |
|
static |
|
static |