[ovs-dev] [PATCH 1/3] ofp-parse: Break string-to-openflow parsing into library functions

Ben Pfaff blp at nicira.com
Thu Jul 29 17:19:13 UTC 2010


On Thu, Jul 29, 2010 at 12:20:30AM -0700, Justin Pettit wrote:
> An upcoming commit will add the ability to load OpenFlow rules into
> ovs-controller.  Break out string-to-openflow parsing so that
> ovs-ofctl and ovs-controller can use the same code.

This is good, thanks.

One possible nit is that I've been trying to avoid "ofp_" prefixes in
new code on stuff not actually provided by OpenFlow; I'm trying to
regard that prefix as reserved by them.  So if you can think of another
name for ofp_str_to_flow(), then I'd like that.

There's trailing white space on a few lines in ofp-parse.c and
ofp-parse.h.  Can you remove it, please?

I would apply the following, to remove unnecessary #includes and keep
the remaining #includes in the order recommended by CodingStyle:

diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c
index 1a71aa3..70b3fde 100644
--- a/lib/ofp-parse.c
+++ b/lib/ofp-parse.c
@@ -15,12 +15,13 @@
  */
 
 #include <config.h>
+
+#include "ofp-parse.h"
+
 #include <errno.h>
 #include <stdlib.h>
 
 #include "netdev.h"
-#include "odp-util.h"
-#include "ofp-parse.h"
 #include "ofp-util.h"
 #include "ofpbuf.h"
 #include "openflow/openflow.h"
diff --git a/lib/ofp-parse.h b/lib/ofp-parse.h
index d776415..386b663 100644
--- a/lib/ofp-parse.h
+++ b/lib/ofp-parse.h
@@ -19,6 +19,11 @@
 #ifndef OFP_PARSE_H
 #define OFP_PARSE_H 1
 
+#include <stdint.h>
+
+struct ofp_match;
+struct ofpbuf;
+
 void ofp_str_to_flow(char *string, struct ofp_match *match, 
                      struct ofpbuf *actions, uint8_t *table_idx, 
                      uint16_t *out_port, uint16_t *priority, 






More information about the dev mailing list