}
struct ofpbuf *
-make_add_flow(const struct flow *flow, uint32_t buffer_id,
- uint16_t idle_timeout, size_t actions_len)
+make_flow_mod(uint16_t command, const struct flow *flow, size_t actions_len)
{
struct ofp_flow_mod *ofm;
size_t size = sizeof *ofm + actions_len;
ofm->match.nw_proto = flow->nw_proto;
ofm->match.tp_src = flow->tp_src;
ofm->match.tp_dst = flow->tp_dst;
- ofm->command = htons(OFPFC_ADD);
+ ofm->command = htons(command);
+ return out;
+}
+
+struct ofpbuf *
+make_add_flow(const struct flow *flow, uint32_t buffer_id,
+ uint16_t idle_timeout, size_t actions_len)
+{
+ struct ofpbuf *out = make_flow_mod(OFPFC_ADD, flow, actions_len);
+ struct ofp_flow_mod *ofm = out->data;
ofm->idle_timeout = htons(idle_timeout);
ofm->hard_timeout = htons(OFP_FLOW_PERMANENT);
ofm->buffer_id = htonl(buffer_id);
return out;
}
+struct ofpbuf *
+make_del_flow(const struct flow *flow)
+{
+ struct ofpbuf *out = make_flow_mod(OFPFC_DELETE_STRICT, flow, 0);
+ struct ofp_flow_mod *ofm = out->data;
+ ofm->out_port = htons(OFPP_NONE);
+ return out;
+}
+
struct ofpbuf *
make_add_simple_flow(const struct flow *flow,
uint32_t buffer_id, uint16_t out_port,
-/* Copyright (c) 2008 The Board of Trustees of The Leland Stanford
+/* Copyright (c) 2008, 2009 The Board of Trustees of The Leland Stanford
* Junior University
*
* We are making the OpenFlow specification and associated documentation
void *put_openflow_xid(size_t openflow_len, uint8_t type, uint32_t xid,
struct ofpbuf *);
void update_openflow_length(struct ofpbuf *);
+struct ofpbuf *make_flow_mod(uint16_t command, const struct flow *,
+ size_t actions_len);
struct ofpbuf *make_add_flow(const struct flow *, uint32_t buffer_id,
uint16_t max_idle, size_t actions_len);
+struct ofpbuf *make_del_flow(const struct flow *);
struct ofpbuf *make_add_simple_flow(const struct flow *,
uint32_t buffer_id, uint16_t out_port,
uint16_t max_idle);