summaryrefslogtreecommitdiff
path: root/include/uapi/linux/ioam6.h
blob: 2177e4e495666fd36deccccc16b69903b78f191b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
 *  IPv6 IOAM implementation
 *
 *  Author:
 *  Justin Iurman <justin.iurman@uliege.be>
 */

#ifndef _UAPI_LINUX_IOAM6_H
#define _UAPI_LINUX_IOAM6_H

#include <asm/byteorder.h>
#include <linux/types.h>

/*
 * IPv6 IOAM Option Header
 */
struct ioam6_hdr {
	__u8 opt_type;
	__u8 opt_len;
	__u8 :8;				/* reserved */
#define IOAM6_TYPE_PREALLOC 0
	__u8 type;
} __attribute__((packed));

/*
 * IOAM Trace Header
 */
struct ioam6_trace_hdr {
	__be16	namespace_id;

#if defined(__LITTLE_ENDIAN_BITFIELD)

	__u8	:1,				/* unused */
		:1,				/* unused */
		overflow:1,
		nodelen:5;

	__u8	remlen:7,
		:1;				/* unused */

	union {
		__be32 type_be32;

		struct {
			__u32	bit7:1,
				bit6:1,
				bit5:1,
				bit4:1,
				bit3:1,
				bit2:1,
				bit1:1,
				bit0:1,
				bit15:1,	/* unused */
				bit14:1,	/* unused */
				bit13:1,	/* unused */
				bit12:1,	/* unused */
				bit11:1,
				bit10:1,
				bit9:1,
				bit8:1,
				bit23:1,	/* reserved */
				bit22:1,
				bit21:1,	/* unused */
				bit20:1,	/* unused */
				bit19:1,	/* unused */
				bit18:1,	/* unused */
				bit17:1,	/* unused */
				bit16:1,	/* unused */
				:8;		/* reserved */
		} type;
	};

#elif defined(__BIG_ENDIAN_BITFIELD)

	__u8	nodelen:5,
		overflow:1,
		:1,				/* unused */
		:1;				/* unused */

	__u8	:1,				/* unused */
		remlen:7;

	union {
		__be32 type_be32;

		struct {
			__u32	bit0:1,
				bit1:1,
				bit2:1,
				bit3:1,
				bit4:1,
				bit5:1,
				bit6:1,
				bit7:1,
				bit8:1,
				bit9:1,
				bit10:1,
				bit11:1,
				bit12:1,	/* unused */
				bit13:1,	/* unused */
				bit14:1,	/* unused */
				bit15:1,	/* unused */
				bit16:1,	/* unused */
				bit17:1,	/* unused */
				bit18:1,	/* unused */
				bit19:1,	/* unused */
				bit20:1,	/* unused */
				bit21:1,	/* unused */
				bit22:1,
				bit23:1,	/* reserved */
				:8;		/* reserved */
		} type;
	};

#else
#error "Please fix <asm/byteorder.h>"
#endif

	__u8	data[0];
} __attribute__((packed));

#endif /* _UAPI_LINUX_IOAM6_H */