summaryrefslogtreecommitdiffstats
path: root/src/payload.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2014-01-08 13:02:15 +0000
committerPatrick McHardy <kaber@trash.net>2014-01-08 13:02:15 +0000
commitbc3656ad1e5b5812f916e9c9356785c06ce90936 (patch)
tree17dd06f6d317f1cf6657452a12a2c7ceb98fe65f /src/payload.c
parent079041bd477f444d29e02c6442351c0ed6ffaa1e (diff)
expr: replace PAYLOAD_PROTOCOL_EXPR by generic flag
Introduce a generic flag to indicate that an expression describes the upper layer protocol as replacement for the payload specific flag. Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'src/payload.c')
-rw-r--r--src/payload.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/payload.c b/src/payload.c
index ea0d4e26..2a60a762 100644
--- a/src/payload.c
+++ b/src/payload.c
@@ -69,7 +69,6 @@ static void payload_expr_clone(struct expr *new, const struct expr *expr)
new->payload.tmpl = expr->payload.tmpl;
new->payload.base = expr->payload.base;
new->payload.offset = expr->payload.offset;
- new->payload.flags = expr->payload.flags;
}
static const struct expr_ops payload_expr_ops = {
@@ -92,7 +91,7 @@ struct expr *payload_expr_alloc(const struct location *loc,
tmpl = &desc->templates[type];
base = desc->base;
if (type == desc->protocol_key)
- flags = PAYLOAD_PROTOCOL_EXPR;
+ flags = EXPR_F_PROTOCOL;
} else {
tmpl = &payload_unknown_template;
base = PAYLOAD_BASE_INVALID;
@@ -100,11 +99,13 @@ struct expr *payload_expr_alloc(const struct location *loc,
expr = expr_alloc(loc, &payload_expr_ops, tmpl->dtype,
tmpl->dtype->byteorder, tmpl->len);
+ expr->flags |= flags;
+
expr->payload.desc = desc;
expr->payload.tmpl = tmpl;
expr->payload.base = base;
expr->payload.offset = tmpl->offset;
- expr->payload.flags = flags;
+
return expr;
}
@@ -256,7 +257,7 @@ void payload_ctx_update(struct payload_ctx *ctx, const struct expr *expr)
const struct expr *left = expr->left, *right = expr->right;
const struct payload_desc *base, *desc;
- if (!(left->payload.flags & PAYLOAD_PROTOCOL_EXPR))
+ if (!(left->flags & EXPR_F_PROTOCOL))
return;
assert(expr->op == OP_EQ);