On Tue, Jan 06, 2015 at 09:49:06PM +0800, Yang Yannan wrote:
> 〒_〒, help! I wanna know what  ofpact_put_*is,  such as 
> ofpact_put_SET_VLAN_VID().  is it a method or ?why there is not a definition 
> for it ?  I search it in the all of code, and did not understand it.  
> 
> context  is as follows:
> after decoding ofp_action and getting a "code", use ofpact_put_*(out) 
> according to the "code",  like 
> ofpact_put_SET_VLAN_VID(out) ->vlan_vid=.....

See the comment in ofp-actions.h:

/* For each OFPACT_<ENUM> with a corresponding struct <STRUCT>, this defines
 * the following commonly useful functions:
 *
 *   struct <STRUCT> *ofpact_put_<ENUM>(struct ofpbuf *ofpacts);
 *
 *     Appends a new 'ofpact', of length OFPACT_<ENUM>_RAW_SIZE, to 'ofpacts',
 *     initializes it with ofpact_init_<ENUM>(), and returns it.  Also sets
 *     'ofpacts->l2' to the returned action.
 *
 *     After using this function to add a variable-length action, add the
 *     elements of the flexible array (e.g. with ofpbuf_put()), then use
 *     ofpact_update_len() to update the length embedded into the action.
 *     (Keep in mind the need to refresh the structure from 'ofpacts->frame'
 *     after adding data to 'ofpacts'.)
 *
 *   struct <STRUCT> *ofpact_get_<ENUM>(const struct ofpact *ofpact);
 *
 *     Returns 'ofpact' cast to "struct <STRUCT> *".  'ofpact->type' must be
 *     OFPACT_<ENUM>.
 *
 * as well as the following more rarely useful definitions:
 *
 *   void ofpact_init_<ENUM>(struct <STRUCT> *ofpact);
 *
 *     Initializes the parts of 'ofpact' that identify it as having type
 *     OFPACT_<ENUM> and length OFPACT_<ENUM>_RAW_SIZE and zeros the rest.
 *
 *   <ENUM>_RAW_SIZE
 *
 *     The size of the action structure.  For a fixed-length action, this is
 *     sizeof(struct <STRUCT>).  For a variable-length action, this is the
 *     offset to the variable-length part.
 *
 *   <ENUM>_SIZE
 *
 *     An integer constant, the value of OFPACT_<ENUM>_RAW_SIZE rounded up to a
 *     multiple of OFPACT_ALIGNTO.
 */
_______________________________________________
discuss mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/discuss

Reply via email to