lib/ofp-msgs.c
/* Determines the OFPRAW_* type of the OpenFlow message in 'msg', which starts
 * at 'msg->data' and has length 'msg->size' bytes.  On success,
 * returns 0 and stores the type into '*rawp'.  On failure, returns an OFPERR_*
 * error code and zeros '*rawp'.
 *
 * This function checks that the message has a valid length for its particular
 * type of message, and returns an error if not.
 *
 * In addition to setting '*rawp', this function pulls off the OpenFlow header
 * (including the stats headers, vendor header, and any subtype header) with
 * ofpbuf_pull().  It also sets 'msg->header' to the start of the OpenFlow
 * header and 'msg->msg' just beyond the headers (that is, to the final value
 * of msg->data). */


This function checks that the message has a valid length for its particular
type of message, and returns an error if not.

In addition to setting '*rawp', this function pulls off the OpenFlow header
(including the stats headers, vendor header, and any subtype header) with
ofpbuf_pull().  It also sets 'msg->header' to the start of the OpenFlow
header and 'msg->msg' just beyond the headers (that is, to the final value
of msg->data).
This function checks that the message has a valid length for its particular type of message and returns an error if not . In addition to setting ' * rawp ' this function pulls off the OpenFlow header ( including the stats headers vendor header and any subtype header ) with ofpbuf_pull () . It also sets ' msg - > header ' to the start of the OpenFlow header and ' msg - > msg ' just beyond the headers ( that is to the final value of msg - > data ) .
enum ofperr
ofpraw_pull(enum ofpraw *rawp, struct ofpbuf *msg)
{
    msg->header = msg->data;
    msg->msg = msg->header;
    *rawp = 0;
    struct ofphdrs hdrs;
    enum ofperr error = ofphdrs_decode(&hdrs, msg->data, msg->size);
    if (error) {
        return error;
    }
    enum ofpraw raw;
    error = ofpraw_from_ofphdrs(&raw, &hdrs);
    if (error) {
        return error;
    }
    const struct raw_info *info = raw_info_get(raw);
    const struct raw_instance *instance = raw_instance_get(info, hdrs.version);
    error = ofpraw_check_length(info, instance, msg->size);
    if (error) {
        return error;
    }
    msg->header = ofpbuf_pull(msg, instance->hdrs_len);
    msg->msg = msg->data;
    *rawp = raw;
    return 0;
}
enum ofperr ofpraw_pull ( enum ofpraw * rawp , struct ofpbuf * msg ) { msg -> header = msg -> data ; msg -> msg = msg -> header ; * rawp = 0 ; struct ofphdrs hdrs ; enum ofperr error = ofphdrs_decode ( & hdrs , msg -> data , msg -> size ) ; if ( error ) { return error ; } enum ofpraw raw ; error = ofpraw_from_ofphdrs ( & raw , & hdrs ) ; if ( error ) { return error ; } const struct raw_info * info = raw_info_get ( raw ) ; const struct raw_instance * instance = raw_instance_get ( info , hdrs . version ) ; error = ofpraw_check_length ( info , instance , msg -> size ) ; if ( error ) { return error ; } msg -> header = ofpbuf_pull ( msg , instance -> hdrs_len ) ; msg -> msg = msg -> data ; * rawp = raw ; return 0 ; }
Determines the OFPRAW_* type of the OpenFlow message in 'msg', which starts
 at 'msg->data' and has length 'msg->size' bytes.
Determines the OFPRAW_ * type of the OpenFlow message in ' msg ' which starts at ' msg - > data ' and has length ' msg - > size ' bytes .
/* Set default outputs. */