summaryrefslogtreecommitdiff
path: root/cesar/mac/common/src/mfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/mac/common/src/mfs.c')
-rw-r--r--cesar/mac/common/src/mfs.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/cesar/mac/common/src/mfs.c b/cesar/mac/common/src/mfs.c
new file mode 100644
index 0000000000..4683ab50e3
--- /dev/null
+++ b/cesar/mac/common/src/mfs.c
@@ -0,0 +1,84 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file mac/common/src/mfs.c
+ * \brief MAC frame stream functions.
+ * \ingroup mac_common
+ */
+#include "common/std.h"
+
+#include "mac/common/mfs.h"
+#include "mac/common/defs.h"
+
+static void
+mfs_common_init (mfs_common_t *mfs_common, bool tx, bool bcast, bool mme, uint
+ lid, uint tei)
+{
+ mfs_common->tx = tx;
+ mfs_common->bcast = bcast;
+ mfs_common->mme = mme;
+ mfs_common->ats = false;
+ mfs_common->lid = lid;
+ mfs_common->tei = tei;
+ mfs_common->lid_alias = MAC_LID_NONE;
+ /* mfs_common->expiration_heap_node */
+ /* mfs_common->expiration_date */
+ /* mfs_common->expiration_delay */
+ mfs_common->release = false;
+}
+
+void
+mfs_rx_init (mfs_rx_t *mfs, bool bcast, bool mme, uint lid, uint tei)
+{
+ dbg_assert_ptr (mfs);
+ dbg_assert ((mme && lid == MAC_LID_NONE)
+ || (!mme && MAC_LID_IS_XLID (lid)));
+ dbg_assert (tei != MAC_TEI_BCAST);
+ mfs_common_init (&mfs->common, false, bcast, mme, lid, tei);
+ mfs->head = NULL;
+ mfs->last_contiguous = NULL;
+ mfs->tail = NULL;
+ mfs->last_offset_processed = 0;
+ mfs->ssn_min = 0;
+ mfs->window_size = mme ? 8 : 16;
+}
+
+void
+mfs_tx_init (mfs_tx_t *mfs, bool bcast, bool mme, uint lid, uint tei)
+{
+ dbg_assert_ptr (mfs);
+ dbg_assert ((mme && lid == MAC_LID_NONE)
+ || (!mme && (MAC_LID_IS_XLID (lid)
+ || lid == MAC_LID_SPC_CENTRAL
+ || lid == MAC_LID_DISCOVER)));
+ dbg_assert ((bcast && tei == MAC_TEI_BCAST)
+ || (!bcast && MAC_TEI_IS_STA (tei))
+ || (!bcast && mme && tei == MAC_TEI_UNASSOCIATED));
+ mfs_common_init (&mfs->common, true, bcast, mme, lid, tei);
+ mfs->cfp = false;
+ mfs->burst_count = 0;
+ heap_node_init (&mfs->ca_prio_link);
+ list_init_node (&mfs->ca_held_link);
+ mfs->ca_state = CA_MFS_STATE_UNKNOWN;
+ mfs->seg_nb = 0;
+ mfs->pending_seg_nb = 0;
+ mfs->min_ssn = 0;
+ mfs->window_size = mme ? 8 : 16;
+ mfs->window_holes_seg_nb = 0;
+ mfs->cap = MAC_LID_IS_PLID (lid) ? lid : 0;
+ mfs->dynamic_cap = mme;
+ mfs->cap_seg_nb[0] = mfs->cap_seg_nb[1] = mfs->cap_seg_nb[2] =
+ mfs->cap_seg_nb[3] = 0;
+ mfs->head = NULL;
+ dbg_invalid_ptr (mfs->tail);
+ mfs->last_seg_offset = 0;
+ mfs->next_ssn = 0;
+ mfs->beacon = false;
+ mfs->pending_jobs = 0;
+}
+