2 * Copyright (c) 2013, 2014 Alexandru Copot <alex.mihai.c@gmail.com>, with support from IXIA.
3 * Copyright (c) 2013, 2014 Daniel Baluta <dbaluta@ixiacom.com>
4 * Copyright (c) 2014, 2015 Nicira, Inc.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at:
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
22 #include <sys/types.h>
32 struct ofp_bundle_entry {
34 ovs_be32 xid; /* For error returns. */
35 enum ofptype type; /* OFPTYPE_FLOW_MOD or OFPTYPE_PORT_MOD. */
37 struct ofputil_flow_mod fm; /* 'fm.ofpacts' must be malloced. */
38 struct ofputil_port_mod pm;
48 struct hmap_node node; /* In struct ofconn's "bundles" hmap. */
51 enum bundle_state state;
53 /* List of 'struct bundle_message's */
54 struct ovs_list msg_list;
57 static inline struct ofp_bundle_entry *ofp_bundle_entry_alloc(
58 enum ofptype type, ovs_be32 xid);
59 static inline void ofp_bundle_entry_free(struct ofp_bundle_entry *);
61 enum ofperr ofp_bundle_open(struct ofconn *, uint32_t id, uint16_t flags);
62 enum ofperr ofp_bundle_close(struct ofconn *, uint32_t id, uint16_t flags);
63 enum ofperr ofp_bundle_commit(struct ofconn *, uint32_t id, uint16_t flags);
64 enum ofperr ofp_bundle_discard(struct ofconn *, uint32_t id);
65 enum ofperr ofp_bundle_add_message(struct ofconn *, uint32_t id,
66 uint16_t flags, struct ofp_bundle_entry *);
68 void ofp_bundle_remove__(struct ofconn *ofconn, struct ofp_bundle *bundle);
70 static inline struct ofp_bundle_entry *
71 ofp_bundle_entry_alloc(enum ofptype type, ovs_be32 xid)
73 struct ofp_bundle_entry *entry = xmalloc(sizeof *entry);
81 static inline void ofp_bundle_entry_free(struct ofp_bundle_entry *entry)
84 if (entry->type == OFPTYPE_FLOW_MOD) {
85 free(entry->fm.ofpacts);