aboutgitcodebugslistschat
path: root/udp_internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'udp_internal.h')
-rw-r--r--udp_internal.h31
1 files changed, 22 insertions, 9 deletions
diff --git a/udp_internal.h b/udp_internal.h
index a09f3c6..cc80e30 100644
--- a/udp_internal.h
+++ b/udp_internal.h
@@ -6,16 +6,29 @@
#ifndef UDP_INTERNAL_H
#define UDP_INTERNAL_H
-#define UDP_CONN_TIMEOUT 180 /* s, timeout for ephemeral or local bind */
+#include "tap.h" /* needed by udp_meta_t */
+
#define UDP_MAX_FRAMES 32 /* max # of frames to receive at once */
-extern struct sockaddr_in udp4_localname;
-extern struct sockaddr_in6 udp6_localname;
+/**
+ * struct udp_payload_t - UDP header and data for inbound messages
+ * @uh: UDP header
+ * @data: UDP data
+ */
+struct udp_payload_t {
+ struct udphdr uh;
+ char data[USHRT_MAX - sizeof(struct udphdr)];
+#ifdef __AVX2__
+} __attribute__ ((packed, aligned(32)));
+#else
+} __attribute__ ((packed, aligned(__alignof__(unsigned int))));
+#endif
-size_t udp_update_hdr4(const struct ctx *c, struct iphdr *iph,
- size_t data_len, struct sockaddr_in *s_in,
- in_port_t dstport, const struct timespec *now);
-size_t udp_update_hdr6(const struct ctx *c, struct ipv6hdr *ip6h,
- size_t data_len, struct sockaddr_in6 *s_in6,
- in_port_t dstport, const struct timespec *now);
+size_t udp_update_hdr4(struct iphdr *ip4h, struct udp_payload_t *bp,
+ const struct flowside *toside, size_t dlen,
+ bool no_udp_csum);
+size_t udp_update_hdr6(struct ipv6hdr *ip6h, struct udp_payload_t *bp,
+ const struct flowside *toside, size_t dlen,
+ bool no_udp_csum);
+int udp_sock_errs(const struct ctx *c, int s, uint32_t events);
#endif /* UDP_INTERNAL_H */