}
}
+/* Sends 'error', which should be an OpenFlow error created with
+ * e.g. ofp_mkerr(), on 'ofconn', as a reply to 'request'. Only at most the
+ * first 64 bytes of 'request' are used. */
+void
+ofconn_send_error(const struct ofconn *ofconn,
+ const struct ofp_header *request, int error)
+{
+ struct ofpbuf *msg = ofputil_encode_error_msg(error, request);
+ if (msg) {
+ ofconn_send_reply(ofconn, msg);
+ }
+}
+
/* Same as pktbuf_retrieve(), using the pktbuf owned by 'ofconn'. */
int
ofconn_pktbuf_retrieve(struct ofconn *ofconn, uint32_t id,
void ofconn_send_reply(const struct ofconn *, struct ofpbuf *);
void ofconn_send_replies(const struct ofconn *, struct list *);
+void ofconn_send_error(const struct ofconn *, const struct ofp_header *request,
+ int error);
int ofconn_pktbuf_retrieve(struct ofconn *, uint32_t id,
struct ofpbuf **bufferp, uint16_t *in_port);
return rule->cr.priority > UINT16_MAX;
}
\f
-static void
-send_error_oh(const struct ofconn *ofconn, const struct ofp_header *oh,
- int error)
-{
- struct ofpbuf *buf = ofputil_encode_error_msg(error, oh);
- if (buf) {
- COVERAGE_INC(ofproto_error);
- ofconn_send_reply(ofconn, buf);
- }
-}
-
static int
handle_echo_request(struct ofconn *ofconn, const struct ofp_header *oh)
{
{
int error = handle_openflow__(ofconn, ofp_msg);
if (error) {
- send_error_oh(ofconn, ofp_msg->data, error);
+ ofconn_send_error(ofconn, ofp_msg->data, error);
}
COVERAGE_INC(ofproto_recv_openflow);
}