summaryrefslogtreecommitdiff
path: root/cesar/cp2/beacon/inc/beacons.h
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/cp2/beacon/inc/beacons.h')
-rw-r--r--cesar/cp2/beacon/inc/beacons.h132
1 files changed, 132 insertions, 0 deletions
diff --git a/cesar/cp2/beacon/inc/beacons.h b/cesar/cp2/beacon/inc/beacons.h
new file mode 100644
index 0000000000..6df7167794
--- /dev/null
+++ b/cesar/cp2/beacon/inc/beacons.h
@@ -0,0 +1,132 @@
+#ifndef cp_beacon_inc_beacons_h
+#define cp_beacon_inc_beacons_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/beacon/inc/beacons.h
+ * \brief central beacon private functions.
+ * \ingroup cp_beacon
+ *
+ */
+
+/**
+ * Initialize the sub module for the discover, central and proxy beacons.
+ * The beacon_ctx corresponds to the each part contained in the ctx.
+ *
+ * \param ctx the becon module context.
+ * \param beacon_ctx the central, discover or proxy context.
+ */
+void
+cp_beacon_init_beacons (cp_beacon_t *ctx, cp_beacon_common_t *beacon_ctx);
+
+/**
+ * Uninit the sub beacon modules.
+ *
+ * \param ctx the beacon module context
+ * \param beacon_ctx the beacon context to uninit.
+ */
+void
+cp_beacon_uninit_beacons (cp_beacon_t *ctx, cp_beacon_common_t *beacon_ctx);
+
+/**
+ * Compute the beacon period using the beacon period thereotic calculated
+ * during the pw frequency detection.
+ *
+ * \param ctx the beacon period context.
+ */
+uint
+cp_beacon_pwl_period (cp_beacon_t *ctx);
+
+/**
+ * Fill the payload of the beacon when the STA is accting as CCo or UCCo.
+ * Can be use for
+ * - the Central beacon when acting as a CCo
+ * - the discover beacon when acting as a UCCo.
+ *
+ *
+ * \param ctx the beacon module context
+ * \param beacon the beacon to fill.
+ * \param beacon_type the beacon type, central, discover or proxy.
+ */
+void
+cp_beacon_xcco_fill_common_part (cp_beacon_t *ctx, cp_beacon_desc_t *beacon,
+ uint beacon_type);
+
+/**
+ * Generate the central beacon.
+ *
+ * \param ctx the beacon context.
+ * \param beacon the central beacon to fill
+ */
+void
+cp_beacon_cco_beacon_central_generate (cp_beacon_t *ctx,
+ cp_beacon_desc_t *beacon);
+
+/**
+ * Generate the discover beacon when STA is UCCo.
+ *
+ * \param ctx the beacon context.
+ * \param beacon the central beacon to fill
+ */
+void
+cp_beacon_cco_beacon_discover_generate (cp_beacon_t *ctx,
+ cp_beacon_desc_t *beacon);
+
+
+/**
+ * Send the beacon over the PWL.
+ * TODO Implement the proxy beacon part
+ *
+ * \param ctx the cp beacon context
+ * \param beacon the beacon to send
+ * \param beacon_type the beacon type.
+ */
+void
+cp_beacon_send_beacon (cp_beacon_t *ctx, cp_beacon_desc_t *beacon,
+ uint beacon_type);
+
+/**
+ * Process the received beacon
+ *
+ * \param ctx the beacon context.
+ * \param beacon the beacon received.
+ */
+void
+cp_beacon_process (cp_beacon_t *ctx, cp_beacon_desc_t *beacon);
+
+/**
+ * Function call by the timer when the timer expires.
+ *
+ * \param ctx the beacon context.
+ */
+void
+cp_beacon_timer_it (cp_beacon_t *ctx);
+
+/** create the default schedule for the ca.
+ * \param ctx the cp context
+ *
+ * create the default schedule for the ca to be able to listen the pwl on the
+ * pond procedure.
+ * this will create four beacon periods of a duration corresponding to
+ * cp_beacon_default_schedule_time / 4.
+ */
+void
+cp_beacon_create_default_schedule (cp_t *ctx);
+
+/** Compute the next BTS, the four next BTOs and the BP.
+ * \param ctx the cp context.
+ * \param common the common part of the beacons structure.
+ *
+ * Compute the next BTS, the four next BTOs and the BP. in Time Allocation
+ * Unit to provide the data to the generated beacon.
+ */
+void
+cp_beacon_estimate_bts_bto_bp (cp_beacon_t *ctx, cp_beacon_common_t *common);
+
+
+#endif /* cp_beacon_inc_beacons_h */