diff mbox

[U-Boot,RFC,1/8] Initial net6.h

Message ID 1444635794-16285-2-git-send-email-judge.packham@gmail.com
State RFC
Delegated to: Joe Hershberger
Headers show

Commit Message

Chris Packham Oct. 12, 2015, 7:43 a.m. UTC
The initial net6.h just has the definition of an IPv6 address and IPv6
header. Subsequent changes will build on this.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
---
It may make sense to include this in net.h but for now I haven't done
so.

 include/net6.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 include/net6.h

Comments

Joe Hershberger Nov. 2, 2015, 8:32 p.m. UTC | #1
Hi Chris,

On Mon, Oct 12, 2015 at 2:43 AM, Chris Packham <judge.packham@gmail.com> wrote:
> The initial net6.h just has the definition of an IPv6 address and IPv6
> header. Subsequent changes will build on this.
>
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> ---
> It may make sense to include this in net.h but for now I haven't done
> so.

I think it's good to keep it separate to start.

>  include/net6.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 48 insertions(+)
>  create mode 100644 include/net6.h
>
> diff --git a/include/net6.h b/include/net6.h
> new file mode 100644
> index 0000000..b622951
> --- /dev/null
> +++ b/include/net6.h
> @@ -0,0 +1,48 @@
> +/**
> + * Simple IPv6 network layer implementation.
> + *
> + * Based and/or adapted from the IPv4 network layer in net.[hc]
> + *
> + * (C) Copyright 2013 Allied Telesis Labs NZ
> + *
> + * SPDX-License-Identifier:    GPL-2.0+
> + */
> +#ifndef __NET6_H__
> +#define __NET6_H__
> +
> +struct in6_addr {
> +       union {
> +               __u8    u6_addr8[16];
> +               __be16  u6_addr16[8];
> +               __be32  u6_addr32[4];
> +       } in6_u;
> +
> +#define s6_addr                in6_u.u6_addr8
> +#define s6_addr16      in6_u.u6_addr16
> +#define s6_addr32      in6_u.u6_addr32
> +};
> +
> +/**
> + * struct ipv6hdr - Internet Protocol V6 (IPv6) header.
> + *
> + * IPv6 packet header as defined in RFC 2460.
> + */
> +struct ip6_hdr {
> +#if defined(__LITTLE_ENDIAN_BITFIELD)
> +       __u8    priority:4,
> +               version:4;
> +#elif defined(__BIG_ENDIAN_BITFIELD)
> +       __u8    version:4,
> +               priority:4;
> +#else
> +#error  "Please fix <asm/byteorder.h>"
> +#endif
> +       __u8            flow_lbl[3];
> +       __be16          payload_len;
> +       __u8            nexthdr;
> +       __u8            hop_limit;
> +       struct in6_addr saddr;
> +       struct in6_addr daddr;
> +};
> +
> +#endif /* __NET6_H__ */
> --
> 2.5.3
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
diff mbox

Patch

diff --git a/include/net6.h b/include/net6.h
new file mode 100644
index 0000000..b622951
--- /dev/null
+++ b/include/net6.h
@@ -0,0 +1,48 @@ 
+/**
+ * Simple IPv6 network layer implementation.
+ *
+ * Based and/or adapted from the IPv4 network layer in net.[hc]
+ *
+ * (C) Copyright 2013 Allied Telesis Labs NZ
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+#ifndef __NET6_H__
+#define __NET6_H__
+
+struct in6_addr {
+	union {
+		__u8	u6_addr8[16];
+		__be16	u6_addr16[8];
+		__be32	u6_addr32[4];
+	} in6_u;
+
+#define s6_addr		in6_u.u6_addr8
+#define s6_addr16	in6_u.u6_addr16
+#define s6_addr32	in6_u.u6_addr32
+};
+
+/**
+ * struct ipv6hdr - Internet Protocol V6 (IPv6) header.
+ *
+ * IPv6 packet header as defined in RFC 2460.
+ */
+struct ip6_hdr {
+#if defined(__LITTLE_ENDIAN_BITFIELD)
+	__u8    priority:4,
+		version:4;
+#elif defined(__BIG_ENDIAN_BITFIELD)
+	__u8    version:4,
+		priority:4;
+#else
+#error  "Please fix <asm/byteorder.h>"
+#endif
+	__u8		flow_lbl[3];
+	__be16		payload_len;
+	__u8		nexthdr;
+	__u8		hop_limit;
+	struct in6_addr	saddr;
+	struct in6_addr	daddr;
+};
+
+#endif /* __NET6_H__ */