summaryrefslogtreecommitdiff
path: root/lib/learn.h
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2012-07-03 22:17:14 -0700
committerBen Pfaff <blp@nicira.com>2012-07-03 22:21:11 -0700
commitf25d0cf3c366d92042269a4f787f19c741c2530c (patch)
tree82f6a2973471c4adfcd13cf2bbc8adf8c31b0aba /lib/learn.h
parent690a61c50a4744603be2ee3de8e22c97f9140d94 (diff)
downloadopenvswitch-f25d0cf3c366d92042269a4f787f19c741c2530c.tar.gz
Introduce ofpacts, an abstraction of OpenFlow actions.
OpenFlow actions have always been somewhat awkward to handle. Moreover, over time we've started creating actions that require more complicated parsing. When we maintain those actions internally in their wire format, we end up parsing them multiple times, whenever we have to look at the set of actions. When we add support for OpenFlow 1.1 or later protocols, the situation will get worse, because these newer protocols support many of the same actions but with different representations. It becomes unrealistic to handle each protocol in its wire format. This commit adopts a new strategy, by converting OpenFlow actions into an internal form from the wire format when they are read, and converting them back to the wire format when flows are dumped. I believe that this will be more maintainable over time. Thanks to Simon Horman and Pravin Shelar for reviews. Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/learn.h')
-rw-r--r--lib/learn.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/learn.h b/lib/learn.h
index 28591727c..adf597e92 100644
--- a/lib/learn.h
+++ b/lib/learn.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011 Nicira, Inc.
+ * Copyright (c) 2011, 2012 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@
struct ds;
struct flow;
struct ofpbuf;
+struct ofpact_learn;
struct ofputil_flow_mod;
struct nx_action_learn;
@@ -30,11 +31,15 @@ struct nx_action_learn;
* See include/openflow/nicira-ext.h for NXAST_LEARN specification.
*/
-enum ofperr learn_check(const struct nx_action_learn *, const struct flow *);
-void learn_execute(const struct nx_action_learn *, const struct flow *,
- struct ofputil_flow_mod *);
+enum ofperr learn_from_openflow(const struct nx_action_learn *,
+ struct ofpbuf *ofpacts);
+enum ofperr learn_check(const struct ofpact_learn *, const struct flow *);
+void learn_to_nxast(const struct ofpact_learn *, struct ofpbuf *openflow);
-void learn_parse(struct ofpbuf *, char *, const struct flow *);
-void learn_format(const struct nx_action_learn *, struct ds *);
+void learn_execute(const struct ofpact_learn *, const struct flow *,
+ struct ofputil_flow_mod *, struct ofpbuf *ofpacts);
+
+void learn_parse(char *, const struct flow *, struct ofpbuf *ofpacts);
+void learn_format(const struct ofpact_learn *, struct ds *);
#endif /* learn.h */