summaryrefslogtreecommitdiff
path: root/cesar/cl/test/overide/mac/sar/src/sar.c
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/cl/test/overide/mac/sar/src/sar.c')
-rw-r--r--cesar/cl/test/overide/mac/sar/src/sar.c161
1 files changed, 161 insertions, 0 deletions
diff --git a/cesar/cl/test/overide/mac/sar/src/sar.c b/cesar/cl/test/overide/mac/sar/src/sar.c
new file mode 100644
index 0000000000..9a1b8be684
--- /dev/null
+++ b/cesar/cl/test/overide/mac/sar/src/sar.c
@@ -0,0 +1,161 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file sar.c
+ * \brief <brief>
+ * \ingroup cl/test/overide/mac/sar/src
+ *
+ */
+
+#include "common/std.h"
+#include "mac/sar/sar.h"
+#include "lib/blk.h"
+
+static sar_t sar_global;
+
+sar_t * sar_init (mac_store_t *mac_store, pbproc_t *pbproc, ca_t *ca)
+{
+ sar_global.sar_msg_segmentation_done = 0x0;
+ sar_global.sar_data_segmentation_done = 0x0;
+
+ dbg_assert (mac_store);
+
+ return &sar_global;
+}
+
+void sar_uninit (sar_t *ctx)
+{
+ dbg_assert (ctx);
+}
+
+bool sar_msdu_add (sar_t *sar_ctx, u8* buffer, u16 length,
+ u32 ats_confounder, mfs_tx_t *mfs)
+{
+ dbg_assert (sar_ctx);
+ dbg_assert (mfs);
+
+
+ if (mfs->common.mme)
+ {
+ dbg_assert (sar_ctx->sar_msg_segmentation_done);
+ (*sar_ctx->sar_msg_segmentation_done) (sar_ctx->ul_msg_ctx, buffer);
+ }
+ else
+ {
+ dbg_assert (sar_ctx->sar_data_segmentation_done);
+ (*sar_ctx->sar_data_segmentation_done) (sar_ctx->ul_msg_ctx, buffer);
+ }
+
+ return true;
+}
+
+/**
+ * Used by the upper layers to send or received messages.
+ *
+ * \param ctx the sar context
+ * \param sar_seg_done used by the segmentation to inform the upper layer the
+ * buffer is not used anymore.
+ */
+void sar_init_segmentation_mme_cb (sar_t *ctx,
+ sar_segmentation_done_cb_t sar_seg_done)
+{
+ dbg_assert (ctx);
+ dbg_assert (sar_seg_done);
+
+ ctx->sar_msg_segmentation_done = sar_seg_done;
+}
+
+/**
+ * Add the upper data layer context to the SAR. It allows the sar to use
+ * the context in the callbacks to this layer.
+ *
+ * \param ctx the sar context
+ * \param user the upper layer msg context.
+ */
+void sar_init_mme_context (sar_t *ctx, void *user)
+{
+ ctx->ul_msg_ctx = user;
+}
+
+/**
+ * Initialise the callback pointer and return the contexte to the Upper layers
+ *
+ * \param ctx the sar context
+ * \param sar_rea_done inform the upper layers that the buffer is filled.
+ * \param data a boolean to indicate if it is a data stream or not.
+ */
+void sar_init_reassembly_ul (sar_t *ctx,
+ sar_reassembly_done_cb_t sar_rea_done, bool data)
+{
+ dbg_assert (ctx);
+
+ if (!data)
+ ctx->sar_rea_mme_done = sar_rea_done;
+ else
+ ctx->sar_rea_data_done = sar_rea_done;
+}
+
+/**
+ * Add the mac store to the SAR.
+ *
+ * \param ctx the sar context
+ * \param mac_store the mac store ctx.
+ */
+void sar_init_mac_store (sar_t *ctx, mac_store_t *mac_store)
+{
+ dbg_assert (ctx);
+ dbg_assert (mac_store);
+
+ // init the mac store ctx in the sar.
+ ctx->expiration.mfs_store = mac_store;
+}
+
+/**
+ * Add the upper data layer context to the SAR. It allows the sar to use
+ * the context in the callbacks to this layer.
+ *
+ * \param ctx the sar context
+ * \param user the upper layer data context.
+ */
+void sar_init_data_context (sar_t *ctx, void *user)
+{
+ dbg_assert (ctx);
+
+ ctx->ul_data_ctx = user;
+}
+
+/**
+ * Used by the upper layers to send or received data.
+ *
+ * \param ctx the sar context
+ * \param sar_seg_done used by the segmentation to inform the upper layer the
+ * buffer is not used anymore.
+ */
+void sar_init_segmentation_data_cb (sar_t *ctx,
+ sar_segmentation_done_cb_t sar_seg_done)
+{
+ dbg_assert (ctx);
+ dbg_assert (ctx->ul_data_ctx);
+
+ ctx->sar_data_segmentation_done = sar_seg_done;
+}
+
+bool sar_mme_buffer_add (sar_t *ctx, u8* buffer_addr)
+{
+ dbg_assert (ctx);
+ dbg_assert (buffer_addr);
+ return true;
+}
+
+bool sar_data_buffer_add (sar_t *ctx, u8* buffer_addr)
+{
+ dbg_assert (ctx);
+ dbg_assert (buffer_addr);
+ return true;
+}
+