packets: Add in6_is_lla() function.
[cascardo/ovs.git] / ovn / lib / ovn-util.h
1 /*
2  * Licensed under the Apache License, Version 2.0 (the "License");
3  * you may not use this file except in compliance with the License.
4  * You may obtain a copy of the License at:
5  *
6  *     http://www.apache.org/licenses/LICENSE-2.0
7  *
8  * Unless required by applicable law or agreed to in writing, software
9  * distributed under the License is distributed on an "AS IS" BASIS,
10  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11  * See the License for the specific language governing permissions and
12  * limitations under the License.
13  */
14
15
16 #ifndef OVN_UTIL_H
17 #define OVN_UTIL_H 1
18
19 #include "lib/packets.h"
20
21 struct nbrec_logical_router_port;
22
23 struct ipv4_netaddr {
24     ovs_be32 addr;            /* 192.168.10.123 */
25     ovs_be32 mask;            /* 255.255.255.0 */
26     ovs_be32 network;         /* 192.168.10.0 */
27     unsigned int plen;        /* CIDR Prefix: 24. */
28
29     char *addr_s;             /* "192.168.10.123" */
30     char *network_s;          /* "192.168.10.0" */
31     char *bcast_s;            /* "192.168.10.255" */
32 };
33
34 struct ipv6_netaddr {
35     struct in6_addr addr;     /* fc00::1 */
36     struct in6_addr mask;     /* ffff:ffff:ffff:ffff:: */
37     struct in6_addr network;  /* fc00:: */
38     unsigned int plen;        /* CIDR Prefix: 64 */
39
40     char *addr_s;             /* "fc00::1" */
41     char *network_s;          /* "fc00::" */
42 };
43
44 struct lport_addresses {
45     char *ea_s;
46     struct eth_addr ea;
47     size_t n_ipv4_addrs;
48     struct ipv4_netaddr *ipv4_addrs;
49     size_t n_ipv6_addrs;
50     struct ipv6_netaddr *ipv6_addrs;
51 };
52
53
54 bool extract_lsp_addresses(char *address, struct lport_addresses *);
55 bool extract_lrp_networks(const struct nbrec_logical_router_port *,
56                           struct lport_addresses *);
57 void destroy_lport_addresses(struct lport_addresses *);
58
59 char *alloc_nat_zone_key(const char *key, const char *type);
60 #endif