dpif-netdev: use the open_type when creating the local port
[cascardo/ovs.git] / lib / tun-metadata.h
1 /*
2  * Copyright (c) 2015 Nicira, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef TUN_METADATA_H
18 #define TUN_METADATA_H 1
19
20 #include <stdint.h>
21
22 #include "openvswitch/dynamic-string.h"
23 #include "netlink.h"
24 #include "openvswitch/ofpbuf.h"
25 #include "openflow/openflow.h"
26 #include "openvswitch/tun-metadata.h"
27
28 struct flow_tnl;
29 struct match;
30 struct mf_field;
31 union mf_value;
32 struct ofputil_tlv_table_mod;
33 struct ofputil_tlv_table_reply;
34 struct tun_table;
35
36 void tun_metadata_init(void);
37
38 enum ofperr tun_metadata_table_mod(struct ofputil_tlv_table_mod *);
39 void tun_metadata_table_request(struct ofputil_tlv_table_reply *);
40
41 void tun_metadata_read(const struct flow_tnl *,
42                        const struct mf_field *, union mf_value *);
43 void tun_metadata_write(struct flow_tnl *,
44                         const struct mf_field *, const union mf_value *);
45 void tun_metadata_set_match(const struct mf_field *,
46                             const union mf_value *value,
47                             const union mf_value *mask, struct match *,
48                             char **err_str);
49 void tun_metadata_get_fmd(const struct flow_tnl *, struct match *flow_metadata);
50
51 int tun_metadata_from_geneve_nlattr(const struct nlattr *attr,
52                                     const struct nlattr *flow_attrs,
53                                     size_t flow_attr_len,
54                                     const struct flow_tnl *flow_tun,
55                                     bool udpif, struct flow_tnl *tun);
56 void tun_metadata_to_geneve_nlattr(const struct flow_tnl *tun,
57                                    const struct flow_tnl *flow,
58                                    const struct ofpbuf *key,
59                                    struct ofpbuf *);
60
61 int tun_metadata_from_geneve_udpif(const struct flow_tnl *flow,
62                                    const struct flow_tnl *src,
63                                    struct flow_tnl *dst);
64 void tun_metadata_to_geneve_udpif_mask(const struct flow_tnl *flow_src,
65                                        const struct flow_tnl *mask_src,
66                                        const struct geneve_opt *flow_src_opt,
67                                        int opts_len, struct geneve_opt *dst);
68
69 int tun_metadata_to_geneve_header(const struct flow_tnl *flow,
70                                   struct geneve_opt *, bool *crit_opt);
71
72 void tun_metadata_to_nx_match(struct ofpbuf *b, enum ofp_version oxm,
73                               const struct match *);
74 void tun_metadata_match_format(struct ds *, const struct match *);
75
76 #endif /* tun-metadata.h */