-static struct ofpbuf *
-make_ofp_stats_reply(ovs_be32 xid, ovs_be16 type, size_t body_len)
-{
- struct ofp_stats_msg *reply;
- struct ofpbuf *msg;
-
- msg = ofpbuf_new(MIN(sizeof *reply + body_len, UINT16_MAX));
- reply = put_openflow_xid(sizeof *reply, OFPT_STATS_REPLY, xid, msg);
- reply->type = type;
- reply->flags = htons(0);
- return msg;
-}
-
-static struct ofpbuf *
-start_ofp_stats_reply(const struct ofp_header *request, size_t body_len)
-{
- const struct ofp_stats_msg *osm = (const struct ofp_stats_msg *) request;
- return make_ofp_stats_reply(osm->header.xid, osm->type, body_len);
-}
-
-static void *
-append_ofp_stats_reply(size_t nbytes, struct ofconn *ofconn,
- struct ofpbuf **msgp)
-{
- struct ofpbuf *msg = *msgp;
- assert(nbytes <= UINT16_MAX - sizeof(struct ofp_stats_msg));
- if (nbytes + msg->size > UINT16_MAX) {
- struct ofp_stats_msg *reply = msg->data;
- reply->flags = htons(OFPSF_REPLY_MORE);
- *msgp = make_ofp_stats_reply(reply->header.xid, reply->type, nbytes);
- ofconn_send_reply(ofconn, msg);
- }
- return ofpbuf_put_uninit(*msgp, nbytes);
-}
-
-static struct ofpbuf *
-make_nxstats_reply(ovs_be32 xid, ovs_be32 subtype, size_t body_len)
-{
- struct nicira_stats_msg *nsm;
- struct ofpbuf *msg;
-
- msg = ofpbuf_new(MIN(sizeof *nsm + body_len, UINT16_MAX));
- nsm = put_openflow_xid(sizeof *nsm, OFPT_STATS_REPLY, xid, msg);
- nsm->type = htons(OFPST_VENDOR);
- nsm->flags = htons(0);
- nsm->vendor = htonl(NX_VENDOR_ID);
- nsm->subtype = subtype;
- return msg;
-}
-
-static struct ofpbuf *
-start_nxstats_reply(const struct nicira_stats_msg *request, size_t body_len)
-{
- return make_nxstats_reply(request->header.xid, request->subtype, body_len);
-}
-
-static void
-append_nxstats_reply(size_t nbytes, struct ofconn *ofconn,
- struct ofpbuf **msgp)
-{
- struct ofpbuf *msg = *msgp;
- assert(nbytes <= UINT16_MAX - sizeof(struct nicira_stats_msg));
- if (nbytes + msg->size > UINT16_MAX) {
- struct nicira_stats_msg *reply = msg->data;
- reply->flags = htons(OFPSF_REPLY_MORE);
- *msgp = make_nxstats_reply(reply->header.xid, reply->subtype, nbytes);
- ofconn_send_reply(ofconn, msg);
- }
- ofpbuf_prealloc_tailroom(*msgp, nbytes);
-}
-