diff options
Diffstat (limited to 'translate.c')
| -rw-r--r-- | translate.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/translate.c b/translate.c index 599182d..00ea0b9 100644 --- a/translate.c +++ b/translate.c @@ -278,6 +278,22 @@ int icmp6_to_icmp(clat_packet out, int pos, const struct icmp6_hdr *icmp6, return clat_packet_len; } +/* function: generic_packet + * takes a generic IP packet and sets it up for translation + * out - output packet + * pos - position in the output packet of the transport header + * payload - pointer to IP payload + * len - size of ip payload + * returns: the highest position in the output clat_packet that's filled in + */ +int generic_packet(clat_packet out, int pos, const char *payload, size_t len) { + out[pos].iov_len = 0; + out[CLAT_POS_PAYLOAD].iov_base = (char *) payload; + out[CLAT_POS_PAYLOAD].iov_len = len; + + return CLAT_POS_PAYLOAD + 1; +} + /* function: udp_packet * takes a udp packet and sets it up for translation * out - output packet |
