Pass around packet data instead of fds

The current code calls all the translation functions one after
another, accumulating the translated packet into local variables
on the stack and calling writev() at the end. This does not allow
calling the translation functions re-entrantly, which is needed,
for example, to translate ICMP errors (which contain the
packet that caused them). Define a clat_packet type to wrap the
array of iovecs and an enum of packet positions.

Also clean up the code a bit: get rid of a fair bit of duplicated
code (though there is still some left), get rid of some redundant
memcpy statements, fix style issues, etc.

Bug: 8276725
Change-Id: Ib58d2348894e82275234fc67dbdb1f82753f204f
diff --git a/ipv6.h b/ipv6.h
index b898ad9..019de17 100644
--- a/ipv6.h
+++ b/ipv6.h
@@ -18,6 +18,8 @@
 #ifndef __IPV6_H__
 #define __IPV6_H__
 
-void ipv6_packet(int fd, const char *packet, size_t len);
+#include "translate.h"
+
+int ipv6_packet(clat_packet out, int pos, const char *packet, size_t len);
 
 #endif /* __IPV6_H__ */