summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/ip_types.api
blob: af8f6231285eec21b4a69f634b03de47c28829c9 (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
/* Hey Emacs use -*- mode: C -*- */
/*
 * Copyright (c) 2018 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

typedef u8 ip4_address[4];
typedef u8 ip6_address[16];

enum address_family {
  ADDRESS_IP4 = 0,
  ADDRESS_IP6,
};

/* ECN code points - RFC 3168
   https://tools.ietf.org/html/rfc3168
*/
enum ip_ecn : u8 {
  IP_API_ECN_NONE = 0,
  IP_API_ECN_ECT0 = 1,
  IP_API_ECN_ECT1 = 2,
  IP_API_ECN_CE = 3,
};

/* DSCP code points - RFC 2474
   https://tools.ietf.org/html/rfc2474
   Values other than these RFC defined values are accepted.
*/
enum ip_dscp : u8 {
  IP_API_DSCP_CS0 =  0,
  IP_API_DSCP_CS1 = 8,
  IP_API_DSCP_AF11 = 10,
  IP_API_DSCP_AF12 = 12,
  IP_API_DSCP_AF13 = 14,
  IP_API_DSCP_CS2 =  16,
  IP_API_DSCP_AF21 = 18,
  IP_API_DSCP_AF22 = 20,
  IP_API_DSCP_AF23 = 22,
  IP_API_DSCP_CS3 =  24,
  IP_API_DSCP_AF31 = 26,
  IP_API_DSCP_AF32 = 28,
  IP_API_DSCP_AF33 = 30,
  IP_API_DSCP_CS4 =  32,
  IP_API_DSCP_AF41 = 34,
  IP_API_DSCP_AF42 = 36,
  IP_API_DSCP_AF43 = 38,
  IP_API_DSCP_CS5 =  40,
  IP_API_DSCP_EF =   46,
  IP_API_DSCP_CS6 =  48,
  IP_API_DSCP_CS7 =  50,
};

enum ip_proto {
  IP_API_PROTO_HOPOPT = 0,
  IP_API_PROTO_ICMP = 1,
  IP_API_PROTO_IGMP = 2,
  IP_API_PROTO_TCP = 6,
  IP_API_PROTO_UDP = 17,
  IP_API_PROTO_GRE = 47,
  IP_API_PROTO_AH = 50,
  IP_API_PROTO_ESP = 51,
  IP_API_PROTO_EIGRP = 88,
  IP_API_PROTO_OSPF = 89,
  IP_API_PROTO_SCTP = 132,
  IP_API_PROTO_RESERVED = 255,
};

union address_union {
  vl_api_ip4_address_t ip4;
  vl_api_ip6_address_t ip6;
};

typedef address {
  vl_api_address_family_t af;
  vl_api_address_union_t un;
};

typedef prefix {
  vl_api_address_t address;
  u8 len;
};

typedef mprefix {
  vl_api_address_family_t af;
  u16 grp_address_length;
  vl_api_address_union_t grp_address;
  vl_api_address_union_t src_address;
};

typedef ip6_prefix {
  vl_api_ip6_address_t address;
  u8 len;
};

typedef ip4_prefix {
  vl_api_ip4_address_t address;
  u8 len;
};

/** \brief A context for matching prefixes against.  (Think ip prefix list.)
    The meaning (exact match / want subnets) of an unset matcher is left to the implementer.
    @param le - le mut be <= to prefix.len. Default: 255 (not set).
    @param ge - ge must be greater than le and <= max_size of prefix. Default: 255 (not set).

*/
typedef prefix_matcher {
  u8 le; /* [default=255] */
  u8 ge; /* [default=255] */
};