ofproto: Make handle_openflow's msg argument const.
authorJarno Rajahalme <jarno.rajahalme@nsn.com>
Mon, 17 Jun 2013 00:55:25 +0000 (03:55 +0300)
committerBen Pfaff <blp@nicira.com>
Mon, 17 Jun 2013 16:34:53 +0000 (09:34 -0700)
handle_openflow() must not modify the received message. Make this
explicit.

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto/connmgr.c
ofproto/connmgr.h
ofproto/ofproto.c

index 1a1ab6c..0951968 100644 (file)
@@ -108,7 +108,7 @@ static void ofconn_reconfigure(struct ofconn *,
 
 static void ofconn_run(struct ofconn *,
                        bool (*handle_openflow)(struct ofconn *,
-                                               struct ofpbuf *ofp_msg));
+                                               const struct ofpbuf *ofp_msg));
 static void ofconn_wait(struct ofconn *, bool handling_openflow);
 
 static const char *ofconn_get_target(const struct ofconn *);
@@ -269,7 +269,8 @@ connmgr_destroy(struct connmgr *mgr)
  * fail-open processing) are suppressed too. */
 void
 connmgr_run(struct connmgr *mgr,
-            bool (*handle_openflow)(struct ofconn *, struct ofpbuf *ofp_msg))
+            bool (*handle_openflow)(struct ofconn *,
+                                    const struct ofpbuf *ofp_msg))
 {
     struct ofconn *ofconn, *next_ofconn;
     struct ofservice *ofservice;
@@ -1234,7 +1235,8 @@ ofconn_may_recv(const struct ofconn *ofconn)
 
 static void
 ofconn_run(struct ofconn *ofconn,
-           bool (*handle_openflow)(struct ofconn *, struct ofpbuf *ofp_msg))
+           bool (*handle_openflow)(struct ofconn *,
+                                   const struct ofpbuf *ofp_msg))
 {
     struct connmgr *mgr = ofconn->connmgr;
     size_t i;
index 506f9c7..429e678 100644 (file)
@@ -71,7 +71,7 @@ void connmgr_destroy(struct connmgr *);
 
 void connmgr_run(struct connmgr *,
                  bool (*handle_openflow)(struct ofconn *,
-                                         struct ofpbuf *ofp_msg));
+                                         const struct ofpbuf *ofp_msg));
 void connmgr_wait(struct connmgr *, bool handling_openflow);
 
 void connmgr_get_memory_usage(const struct connmgr *, struct simap *usage);
index 5431fa7..7f9a88f 100644 (file)
@@ -199,7 +199,7 @@ static enum ofperr add_flow(struct ofproto *, struct ofconn *,
                             const struct ofputil_flow_mod *,
                             const struct ofp_header *);
 static void delete_flow__(struct rule *, struct ofopgroup *);
-static bool handle_openflow(struct ofconn *, struct ofpbuf *);
+static bool handle_openflow(struct ofconn *, const struct ofpbuf *);
 static enum ofperr handle_flow_mod__(struct ofproto *, struct ofconn *,
                                      const struct ofputil_flow_mod *,
                                      const struct ofp_header *);
@@ -4146,7 +4146,7 @@ handle_openflow__(struct ofconn *ofconn, const struct ofpbuf *msg)
 }
 
 static bool
-handle_openflow(struct ofconn *ofconn, struct ofpbuf *ofp_msg)
+handle_openflow(struct ofconn *ofconn, const struct ofpbuf *ofp_msg)
 {
     int error = handle_openflow__(ofconn, ofp_msg);
     if (error && error != OFPROTO_POSTPONE) {