Signed-off-by: Isaku Yamahata <yamah...@valinux.co.jp> --- lib/ofp-actions.c | 22 ++++++++++++++++++++++ lib/ofp-actions.h | 4 ++++ 2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index d274895..2f80a29 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -1782,3 +1782,25 @@ ofpact_pad(struct ofpbuf *ofpacts) ofpbuf_put_zeros(ofpacts, OFPACT_ALIGNTO - rem); } } + +void +ofpact_nest(struct ofpbuf *ofpacts, const struct ofpact *ofpact) +{ + assert(ofpact == ofpacts->l2); + assert(ofpacts->l3 == NULL); + ofpacts->l3 = ofpacts->l2; +} + +struct ofpact * +ofpact_unnest(struct ofpbuf *ofpacts) +{ + struct ofpact *ofpact; + assert(ofpacts->l2 != NULL); + assert(ofpacts->l3 != NULL); + assert(ofpacts->l3 < ofpacts->l2); + + ofpact = ofpacts->l3; + ofpacts->l2 = ofpacts->l3; + ofpacts->l3 = NULL; + return ofpact; +} diff --git a/lib/ofp-actions.h b/lib/ofp-actions.h index 7c9cb05..d106a66 100644 --- a/lib/ofp-actions.h +++ b/lib/ofp-actions.h @@ -493,4 +493,8 @@ OFPACTS void ofpact_update_len(struct ofpbuf *, struct ofpact *); void ofpact_pad(struct ofpbuf *); +/* Functions to use for apply-actions instruction */ +void ofpact_nest(struct ofpbuf *ofpacts, const struct ofpact *ofpact); +struct ofpact *ofpact_unnest(struct ofpbuf *ofpacts); + #endif /* ofp-actions.h */ -- 1.7.1.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev