summaryrefslogtreecommitdiffstats
path: root/translate.h
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2014-02-13 12:53:35 +0900
committerLorenzo Colitti <lorenzo@google.com>2014-02-14 13:51:14 +0900
commitf9390605bacda7bbe8ea33aa0a39c1581ff6aea2 (patch)
tree3f93c576d9a91fa0bac223435bd69b240cbe84cf /translate.h
parent5a50c0283346a197cda7af19e68f611f14b8fe57 (diff)
downloadandroid_external_android-clat-f9390605bacda7bbe8ea33aa0a39c1581ff6aea2.tar.gz
android_external_android-clat-f9390605bacda7bbe8ea33aa0a39c1581ff6aea2.tar.bz2
android_external_android-clat-f9390605bacda7bbe8ea33aa0a39c1581ff6aea2.zip
Move translation entry point into translate.c.
The entry point to the translation code is currently called packet_handler and lives in clatd.c. Move it into translate.c and rename it to translate_packet, since that's what it does. Also get rid of some redundant includes. Bug: 11542311 Change-Id: I8529fb87f3a86ee6724fad54787c33a5e86c56ab
Diffstat (limited to 'translate.h')
-rw-r--r--translate.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/translate.h b/translate.h
index cfb7bbb..3378254 100644
--- a/translate.h
+++ b/translate.h
@@ -18,8 +18,18 @@
#ifndef __TRANSLATE_H__
#define __TRANSLATE_H__
+#include <netinet/in.h>
+#include <netinet/ip.h>
+#include <netinet/ip_icmp.h>
+#include <netinet/udp.h>
+#include <netinet/tcp.h>
+#include <netinet/ip6.h>
+#include <netinet/icmp6.h>
+#include <linux/icmp.h>
#include <linux/if_tun.h>
+#include "clatd.h"
+
#define MAX_TCP_HDR (15 * 4) // Data offset field is 4 bits and counts in 32-bit words.
// A clat_packet is an array of iovec structures representing a packet that we are translating.
@@ -47,6 +57,10 @@ void fill_ip_header(struct iphdr *ip_targ, uint16_t payload_len, uint8_t protoco
void fill_ip6_header(struct ip6_hdr *ip6, uint16_t payload_len, uint8_t protocol,
const struct iphdr *old_header);
+// Translate and send packets.
+void translate_packet(const struct tun_data *tunnel, struct tun_pi *tun_header, const char *packet,
+ size_t packetsize);
+
// Translate IPv4 and IPv6 packets.
int ipv4_packet(clat_packet out, int pos, const char *packet, size_t len);
int ipv6_packet(clat_packet out, int pos, const char *packet, size_t len);