diff options
Diffstat (limited to 'platform/src/sce.cpp')
| -rw-r--r-- | platform/src/sce.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/platform/src/sce.cpp b/platform/src/sce.cpp index 0d25511..439b84b 100644 --- a/platform/src/sce.cpp +++ b/platform/src/sce.cpp @@ -28,6 +28,21 @@ int metadata_is_empty(struct metadata *meta) } } +void metadata_shallow_copy(struct metadata *dst, struct metadata *src) +{ + dst->write_ref++; + dst->session_id = src->session_id; + dst->raw_data = NULL; + dst->raw_len = 0; + dst->l7offset = src->l7offset; + dst->is_e2i_dir = src->is_e2i_dir; + dst->is_ctrl_pkt = src->is_ctrl_pkt; + dst->is_decrypted = src->is_decrypted; + + sids_copy(&dst->sids, &src->sids); + route_ctx_copy(&dst->route_ctx, &src->route_ctx); +} + void metadata_deep_copy(struct metadata *dst, struct metadata *src) { dst->write_ref++; @@ -70,6 +85,8 @@ struct session_ctx *session_ctx_new() fixed_num_array_init(&session_ctx->rule_ids); + session_ctx->decrypted_meta_i2e = metadata_new(); + session_ctx->decrypted_meta_e2i = metadata_new(); session_ctx->raw_meta_i2e = metadata_new(); session_ctx->raw_meta_e2i = metadata_new(); session_ctx->ctrl_meta = metadata_new(); @@ -81,6 +98,18 @@ void session_ctx_free(struct session_ctx *session_ctx) { if (session_ctx) { + if (session_ctx->decrypted_meta_i2e) + { + metadata_free(session_ctx->decrypted_meta_i2e); + session_ctx->decrypted_meta_i2e = NULL; + } + + if (session_ctx->decrypted_meta_e2i) + { + metadata_free(session_ctx->decrypted_meta_e2i); + session_ctx->decrypted_meta_e2i = NULL; + } + if (session_ctx->raw_meta_i2e) { metadata_free(session_ctx->raw_meta_i2e); |
