![]() |
Contiki-NG
|
NAT64 socket-based IPv4 forwarding for the native platform. More...
#include "contiki.h"#include "nat64.h"#include "nat64-platform.h"#include "nat64-tcp.h"#include "sys/platform.h"#include <arpa/inet.h>#include <errno.h>#include <fcntl.h>#include <netinet/in.h>#include <string.h>#include <sys/socket.h>#include <unistd.h>#include "sys/log.h"Go to the source code of this file.
Functions | |
| static uint8_t | errno_to_icmp6_code (int err) |
| Map a Linux errno to an ICMPv6 Destination Unreachable code. | |
| static void | expire_session (struct nat64_session *s) |
| Reap an expired session, notifying its peer if applicable. | |
| int | nat64_platform_udp_send (const uip_ip4addr_t *dst, uint16_t dstport, const uip_ip6addr_t *ip6_src, uint16_t srcport, const uint8_t *payload, uint16_t len) |
| Forward a UDP payload to an IPv4 server. | |
| struct nat64_session * | nat64_platform_tcp_connect (const uip_ip4addr_t *dst, uint16_t dstport, const uip_ip6addr_t *ip6_src, uint16_t srcport, uint32_t peer_isn) |
| Initiate a TCP connection to an IPv4 server. | |
| int | nat64_platform_tcp_send (struct nat64_session *s, const uint8_t *data, uint16_t len) |
| Send data on an established TCP session. | |
| void | nat64_platform_tcp_close (struct nat64_session *s) |
| Half-close a TCP session (send FIN). | |
| void | nat64_platform_tcp_destroy (struct nat64_session *s) |
| Fully tear down a TCP session. | |
| void | nat64_platform_tcp_abort (struct nat64_session *s) |
| Abort a TCP session by sending RST upstream. | |
| int | nat64_platform_icmp_send (const uip_ip4addr_t *dst, const uip_ip6addr_t *ip6_src, uint16_t identifier, const uint8_t *icmp_pkt, uint16_t icmp_len) |
| Forward an ICMPv4 Echo Request to an IPv4 destination. | |
| bool | nat64_platform_init (void) |
| Initialize the platform layer. | |
| bool | nat64_is_enabled (void) |
| Check whether the NAT64 gateway has been enabled at runtime. | |
NAT64 socket-based IPv4 forwarding for the native platform.
Implements the platform layer (nat64-platform.h) using BSD sockets on Linux/macOS. Each NAT64 session owns one non-blocking socket (UDP, TCP, or unprivileged ICMP) that is registered with the native main-loop select callback. Inbound data is delivered to the protocol-agnostic core via nat64_udp_input / nat64_tcp_data_in / nat64_icmp_input, and socket-level errors are translated into ICMPv6 Destination Unreachable codes returned to the IoT node.
Definition in file nat64-sock.c.