File: packet6.def

package info (click to toggle)
tcng 10b-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,644 kB
  • sloc: ansic: 19,040; pascal: 4,640; yacc: 2,619; sh: 1,914; perl: 1,546; lex: 772; makefile: 751
file content (92 lines) | stat: -rw-r--r-- 3,676 bytes parent folder | download | duplicates (5)
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
/*
 * packet6.def - Definitions for constructing IPv6 packets, analogous to
 *		 fields.tc
 *
 * Written 2002 by Werner Almesberger
 * Copyright 2002 Bivio Networks, Werner Almesberger
 */

#ifndef __INCLUDED_FROM_PACKET_DEF
#warning packet6.def should only be included from packet.def
#endif

#ifndef PACKET6_DEF
#define PACKET6_DEF


/* ----- Global convenience defaults --------------------------------------- */

/*
 * WARNING: Since tcsim variables are global, these defaults change as soon
 * as the variables are assigned some other value anywhere in the tcsim
 * script. Therefore, they can only be relied upon if the scripts does not
 * set them at all.
 */

$ip6_nxt = 0			// next header: reserved (RFC1700)
$ip6_src = ::			// source address: unspecified (RFC2373)
$ip6_dst = ::			// destination address: unspecified (RFC2373)


/* ----- IPv6 header (RFC2460) --------------------------------------------- */


#define IP6_HDR(params) \
  $ip6_v = 6		/* version					*/ \
  $ip6_tc = 0		/* traffic class (0 for default)		*/ \
  $ip6_flow = 0		/* flow label (0 for "not supported")		*/ \
  $ip6_plen = 0		/* payload length (FIXME: should calculate)	*/ \
			/* next header, REQUIRED			*/ \
  $ip6_hlim = 64	/* hop limit, use 64 from RFC1700 (?)		*/ \
			/* source address, REQUIRED			*/ \
			/* destination address, REQUIRED		*/ \
									\
  params								\
									\
  /* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+	*/ \
  /* |Version| Traffic Class |           Flow Label                  |	*/ \
  /* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+	*/ \
									\
  nl: ($ip6_v << 28) | ($ip6_tc << 20) | $ip6_flow			\
									\
  /* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+	*/ \
  /* |         Payload Length        |  Next Header  |   Hop Limit   |	*/ \
  /* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+	*/ \
									\
  ns: $ip6_plen								\
  $ip6_nxt								\
  $ip6_hlim								\
									\
  /* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+	*/ \
  /* |                                                               |	*/ \
  /* +                                                               +	*/ \
  /* |                                                               |	*/ \
  /* +                         Source Address                        +	*/ \
  /* |                                                               |	*/ \
  /* +                                                               +	*/ \
  /* |                                                               |	*/ \
  /* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+	*/ \
									\
  ipv6: $ip6_src							\
									\
  /* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+	*/ \
  /* |                                                               |	*/ \
  /* +                                                               +	*/ \
  /* |                                                               |	*/ \
  /* +                      Destination Address                      +	*/ \
  /* |                                                               |	*/ \
  /* +                                                               +	*/ \
  /* |                                                               |	*/ \
  /* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+	*/ \
									\
  ipv6: $ip6_dst							\
									\
  /* ----- End of header ----- */


/* ----- Packed construction ----------------------------------------------- */

#define IP6_PCK(params) \
  default protocol=ETH_P_IPV6 IP6_HDR(params)

#endif /* PACKET6_DEF */