ofp-util: New functions hton_ofp_phy_port(), ntoh_ofp_phy_port().
authorBen Pfaff <blp@nicira.com>
Mon, 28 Jun 2010 21:03:17 +0000 (14:03 -0700)
committerBen Pfaff <blp@nicira.com>
Mon, 28 Jun 2010 21:03:17 +0000 (14:03 -0700)
The former is moved here from wdp-xflow, the latter is added just for
completeness.

lib/ofp-util.c
lib/ofp-util.h
ofproto/wdp-xflow.c

index 4fc5ed4..bc96240 100644 (file)
@@ -754,3 +754,23 @@ normalize_match(struct ofp_match *m)
     m->wildcards = htonl(wc);
 }
 
+/* Converts all of the fields in 'opp' from host to native byte-order. */
+void
+hton_ofp_phy_port(struct ofp_phy_port *opp)
+{
+    opp->port_no = htons(opp->port_no);
+    opp->config = htonl(opp->config);
+    opp->state = htonl(opp->state);
+    opp->curr = htonl(opp->curr);
+    opp->advertised = htonl(opp->advertised);
+    opp->supported = htonl(opp->supported);
+    opp->peer = htonl(opp->peer);
+}
+
+/* Converts all of the fields in 'opp' from native to host byte-order. */
+void
+ntoh_ofp_phy_port(struct ofp_phy_port *opp)
+{
+    /* ntohX and htonX are really the same functions. */
+    hton_ofp_phy_port(opp);
+}
index 2c6b2f9..e4927f6 100644 (file)
@@ -82,6 +82,9 @@ bool action_outputs_to_port(const union ofp_action *, uint16_t port);
 
 void normalize_match(struct ofp_match *);
 
+void hton_ofp_phy_port(struct ofp_phy_port *);
+void ntoh_ofp_phy_port(struct ofp_phy_port *);
+
 static inline int
 ofp_mkerr(uint16_t type, uint16_t code)
 {
index 66b245a..56067e6 100644 (file)
@@ -1260,18 +1260,6 @@ wx_destroy(struct wdp *wdp)
     return xfif_delete(wx->xfif);
 }
 
-static void
-hton_ofp_phy_port(struct ofp_phy_port *opp)
-{
-    opp->port_no = htons(opp->port_no);
-    opp->config = htonl(opp->config);
-    opp->state = htonl(opp->state);
-    opp->curr = htonl(opp->curr);
-    opp->advertised = htonl(opp->advertised);
-    opp->supported = htonl(opp->supported);
-    opp->peer = htonl(opp->peer);
-}
-
 static int
 wx_get_features(const struct wdp *wdp, struct ofpbuf **featuresp)
 {