summaryrefslogtreecommitdiff
path: root/cp2
diff options
context:
space:
mode:
Diffstat (limited to 'cp2')
-rw-r--r--cp2/beacon/beacons.h115
-rw-r--r--cp2/beacon/inc/beacons.h132
-rwxr-xr-xcp2/beacon/ntb/inc/ntb_clock_sync.h170
-rwxr-xr-xcp2/beacon/ntb/src/ntb_clock_sync.c541
-rw-r--r--cp2/cco/action/action.h179
-rwxr-xr-xcp2/cco/action/doc/CCo Con.odtbin129318 -> 0 bytes
-rwxr-xr-xcp2/cco/bw/doc/Bandwidth_Manager.odtbin360852 -> 0 bytes
-rwxr-xr-xcp2/cco/region/doc/Region_Manager.odtbin102273 -> 0 bytes
-rw-r--r--cp2/cl_interf/cl_interf.h126
-rw-r--r--cp2/cl_interf/inc/cl_interf_defs.h18
-rw-r--r--cp2/defs.h31
-rw-r--r--cp2/mme.h229
-rw-r--r--cp2/msg/inc/msg_cc.h52
-rw-r--r--cp2/msg/inc/msg_cm.h44
-rw-r--r--cp2/msg/msg.h105
-rw-r--r--cp2/secu/secu.h160
-rw-r--r--cp2/sta/action/action.h46
-rw-r--r--cp2/sta/action/assoc.h190
-rw-r--r--cp2/sta/action/doc/Makefile47
-rw-r--r--cp2/sta/action/doc/assoc.sdl21
-rw-r--r--cp2/sta/action/doc/cp_sta_action.odtbin146879 -> 0 bytes
-rw-r--r--cp2/sta/action/key.h165
-rw-r--r--cp2/sta/action/misc.h117
-rw-r--r--cp2/sta/core/core.h122
-rw-r--r--cp2/sta/data/inc/own_data.h30
-rw-r--r--cp2/sta/data/inc/sta_data.h33
-rw-r--r--cp2/sta/data/net_list.h83
-rw-r--r--cp2/sta/data/own_data.h111
-rw-r--r--cp2/sta/data/sta_data.h122
-rw-r--r--cp2/sta/mgr/doc/sta_manager.odtbin155926 -> 0 bytes
-rw-r--r--cp2/sta/mgr/sta_mgr.h163
-rw-r--r--cp2/vstate_fsm/vstate_fsm.h65
32 files changed, 0 insertions, 3217 deletions
diff --git a/cp2/beacon/beacons.h b/cp2/beacon/beacons.h
deleted file mode 100644
index 49d2231248..0000000000
--- a/cp2/beacon/beacons.h
+++ /dev/null
@@ -1,115 +0,0 @@
-#ifndef cp_beacon_beacons_h
-#define cp_beacon_beacons_h
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp/beacon/beacons.h
- * \brief CP Beacon module
- * \ingroup cp_beacon
- *
- */
-#include <cyg/kernel/kapi.h>
-#include <cyg/hal/hal_arch.h>
-
-#include "cp/beacon/forward.h"
-
-#include "interface/interface.h"
-#include "mac/ca/ca.h"
-#include "mac/pbproc/pbproc.h"
-#include "mac/common/store.h"
-#include "hal/phy/phy.h"
-#include "hal/timer/timer.h"
-#include "cp/station/station.h"
-#include "cp/secu/secu.h"
-#include "cp/cco/cco.h"
-
-/** Call back used when the timer calls the beacon modules.
- * This will be use to provide the data to the CP.
- * The CP shall keep the event to request the beacon to process by calling the
- * right function.
- *
- * \param user_data the data registered in the callback.
- */
-typedef void (*cp_beacon_timer_cb_t) (void *user_data);
-
-enum cp_beacon_type
-{
- CP_BEACON_CENTRAL_BEACON,
- CP_BEACON_DISCOVER_BEACON,
- CP_BEACON_PROXY_BACON
-};
-
-/** Init the beacons module.
- * \param ctx the CP context.
- *
- * The Beacon module will need the following context to work :
- * - interface the interface context.
- * - phy the phy context.
- * - sta the station context.
- * - secu the control plane security layer context.
- * - ca the Channel Access context.
- * - mac_store mac_store.
- * - pbproc pbproc.
- * - cco the cco context.
- * - cb the function to call back when the module is awake by the
- * timer.
- * \return the beacon context.
- */
-cp_beacon_t *
-cp_beacon_init(cp_t *ctx);
-
-/** Initialise the beacon timer function call back.
- * \param ctx the cp context.
- * \param user_data a data register to call back.
- * \param cb the function to call.
- */
-void
-cp_beacon_init_timer_callback (cp_t *ctx, void *user_data,
- cp_beacon_timer_cb_t cb);
-
-/** Uninit the beacon module
- * \param ctx the cp context.
- */
-void
-cp_beacon_uninit(cp_t *ctx);
-
-/** Compute the AC line frequency from the PRATIC register.
- * \param ctx cp context.
- */
-void
-cp_beacon_acl_frequency_detection (cp_t *ctx);
-
-/** Send a beacon when the STA is acting as a CCo.
- * \param ctx the cp context.
- * \param beacon_type beacon type.
- */
-void
-cp_beacon_cco_send_beacon (cp_t *ctx, uint beacon_type);
-
-
-/** Generate the central beacon when the STA acts as a CCo.
- * \param ctx the cp context.
- */
-extern inline void
-cp_beacon_cco_send_central_beacon (cp_t *ctx)
-{
- dbg_assert (ctx);
- cp_beacon_cco_send_beacon (ctx, CP_BEACON_CENTRAL_BEACON);
-}
-
-/** Generate the discover beacon when the STA acts as a UCCo.
- * \param ctx the beacon context.
- */
-extern inline void
-cp_beacon_cco_send_discover_beacon (cp_t *ctx)
-{
- dbg_assert (ctx);
- cp_beacon_cco_send_beacon (ctx, CP_BEACON_DISCOVER_BEACON);
-}
-
-#endif /* cp_beacon_beacons_h */
diff --git a/cp2/beacon/inc/beacons.h b/cp2/beacon/inc/beacons.h
deleted file mode 100644
index 6df7167794..0000000000
--- a/cp2/beacon/inc/beacons.h
+++ /dev/null
@@ -1,132 +0,0 @@
-#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 */
diff --git a/cp2/beacon/ntb/inc/ntb_clock_sync.h b/cp2/beacon/ntb/inc/ntb_clock_sync.h
deleted file mode 100755
index ce218132ed..0000000000
--- a/cp2/beacon/ntb/inc/ntb_clock_sync.h
+++ /dev/null
@@ -1,170 +0,0 @@
-#ifndef cp_beacon_ntb_inc_ntb_clock_sync_h
-#define cp_beacon_ntb_inc_ntb_clock_sync_h
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp/beacon/ntb/inc/ntb_clock_sync.h
- * \brief 25Mhz clock management and synchronization functions.
- * \ingroup cp_beacon
- */
-
-#include "hal/phy/phy.h" /* HAL-PHY functions dedicated to NTB clock management (access to dedicated PRATIC registers) */
-#include "mac/common/config.h"
-
-#undef MANUFACTURER_TEST /* undef it for operational mode! */
-
-// ntb Constants
-
-#define NTB_CCO 0
-#ifdef MANUFACTURER_TEST
-#define NTB_STA1 1
-#define NTB_STA2 2
-#define NTB_SMAX 3 // count of stations (including the CCo)
-#else
-#define NTB_SMAX 2 // count of stations (including the CCo)
-#endif
-
-#define NTB_DEFAULT_OFFSET 0
-#define NTB_DEFAULT_NUMERATOR 1000000 // PRATIC default clock ratio numerator
-#define NTB_DEFAULT_DIVISOR 3000000 // PRATIC default clock ratio divisor
-
-#define NTB_PHY_Clk_theoric 75000000 // ideal PHY clock frequency in Hz
-#define NTB_STA_Clk_theoric 25000000 // ideal STA clock frequency in Hz (1/3 of PHY clock frequency)
-
-// ntb Types
-
-typedef enum
-{
- prev, // previous
- curr, // current
- next, // next
- e_cnt
-} e_ntb_histo;
-
-typedef struct {
-
- unsigned long k; // k Factor value for "w" weighting constant (w = 1 / 2^k)
- unsigned long beacon[e_cnt]; // beacon index
- unsigned long bts_ticks[e_cnt]; // BTS (Beacon Time Stamp) = CCo NTB date in entire ticks
- double sta_ntb_date_decticks[e_cnt]; // LTmr = STAn NTB date in decimal ticks
- unsigned long sta_ntb_date_ticks[e_cnt]; // LTmr = STAn NTB date in entire ticks
- double sta_phy_date_decticks[e_cnt]; // PHY LTmr = STA1 25Mhz PHY date (not corrected) in decimal ticks
- unsigned long sta_phy_date_ticks[e_cnt]; // PHY LTmr = STA1 25Mhz PHY date (not corrected) in entire ticks
- double sta_hpav_frequ_error[e_cnt]; // FreqError
- signed long long sta_hpav_offset[e_cnt]; // Offset calculated by formula from paragraph 5.5 of HP_AV specification
- signed long long sta_offset[e_cnt]; // Offset of NTB STA clock relative to CCo clock
- signed long sta_deriv_from_cco_ntb_ticks[e_cnt]; // STAn NTB date derive from CCo NTB in entire ticks
- signed long sta_relative_deriv_from_cco_ntb_ticks[e_cnt]; // STA NTB date relative derive from CCo NTB in entire ticks
- unsigned long sta_numerator[e_cnt]; // STAn current numerator for PHY_Clk divisor
- double sta_clk_frequ[e_cnt]; // STAn current STA_Clk frenquency in Hz
- unsigned long sta_predict_next_bts_ticks[e_cnt]; // Predicted value of CCo NTB date [next BTS] at next beacon (in entire ticks)
- unsigned long sta_predict_next_sta_ticks[e_cnt]; // Predicted value of STAn NTB date at next beacon if no correction (in entire ticks)
- signed long sta_predict_error_of_next_sta_ticks[e_cnt]; // Predicted error of STAn NTB date at next beacon (compared to next BTS value) if no correction (in entire ticks)
- double sta_clk_frequ_should_be[e_cnt]; // STAn STA clock should be adjusted to (in Hz)
- double sta_decimal_numerator_should_be[e_cnt]; // For max. derive of 25 ticks (25 ticks = 1 ppm @ 25Mhz), STAn STA/PHY clock ratio should be adjusted to (decimal numerator)
- unsigned long sta_integer_numerator_should_be[e_cnt]; // STAn STA/PHY clock ratio should be adjusted to (pure integer numerator)
- double sta_clk_frequ_will_be[e_cnt]; // STAn STA clock will be adjusted to (in Hz)
- double sta_ntb_estimated_decticks[e_cnt]; // NTB date estimation in decimal ticks
- unsigned long sta_ntb_estimated_ticks[e_cnt]; // NTB date estimation in entire ticks
- double sta_clk_frequ_sync_ratio[e_cnt];
- //double sta_average_deriv_from_cco_ntb_ticks[e_cnt];
- unsigned long sta_count_samples_for_average_deriv[e_cnt];
-
-} ntb_histo_t;
-
-typedef struct {
-
- phy_t * ntb_phy_ctx;
- mac_config_t * ntb_mac_config;
-
- ntb_histo_t ntb_histo;
-
- unsigned long long beacon_count;
-
-#ifdef MANUFACTURER_TEST
-
-#define beacon_period_on_50hz_pwl 40000 // in microseconds
-#define beacon_period_on_60hz_pwl 33333 // in microseconds
-#define beacon_period beacon_period_on_50hz_pwl // in microseconds
-
-#define simu_duration (60*15) // in seconds
-#define count_of_beacons ((simu_duration * 1000000) / beacon_period)
-
-double STA_Clk[NTB_SMAX]; // NTB STA clock frequency in Hz (CCo, STA1, ..., STAn)
-double beacon_period_decimal_ticks[NTB_SMAX];
-unsigned long beacon_period_ticks[NTB_SMAX];
-
-unsigned long PHY_Clk[NTB_SMAX]; // PHY clock frequency in Hz (CCo, STA1, ..., STAn)
-unsigned long numerator[NTB_SMAX]; // numerator for PHY clock division factor (CCo, STA1, ..., STAn)
-unsigned long divisor[NTB_SMAX]; // divisor for PHY clock division factor (CCo, STA1, ..., STAn)
-
-unsigned long current_sta;
-unsigned long beacon[count_of_beacons]; // beacon index
-signed long sta_cco_offset_ticks[NTB_SMAX-1];
-double cco_ntb_date_decticks[NTB_SMAX-1][count_of_beacons]; // CCo NTB date in decimal ticks
-unsigned long bts_ticks[NTB_SMAX-1][count_of_beacons]; // BTS (Beacon Time Stamp) = CCo NTB date in entire ticks
-double sta_ntb_date_decticks[NTB_SMAX-1][count_of_beacons]; // STAn NTB date in decimal ticks
-unsigned long sta_ntb_date_ticks[NTB_SMAX-1][count_of_beacons]; // STAn NTB date in entire ticks
-double sta_phy_date_decticks[NTB_SMAX-1][count_of_beacons]; // PHY LTmr = STAn 25Mhz PHY date (not corrected) in decimal ticks
-unsigned long sta_phy_date_ticks[NTB_SMAX-1][count_of_beacons]; // PHY LTmr = STAn 25Mhz PHY date (not corrected) in entire ticks
-signed long sta_deriv_from_cco_ntb_ticks[NTB_SMAX-1][count_of_beacons]; // STAn NTB date derive from CCo NTB in entire ticks
-signed long sta_relative_deriv_from_cco_ntb_ticks[NTB_SMAX-1][count_of_beacons]; // STAn NTB date relative derive from CCo NTB in entire ticks
-unsigned long sta_numerator[NTB_SMAX-1][count_of_beacons]; // STAn current numerator for PHY_Clk divisor
-double sta_clk_frequ[NTB_SMAX-1][count_of_beacons]; // STAn current STA_Clk frenquency in Hz
-unsigned long sta_predict_next_bts_ticks[NTB_SMAX-1][count_of_beacons]; // Predicted value of CCo NTB date [next BTS] at next beacon (in entire ticks)
-unsigned long sta_predict_next_sta_ticks[NTB_SMAX-1][count_of_beacons]; // Predicted value of STAn NTB date at next beacon if no correction (in entire ticks)
-signed long sta_predict_error_of_next_sta_ticks[NTB_SMAX-1][count_of_beacons]; // Predicted error of STAn NTB date at next beacon (compared to next BTS value) if no correction (in entire ticks)
-double sta_clk_frequ_should_be[NTB_SMAX-1][count_of_beacons]; // STAn STA clock should be adjusted to (in Hz)
-double sta_decimal_numerator_should_be[NTB_SMAX-1][count_of_beacons]; // For max. derive of 25 ticks (25 ticks = 1 ppm @ 25Mhz), STAn STA/PHY clock ratio should be adjusted to (decimal numerator)
-unsigned long sta_integer_numerator_should_be[NTB_SMAX-1][count_of_beacons]; // STAn STA/PHY clock ratio should be adjusted to (pure integer numerator)
-double sta_clk_frequ_will_be[NTB_SMAX-1][count_of_beacons]; // STAn STA clock will be adjusted to (in Hz)
-double sta_clk_frequ_sync_ratio[NTB_SMAX-1][count_of_beacons];
-#endif
-
-} ntb_t; // ntb context data structure
-
-BEGIN_DECLS
-
-// ntb API functions
-
-/*
- * Set or update NTB offset in the MAC Config.
- *
- * \param ntb_ctx, pointer to ntb context
- * \param offset, offset between NTB date (CCo date) and NTB_STA date (station date)
- */
-void cp_beacon_ntb_update_offset_in_mac_config(ntb_t *ntb_ctx, signed long offset);
-
-/*
- * NTB clock management module initialisation.
- *
- * \param phy_ctx, pointer to phy context
- * \param mac_config, pointer to mac config
- *
- * \return pointer to ntb_t ntb context data structure being allocated
- */
-ntb_t * ntb_init(phy_t *phy_ctx, mac_config_t *mac_config);
-
-/*
- * Synchronize local STA clock by adjusting its clock divisor as needed
- * depending on
- *
- * - current beacon timestamp (BTS),
- * - SYS-base local receive time of current beacon (SYS LTmr, based on 25 Mhz local clock frequency not adjusted onto CCo clock frequency),
- * - STA-base local receive time of current beacon (STA LTmr, based on 25 Mhz local clock frequency adjusted onto CCo clock frequency).
- *
- * \param ntb_ctx, pointer to ntb context
- * \param beacon_bts, beacon time stamp
- * \param beacon_sys_ltmr, SYS local time captured when receiving beacon
- * \param beacon_sta_ltmr, STA local time captured when receiving beacon
- */
-void ntb_clk_sync(ntb_t *ntb_ctx, unsigned long beacon_bts, unsigned long beacon_sys_ltmr, unsigned long beacon_sta_ltmr);
-
-END_DECLS
-
-#endif /* cp_beacon_ntb_inc_ntb_clock_sync_h */
diff --git a/cp2/beacon/ntb/src/ntb_clock_sync.c b/cp2/beacon/ntb/src/ntb_clock_sync.c
deleted file mode 100755
index 445051ed2d..0000000000
--- a/cp2/beacon/ntb/src/ntb_clock_sync.c
+++ /dev/null
@@ -1,541 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp/beacon/ntb/src/ntb_clock_sync.c
- * \brief 25Mhz clock management and synchronization functions.
- * \ingroup cp_beacon
- */
-#include "common/std.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-#include "cp/beacon/ntb/inc/ntb_clock_sync.h"
-
-// Local constants
-#ifdef MANUFACTURER_TEST
-//unsigned long PHY_Clk[] = { 74999997, 74992500, 75000030 }; // PHY clock frequency in Hz (CCo, STA1, STA2)
-unsigned long PHY_Clk[] = { 75001875, /*74998125*/75001875, 75000030 }; // PHY clock frequency in Hz (CCo, STA1, STA2)
-unsigned long numerator[] = { 1000000, 1000000, 1000000 }; // numerator for PHY clock division factor (CCo, STA1, STA2)
-unsigned long divisor[] = { 3000000, 3000000, 3000000 }; // divisor for PHY clock division factor (CCo, STA1, STA2)
-#endif
-
-#define ntb_max_ppm_deriv 1
-//#define ntb_max_ticks_deriv (ntb_max_ppm_deriv * NTB_STA_Clk_theoric / 1000000)
-#define ntb_max_ticks_deriv 0
-
-#define NTB_MAX_SAMPLES_FOR_AVERAGE 100
-#define ntb_kmax 10
-
-#define NTB_FREQU_MIN_25MHZ 24999375.0 // 25 Mhz + 25 ppm
-#define NTB_FREQU_MAX_25MHZ 25000625.0 // 25 Mhz - 25 ppm
-#define PWL_FREQU_MIN_50HZ 47.0 // see EN50160
-#define PWL_FREQU_MAX_50HZ 52.0 // see EN50160
-#define PWL_FREQU_MIN_60HZ 60.0 // TBD
-#define PWL_FREQU_MAX_60HZ 60.0 // TBD
-
-// More local declarations & inits
-
-#ifdef MANUFACTURER_TEST
-double STA_Clk[] = { 0.0, 0.0, 0.0 }; // NTB STA clock frequency in Hz (CCo, STA1, STA2)
-double beacon_period_decimal_ticks[] = { 0.0, 0.0, 0.0 };
-unsigned long beacon_period_ticks[] = { 0, 0, 0 };
-#else
-double STA_Clk[] = { 0.0, 0.0 }; // NTB STA clock frequency in Hz (CCo, STA)
-double beacon_period_decimal_ticks[] = { 0.0, 0.0 };
-unsigned long beacon_period_ticks[] = { 0, 0 };
-#endif
-
-#ifdef MANUFACTURER_TEST
-unsigned long current_sta = 0;
-unsigned long beacon[count_of_beacons]; // beacon index
-signed long sta_cco_offset_ticks[NTB_SMAX-1];
-double cco_ntb_date_decticks[NTB_SMAX-1][count_of_beacons]; // CCo NTB date in decimal ticks
-unsigned long bts_ticks[NTB_SMAX-1][count_of_beacons]; // BTS (Beacon Time Stamp) = CCo NTB date in entire ticks
-double sta_ntb_date_decticks[NTB_SMAX-1][count_of_beacons]; // STAn NTB date in decimal ticks
-unsigned long sta_ntb_date_ticks[NTB_SMAX-1][count_of_beacons]; // STAn NTB date in entire ticks
-double sta_phy_date_decticks[NTB_SMAX-1][count_of_beacons]; // PHY LTmr = STAn 25Mhz PHY date (not corrected) in decimal ticks
-unsigned long sta_phy_date_ticks[NTB_SMAX-1][count_of_beacons]; // PHY LTmr = STAn 25Mhz PHY date (not corrected) in entire ticks
-signed long sta_deriv_from_cco_ntb_ticks[NTB_SMAX-1][count_of_beacons]; // STAn NTB date derive from CCo NTB in entire ticks
-signed long sta_relative_deriv_from_cco_ntb_ticks[NTB_SMAX-1][count_of_beacons]; // STAn NTB date relative derive from CCo NTB in entire ticks
-unsigned long sta_numerator[NTB_SMAX-1][count_of_beacons]; // STAn current numerator for PHY_Clk divisor
-double sta_clk_frequ[NTB_SMAX-1][count_of_beacons]; // STAn current STA_Clk frenquency in Hz
-unsigned long sta_predict_next_bts_ticks[NTB_SMAX-1][count_of_beacons]; // Predicted value of CCo NTB date [next BTS] at next beacon (in entire ticks)
-unsigned long sta_predict_next_sta_ticks[NTB_SMAX-1][count_of_beacons]; // Predicted value of STAn NTB date at next beacon if no correction (in entire ticks)
-signed long sta_predict_error_of_next_sta_ticks[NTB_SMAX-1][count_of_beacons]; // Predicted error of STAn NTB date at next beacon (compared to next BTS value) if no correction (in entire ticks)
-double sta_clk_frequ_should_be[NTB_SMAX-1][count_of_beacons]; // STAn STA clock should be adjusted to (in Hz)
-double sta_decimal_numerator_should_be[NTB_SMAX-1][count_of_beacons]; // For max. derive of 25 ticks (25 ticks = 1 ppm @ 25Mhz), STAn STA/PHY clock ratio should be adjusted to (decimal numerator)
-unsigned long sta_integer_numerator_should_be[NTB_SMAX-1][count_of_beacons]; // STAn STA/PHY clock ratio should be adjusted to (pure integer numerator)
-double sta_clk_frequ_will_be[NTB_SMAX-1][count_of_beacons]; // STAn STA clock will be adjusted to (in Hz)
-double sta_clk_frequ_sync_ratio[NTB_SMAX-1][count_of_beacons];
-#endif
-
-static unsigned long ntb_lost_beacons(unsigned long delta_ticks);
-
-/*
- * Set or update NTB offset in the MAC Config.
- * \param ntb_ctx, pointer to ntb context
- * \param offset, offset between NTB date (CCo date) and NTB_STA date (station date)
- */
-void ntb_update_offset_in_mac_config(ntb_t *ntb_ctx, signed long offset)
-{
- dbg_assert_ptr(ntb_ctx);
- dbg_assert_ptr(ntb_ctx->ntb_mac_config);
-
- /* update the u32 "ntb_offset_tck" field (NTB offset) in the mac_config_t Struct Reference */
- ntb_ctx->ntb_mac_config->ntb_offset_tck = (unsigned long) offset;
-}
-
-/*
- * NTB clock management module initialisation.
- * \param phy_ctx, pointer to phy context
- * \param mac_config, pointer to mac config
- * \return pointer to ntb_t ntb context data structure being allocated
- */
-ntb_t * ntb_init(phy_t *phy_ctx, mac_config_t *mac_config)
-{
- //int i;
- ntb_t * ntb_ctx;
-
- dbg_assert_ptr(phy_ctx);
- dbg_assert_ptr(mac_config);
-
- ntb_ctx = malloc(sizeof(ntb_t));
- if (ntb_ctx != NULL)
- {
- /* reset ntb context data */
- memset(ntb_ctx,0x00,sizeof(ntb_t));
-
- /* set pointers to needed contexts */
- ntb_ctx->ntb_phy_ctx = phy_ctx;
- ntb_ctx->ntb_mac_config = mac_config;
-
- /*for (i = 0; i < NTB_SMAX; i++)
- {
- ntb_ctx->STA_Clk[i] = 0.0;
- ntb_ctx->beacon_period_decimal_ticks[i] = 0.0;
- ntb_ctx->beacon_period_ticks[i] = 0;
- }*/
-
- ntb_ctx->beacon_count = 0;
-
- /* initialize the numerator value in the PRATIC config to its default value (1000000) */
- phy_clock_set_numerator (ntb_ctx->ntb_phy_ctx, NTB_DEFAULT_NUMERATOR);
- /* initialize the offset value in the MAC Config to zero by default */
- ntb_update_offset_in_mac_config(ntb_ctx, NTB_DEFAULT_OFFSET);
- }
-
- return ntb_ctx;
-}
-
-/*
- * Calculate the number of beacons lost (if any) between 2 beacons received.
- * \param delta_ticks difference of BTS timestamp between 2 last received beacons
- * \return count of lost beacons
- */
-static unsigned long ntb_lost_beacons(unsigned long delta_ticks)
-{
- unsigned long i;
-
- /*
- * Remembering beacon period equals twice the PWL cycle (here in 25 Mhz ticks),
- * evaluating the count of lost beacons between the two last beacons being received,
- * by successive cumulative comparisons with min and max theoric values of normal beacon period
- */
- for (i = 0; ; i++)
- {
- if (
- ((double)delta_ticks > ((double)(i+1)*((NTB_FREQU_MIN_25MHZ * 2.0) / PWL_FREQU_MAX_50HZ)))
- &&
- ((double)delta_ticks < ((double)(i+1)*((NTB_FREQU_MAX_25MHZ * 2.0) / PWL_FREQU_MIN_50HZ)))
- )
- break;
- }
- //if (i > 0) printf("%s(%lu) : %lu lost beacon(s)!!!\n",__FUNCTION__,delta_ticks,i);
- return i;
-}
-
-/*
- * Synchronize local STA clock by adjusting its clock divisor as needed
- * depending on
- *
- * - current beacon timestamp (BTS),
- * - SYS-base local receive time of current beacon (SYS LTmr, based on 25 Mhz local clock frequency not adjusted onto CCo clock frequency),
- * - STA-base local receive time of current beacon (STA LTmr, based on 25 Mhz local clock frequency adjusted onto CCo clock frequency).
- *
- * \param ntb_ctx pointer to ntb context
- * \param beacon_bts beacon time stamp
- * \param beacon_sys_ltmr SYS local time captured when receiving beacon
- * \param beacon_sta_ltmr STA local time captured when receiving beacon
- */
-void ntb_clk_sync(ntb_t *ntb_ctx, unsigned long beacon_bts, unsigned long beacon_sys_ltmr, unsigned long beacon_sta_ltmr)
-{
- #define p ntb_ctx
- #define nh ntb_ctx->ntb_histo
-
- unsigned long long i; /* beacon index */
- double err_freq_ppm;
- unsigned long delta_bts_ticks;
- unsigned long lost_beacons_count;
-
- dbg_assert_ptr(p);
- dbg_assert_ptr(p->ntb_phy_ctx);
- dbg_assert_ptr(p->ntb_mac_config);
-
- /* update count of beacons and current beacon index */
- i = p->beacon_count;
- p->beacon_count++;
-
- /* k factor for w weighting constant (w = 1/2^k) */
- // LOI EXPONENTIELLE
- nh.k = (int) (kmax+1)*(1-exp(-(i*1.0)/100.0));
-
- /* save old values */
- nh.bts_ticks[prev] = nh.bts_ticks[curr];
- nh.sta_ntb_date_decticks[prev] = nh.sta_ntb_date_decticks[curr];
- nh.sta_ntb_date_ticks[prev] = nh.sta_ntb_date_ticks[curr];
- nh.sta_phy_date_decticks[prev] = nh.sta_phy_date_decticks[curr];
- nh.sta_phy_date_ticks[prev] = nh.sta_phy_date_ticks[curr];
- nh.sta_hpav_frequ_error[prev] = nh.sta_hpav_frequ_error[curr];
- nh.sta_hpav_offset[prev] = nh.sta_hpav_offset[curr];
- nh.sta_offset[prev] = nh.sta_offset[curr];
- nh.sta_numerator[prev] = nh.sta_numerator[curr];
- nh.sta_numerator[curr] = nh.sta_numerator[next];
-
- /* compute new current data depending on new current values (function arguments) and, if needed, predict future values */
- nh.bts_ticks[curr] = beacon_bts;
- nh.sta_ntb_date_ticks[curr] = beacon_sta_ltmr;
- nh.sta_phy_date_ticks[curr] = beacon_sys_ltmr;
- nh.sta_phy_date_decticks[curr] = beacon_sys_ltmr;
-
- if (i == 0)
- {
- nh.bts_ticks[prev] = 0;
- nh.sta_ntb_date_decticks[prev] = 0;
- nh.sta_ntb_date_ticks[prev] = 0;
- nh.sta_phy_date_decticks[prev] = 0;
- nh.sta_phy_date_ticks[prev] = 0;
- //nh.sta_cco_offset_ticks[prev] = 0;
- nh.sta_deriv_from_cco_ntb_ticks[prev] = 0;
- nh.sta_relative_deriv_from_cco_ntb_ticks[prev] = 0;
- nh.sta_numerator[prev] = 0;
- nh.sta_clk_frequ[prev] = 0;
- nh.sta_predict_next_bts_ticks[prev] = 0;
- nh.sta_predict_next_sta_ticks[prev] = 0;
- nh.sta_predict_error_of_next_sta_ticks[prev] = 0;
- nh.sta_clk_frequ_should_be[prev] = 0;
- nh.sta_decimal_numerator_should_be[prev] = 0;
- nh.sta_integer_numerator_should_be[prev] = 0;
- nh.sta_clk_frequ_will_be[prev] = 0;
-
- nh.sta_clk_frequ_sync_ratio[prev] = 0;
- //nh.sta_average_deriv_from_cco_ntb_ticks[prev] = 0;
- nh.sta_count_samples_for_average_deriv[prev] = 0;
-
- //nh.sta_cco_offset_ticks[curr] = 0;
- nh.sta_deriv_from_cco_ntb_ticks[curr] = 0;
- nh.sta_relative_deriv_from_cco_ntb_ticks[curr] = 0;
- nh.sta_numerator[curr] = NTB_DEFAULT_NUMERATOR;
- nh.sta_clk_frequ[curr] = 0;
- nh.sta_predict_next_bts_ticks[curr] = 0;
- nh.sta_predict_next_sta_ticks[curr] = 0;
- nh.sta_predict_error_of_next_sta_ticks[curr] = 0;
- nh.sta_clk_frequ_should_be[curr] = 0;
- nh.sta_decimal_numerator_should_be[curr] = 0;
- nh.sta_integer_numerator_should_be[curr] = 0;
- nh.sta_clk_frequ_will_be[curr] = 0;
- nh.sta_clk_frequ_sync_ratio[curr] = 0;
- nh.sta_count_samples_for_average_deriv[curr] = 0;
-
- /* only one (first) beacon received, so no sufficient data available to compute clock adjustment */
- nh.sta_hpav_frequ_error[curr] = 0;
- nh.sta_hpav_offset[curr] = (signed long long) nh.bts_ticks[curr] - (signed long long) nh.sta_phy_date_ticks[curr];
-
- //*p_err_freq_ppm = 0.0;
- err_freq_ppm = 0.0;
- }
- else
- {
- delta_bts_ticks = nh.bts_ticks[curr] - nh.bts_ticks[prev];
- lost_beacons_count = ntb_lost_beacons(delta_bts_ticks);
- //if (lost_beacons_count > 0) printf("%s() : %lu lost beacon(s)\n",__FUNCTION__,lost_beacons_count);
- if (i == 1)
- {
- /* two beacons received, compute/prepare clock adjustment parameters */
- nh.sta_hpav_frequ_error[curr] = (double)(nh.bts_ticks[curr] - nh.bts_ticks[prev]) / (double)(nh.sta_phy_date_ticks[curr] - nh.sta_phy_date_ticks[prev]) - 1;
- nh.sta_hpav_offset[curr] = (signed long long) nh.bts_ticks[curr] - (signed long long) nh.sta_phy_date_ticks[curr];
- }
- else
- {
- /* more than two beacons received, compute/prepare clock adjustment parameters */
- nh.sta_hpav_frequ_error[curr] = nh.sta_hpav_frequ_error[prev] + (1.0/pow(2.0,nh.k)) * ((double)(nh.bts_ticks[curr] - nh.bts_ticks[prev]) / (double)(nh.sta_phy_date_ticks[curr] - nh.sta_phy_date_ticks[prev]) - 1 - nh.sta_hpav_frequ_error[prev]);
- /*nh.sta_hpav_offset[curr] = nh.sta_hpav_offset[prev] + nh.sta_hpav_frequ_error[curr] * (nh.sta_ntb_date_ticks[curr] - nh.sta_ntb_date_ticks[prev]) + (1.0/pow(2.0,nh.k)) * ((nh.bts_ticks[curr] - nh.sta_ntb_date_ticks[curr]) - (nh.sta_hpav_offset[prev] + nh.sta_hpav_frequ_error[curr] * (nh.sta_ntb_date_ticks[curr] - nh.sta_ntb_date_ticks[prev])));*/
- nh.sta_hpav_offset[curr] = (double) nh.sta_hpav_offset[prev] + nh.sta_hpav_frequ_error[curr] * (double)((signed long long)nh.sta_phy_date_ticks[curr] - (signed long long)nh.sta_phy_date_ticks[prev]) + (1.0/pow(2.0,nh.k)) * (double)((signed long long)nh.bts_ticks[curr] - (signed long long)nh.sta_phy_date_ticks[curr]) - ((signed long long)nh.sta_hpav_offset[prev] + nh.sta_hpav_frequ_error[curr] * (double)((signed long long)nh.sta_phy_date_ticks[curr] - (signed long long)nh.sta_phy_date_ticks[prev]));
- }
- err_freq_ppm = nh.sta_hpav_frequ_error[curr] * 1000000.0;
- phy_sysclock_set_freqerror (ntb_ctx->ntb_phy_ctx, err_freq_ppm);
- /* At least 2 beacons received, we can compute/estimate STA clock offset & derivation and update the clock divisor factor as needed */
- //nh.sta_ntb_estimated_decticks[curr] = nh.sta_ntb_date_decticks[curr] + nh.sta_hpav_offset[curr] + nh.sta_hpav_frequ_error[curr] * (nh.sta_ntb_date_decticks[curr] - nh.sta_ntb_date_decticks[prev]);
- //nh.sta_ntb_estimated_ticks[curr] = nh.sta_ntb_date_ticks[curr] + nh.sta_hpav_offset[curr] + nh.sta_hpav_frequ_error[curr] * (nh.sta_ntb_date_ticks[curr] - nh.sta_ntb_date_ticks[curr-1]);
- nh.sta_decimal_numerator_should_be[curr] = (double)NTB_DEFAULT_NUMERATOR * (nh.sta_hpav_frequ_error[curr] + 1.0);
- nh.sta_integer_numerator_should_be[curr] = (signed long)(nh.sta_decimal_numerator_should_be[curr]+0.5);
- if (nh.sta_integer_numerator_should_be[curr] != nh.sta_numerator[curr])
- {
- // update the numerator value in the PRATIC config ! */
- phy_clock_set_numerator (ntb_ctx->ntb_phy_ctx, nh.sta_integer_numerator_should_be[curr]);
- nh.sta_numerator[next] = nh.sta_integer_numerator_should_be[curr];
- }
- else
- {
- nh.sta_numerator[next] = nh.sta_numerator[curr];
- }
- }
-
- /* offset from adjusted STA clock to NTB clock (NTB clock = CCo clock) */
- nh.sta_offset[curr] = nh.bts_ticks[curr] - nh.sta_ntb_date_ticks[curr];
- //nh.sta_offset[curr] = nh.bts_ticks[curr] - nh.sta_phy_date_ticks[curr];
- //printf ("%d\n", (nh.bts_ticks[curr] - nh.bts[prev]) - (
- //if (nh.k>=7)
- //int t;
- //if (nh.k<3) t=0;
- //else t = nh.k-3;
- // nh.sta_offset[curr] = nh.sta_offset[prev] + (1.0/pow(2,nh.k-7))*(nh.sta_offset[curr] - nh.sta_offset[prev]);
- if (nh.sta_offset[curr] != nh.sta_offset[prev])
- {
- /* update the offset value in the MAC Config ! */
- ntb_update_offset_in_mac_config(ntb_ctx, nh.sta_offset[curr]);
- nh.sta_offset[next] = nh.sta_offset[curr];
- }
- else
- {
- nh.sta_offset[next] = nh.sta_offset[prev];
- }
-
-#ifdef MANUFACTURER_TEST
- printf("Beacon_%05llu %010lu %010lu %011ld (%05ld) %010lu %010lu %05ld %08.14g %08.14g %02.14g (numer.div=%07lu) [%03lu]\n",
- i,
- nh.bts_ticks[curr],
- nh.sta_ntb_date_ticks[curr],
- (signed long)((signed long long)nh.sta_ntb_date_ticks[curr]-(signed long long)nh.bts_ticks[curr]),
- nh.sta_relative_deriv_from_cco_ntb_ticks[curr],
- nh.sta_predict_next_bts_ticks[curr],
- nh.sta_predict_next_sta_ticks[curr],
- nh.sta_predict_error_of_next_sta_ticks[curr],
- STA_Clk[0],
- nh.sta_clk_frequ_will_be[curr],
- nh.sta_clk_frequ_sync_ratio[curr],
- nh.sta_integer_numerator_should_be[curr],
- nh.sta_count_samples_for_average_deriv[curr]
- );
-#else
-
- printf("Beacon_%05llu (%lu) %010lu %010lu %011ld (%05ld) %010lu %010lu %05ld %08.14g %08.14g %02.14g (numer.div=%07lu) [%03lu] %02.14g\n",
- i,
- nh.k,
- nh.bts_ticks[curr],
- nh.sta_ntb_date_ticks[curr],
- (signed long)((signed long long)nh.sta_ntb_date_ticks[curr]-(signed long long)nh.bts_ticks[curr]),
- nh.sta_relative_deriv_from_cco_ntb_ticks[curr],
- nh.sta_predict_next_bts_ticks[curr],
- nh.sta_predict_next_sta_ticks[curr],
- nh.sta_predict_error_of_next_sta_ticks[curr],
- STA_Clk[0],
- nh.sta_clk_frequ_will_be[curr],
- nh.sta_clk_frequ_sync_ratio[curr],
- nh.sta_integer_numerator_should_be[curr],
- nh.sta_count_samples_for_average_deriv[curr],
- err_freq_ppm//nh.sta_average_deriv_from_cco_ntb_ticks[curr]
- );
-
-#endif
-
-}
-
-
-#ifdef MANUFACTURER_TEST
-// Computing clock synchronization over time & beacons transmitted by CCo and received by STAs...
-// argv[1] = initial date for CCo
-// argv[2] = initial date for STA1
-// argv[3] = initial date for STA2
-int main(int argc, char *argv[])
-{
- unsigned long s;
- unsigned long i;
- unsigned long cco_ntb_date_begin_ticks = 0;
- unsigned long sta_ntb_date_begin_ticks[NTB_SMAX-1];
- phy_t phy_ctx[NTB_SMAX-1];
- mac_config_t mac_cfg[NTB_SMAX-1];
- ntb_t * my_ntb_ctx[NTB_SMAX-1];
-
- ///////////////// Inits... ///////////////////////////////////////
-
- if (argc > 2)
- {
- cco_ntb_date_begin_ticks = atoi(argv[1]);
- for (s = 0; s < (argc-2); s++)
- {
- sta_ntb_date_begin_ticks[s] = atoi(argv[s+2]);
- }
- }
- else
- {
- for (s = 0; s < (NTB_SMAX-1); s++)
- {
- sta_ntb_date_begin_ticks[s] = 0;
- }
- }
-
- /*for (i = 0; i < (NTB_SMAX-1); i++)
- {
- my_ntb_ctx[i] = ntb_init(&phy_ctx[i],&mac_cfg[i]);
- if (my_ntb_ctx[i] == NULL)
- {
- return -1;
- }
- }*/
-
- //for (i = 0; i < NTB_SMAX; i++) s[i] = i + 1;
-
- for (i = 0; i < NTB_SMAX; i++)
- {
- STA_Clk[i] = ((double)PHY_Clk[i] * (double)numerator[i]) / (double)divisor[i];
- beacon_period_decimal_ticks[i] = (double)(STA_Clk[i] * ((double)beacon_period/1000.0)) / 1000.0;
- beacon_period_ticks[i] = (signed long)(beacon_period_decimal_ticks[i]);
- }
-
- ///////////////// End of Inits /////////////////////////////////////
-
-
- //// Simulation loop ////
-
- // for each beacon...
- for (i = 0; i < count_of_beacons; i++)
- {
- // for each STA receiving that beacon...
- for (s = 0; s < (NTB_SMAX-1); s++)
- {
- cco_ntb_date_decticks[s][i] = cco_ntb_date_begin_ticks + ((double)i * beacon_period_decimal_ticks[CCO]);
- bts_ticks[s][i] = (signed long)(cco_ntb_date_decticks[s][i]);
- sta_phy_date_decticks[s][i] = sta_ntb_date_begin_ticks[s] + ((double)i * beacon_period_decimal_ticks[s+1]);
- sta_phy_date_ticks[s][i] = (signed long)(sta_phy_date_decticks[s][i]);
-
- if (i == 0)
- {
- // first beacon...
- sta_numerator[s][i] = numerator[s+1];
- sta_clk_frequ[s][i] = STA_Clk[s+1];
- sta_ntb_date_decticks[s][i] = sta_ntb_date_begin_ticks[s];
- sta_ntb_date_ticks[s][i] = (signed long)(sta_ntb_date_decticks[s][i]);
- sta_cco_offset_ticks[s] = (signed long) (sta_ntb_date_ticks[s][i] - bts_ticks[s][i]);
- sta_predict_next_bts_ticks[s][i] = 0; // N/A => 0 ? Shall be theoritically [current_BTS + theoric_ticks_count_for_beacon_period_at_25mhz] !
- sta_predict_next_sta_ticks[s][i] = 0; // N/A => 0 ? Shall be theoritically [current_STA_Clk + theoric_ticks_count_for_beacon_period_at_current_STA_Clk_Frequ] !
- sta_predict_error_of_next_sta_ticks[s][i] = 0; // N/A => 0 ?
- sta_clk_frequ_should_be[s][i] = sta_clk_frequ[s][i];
- sta_clk_frequ_sync_ratio[s][i] = sta_clk_frequ_should_be[s][i] / sta_clk_frequ[s][i];
- sta_decimal_numerator_should_be[s][i] = numerator[s+1];
- }
- else
- {
- // next beacons...
- sta_numerator[s][i] = sta_integer_numerator_should_be[s][i-1];
- sta_clk_frequ[s][i] = sta_clk_frequ_will_be[s][i-1];
- sta_ntb_date_decticks[s][i] = sta_ntb_date_decticks[s][i-1] + ((sta_clk_frequ_will_be[s][i-1] * ((double)beacon_period/1000.0)) / 1000.0);
- sta_ntb_date_ticks[s][i] = (signed long)(sta_ntb_date_decticks[s][i]);
- sta_predict_next_bts_ticks[s][i] = bts_ticks[s][i] + (bts_ticks[s][i] - bts_ticks[s][i-1]);
- sta_predict_next_sta_ticks[s][i] = sta_ntb_date_ticks[s][i] + (sta_ntb_date_ticks[s][i] - sta_ntb_date_ticks[s][i-1]);
- sta_predict_error_of_next_sta_ticks[s][i] = (signed long)( sta_predict_next_sta_ticks[s][i]
- - sta_predict_next_bts_ticks[s][i]
- - sta_cco_offset_ticks[s]);
- sta_clk_frequ_should_be[s][i] = (double)((sta_predict_next_bts_ticks[s][i] - (sta_ntb_date_ticks[s][i]-sta_cco_offset_ticks[s])) * 1000) / ((double)beacon_period/1000.0);
- sta_clk_frequ_sync_ratio[s][i] = sta_clk_frequ_should_be[s][i] / sta_clk_frequ[s][i];
-
- // detect clock derive and, if needed, compute the clock division factor to adjust the clock frequency...
- if (abs(sta_predict_error_of_next_sta_ticks[s][i]) < max_ticks_deriv)
- {
- sta_decimal_numerator_should_be[s][i] = sta_numerator[s][i];
- }
- else
- {
- sta_decimal_numerator_should_be[s][i] = ((double)sta_numerator[s][i] * sta_clk_frequ_should_be[s][i]) / sta_clk_frequ[s][i];
- }
- }
- sta_integer_numerator_should_be[s][i] = (signed long)(sta_decimal_numerator_should_be[s][i]+0.5);
- sta_clk_frequ_will_be[s][i] = ((double)PHY_Clk[s+1] * (double)sta_integer_numerator_should_be[s][i]) / (double)divisor[s+1];
- sta_deriv_from_cco_ntb_ticks[s][i] = bts_ticks[s][i] - sta_ntb_date_ticks[s][i];
- sta_relative_deriv_from_cco_ntb_ticks[s][i] = (signed long)((signed long long)sta_ntb_date_ticks[s][i]-(signed long long)bts_ticks[s][i]-(signed long long)sta_cco_offset_ticks[s]);
-
- }
- }
-
- // print simulation data...
- printf("\n\n");
- // for each STA...
- for (s = 0; s < (NTB_SMAX-1); s++)
- {
- printf("Results of clock synchronization simulation for STA%lu :\n\n",s+1);
- // print clock synchronization data for each beacon being received...
- for (i = 0; i < count_of_beacons; i++)
- {
- printf("Beacon_%05lu %010lu %010lu %010lu %011ld (%011ld ; %05ld) %010lu %010lu %05ld %08.14g %08.14g %02.14g (numer.div=%07lu)\n",
- i,
- sta_phy_date_ticks[s][i],
- bts_ticks[s][i],
- sta_ntb_date_ticks[s][i],
- (signed long)((signed long long)sta_ntb_date_ticks[s][i]-(signed long long)bts_ticks[s][i]),
- sta_cco_offset_ticks[s],
- sta_relative_deriv_from_cco_ntb_ticks[s][i],
- sta_predict_next_bts_ticks[s][i],
- sta_predict_next_sta_ticks[s][i],
- sta_predict_error_of_next_sta_ticks[s][i],
- STA_Clk[0],
- sta_clk_frequ_will_be[s][i],
- sta_clk_frequ_sync_ratio[s][i],
- sta_integer_numerator_should_be[s][i]
- );
- }
- printf("\n\n");
- }
-
- signed long err_ticks;
- double freq_err_ppm;
- // compare simulation data with synchronization data computed with independent synchronization function (applying same algorithm)...
- printf("\n\n");
- // for each STA...
- for (s = 0; s < (NTB_SMAX-1); s++)
- {
- printf("Compare results of clock synchronization for STA%lu :\n\n",s+1);
-#ifdef MANUFACTURER_TEST
- current_sta = s+1;
-#endif
- // new STA => need to init the NTB clock synchro module dedicated to that STA...
- my_ntb_ctx[s] = ntb_init(&phy_ctx[s],&mac_cfg[s]);
- if (my_ntb_ctx[s] == NULL)
- {
- return -1;
- }
- // compare clock synchronization data for each beacon being received...
- for (i = 0; i < count_of_beacons; i++)
- {
-#if 0
- err_ticks = ntb_clk_sync(my_ntb_ctx[s], bts_ticks[s][i], sta_phy_date_ticks[s][i], sta_ntb_date_ticks[s][i], &freq_err_ppm);
- if (err_ticks != sta_relative_deriv_from_cco_ntb_ticks[s][i])
- {
- printf("ntb_clk_sync() for beacon_%05lu on STA%lu revealed %ld tick of relative error for %ld expected by simulation\n",i,s+1,err_ticks,sta_relative_deriv_from_cco_ntb_ticks[s][i]);
- }
-#else
- ntb_clk_sync(my_ntb_ctx[s], bts_ticks[s][i], sta_phy_date_ticks[s][i], sta_ntb_date_ticks[s][i]);
-#endif
- }
- printf("\n\n");
- free(my_ntb_ctx[s]);
- }
-
- return 0;
-}
-#endif
diff --git a/cp2/cco/action/action.h b/cp2/cco/action/action.h
deleted file mode 100644
index 3d2247394a..0000000000
--- a/cp2/cco/action/action.h
+++ /dev/null
@@ -1,179 +0,0 @@
-#ifndef cp_cco_action_action_h
-#define cp_cco_action_action_h
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp/cco/action/action.h
- * \brief actions of CCo responsability
- * \ingroup cp_cco
- *
- * CCo action module implements actions of CCo responsability
- * manage SNID "collisions" (if SNID conflict, a new SNID value shall be chosen)
- * manage TEI leases (create, suppress, expire)
- * manage sta association
- * manage authentication with relevant keys (NEK, NMK) and security-level
- * in 1st step/version, each sta generates the default NMK from own NPW
- * (the NMK is used to belong to a given AVLN where all STAs and the CCo
- * have the same NMK) and the CCo in a given AVLN generates a NEK key
- * and sends it to stations which perform authentication steps.
- *
- * Initialisation of SNID & management of SNID conflicts (section 4.4.1.4 in HP_AV spec)
- * Le SNID est prévu comme étant une représentation "raccourcie" du NID d'un AVLN
- * devant également permettre de faire la distinction entre 2 AVLNs ayant des NMKs
- * respectives différentes mais qui auraient un NID identique (un NID étant
- * obtenu par hachage SHA256 de NMK, le hachage de 2 NMKs différentes peut
- * produire un même NID, même si ce cas de figure est statistiquement improbable).
- * Dans le cas d'un NID identique pour 2 AVLNs ayant chacun une NMK respective
- * différente de celle de l'autre AVLN, il faut alors un SNID différent pour chacun
- * des 2 AVLNs.
- * Une CCo "1" qui détecterait un SNID identique au sien (arrivée d'un Central Beacon
- * d'une autre CCo "2", donc d'un autre AVLN, avec SNID identique) doit choisir
- * un autre SNID.
- * Le SNID qui était en double doit être marqué comme utilisé et la CCo "1" peut
- * finalement choisir une autre valeur de SNID parmi les SNIDs non utilisés
- * sur les 16 SNIDs possibles (le SNID est un entier sur 4 bits).
- * Le choix initial du SNID lorsqu'une station (un équipement) HP_AV s'initialise
- * puis passe à l'état "Unassociated CCo" ou "CCo" sera un tirage aléatoire entre
- * 0 inclus et 15 inclus, ce qui permet de diminuer le risque de doublon de SNID
- * entre les UCCo et CCo sur le même réseau Power-Line au démarrage (mise en route
- * du secteur avec des équipements fixes connectés, ou branchement d'un ou plusieurs
- * nouveaux équipements configurés avec un NPW différent de celui des autres équipements
- * déjà présents, par exemple)
- * La valeur initiale du SNID ou une nouvelle valeur du SNID déterminée/choisie
- * après détection d'un conflit de SNID doit être recopiée dans la structure
- * mac_config pour être rendue disponible dans les couches du Data-Plane qui
- * utilisent le SNID. Un mécanisme approprié d'activation temporisée d'une nouvelle
- * valeur du SNID soit être prévu
- */
-
-BEGIN_DECLS
-
-/**
- * initialisation of CCo action module.
- *
- * \param ctx control plane context
- */
-void
-cp_cco_action_init(cp_t *ctx);
-
-/**
- * initialisation of "SNID in use" flags.
- *
- * \param ctx control plane context
- */
-void
-cp_cco_action_reset_snid_flags(cp_t *ctx);
-
-/**
- * check against SNID conflict.
- *
- * \param ctx control plane context
- *
- * \return true if SNID conflict, else false
- *
- * if the SNID value in argument is in conflict, it is flagged
- * as already used in the SNID flags
- */
-bool
-cp_cco_action_check_snid_conflict(cp_t *ctx, snid_t snid);
-
-/**
- * choose a new SNID value.
- *
- * \param ctx control plane context
- * \param p_snid pointer to return new snid value chosen
- *
- * \return false if new SNID could not be chosen, else true
- *
- * \todo what to do if new SNID could not be chosen?
- *
- * WARNING La valeur initiale du SNID ou une nouvelle valeur du SNID déterminée/choisie
- * après détection d'un conflit de SNID doit être recopiée dans la structure
- * mac_config pour être rendue disponible dans les couches du Data-Plane qui
- * utilisent le SNID. Un mécanisme approprié d'activation temporisée d'une nouvelle
- * valeur du SNID soit être prévu
- */
-bool
-cp_cco_action_choose_new_snid(cp_t *ctx, snid_t *p_snid);
-
-
-/**
- * get a (first) random SNID value.
- *
- * \param ctx control plane context
- *
- * \return random SNID value between 0 and 15
- *
- * WARNING La valeur initiale du SNID doit être recopiée dans la structure
- * mac_config pour être rendue disponible dans les couches du Data-Plane qui
- * utilisent le SNID.
- */
-snid_t
-cp_cco_action_get_random_snid(cp_t *ctx);
-
-/**
- * create a TEI lease.
- *
- * \param ctx control plane context
- * \param p_tei pointer to return new TEI lease
- *
- * \return false if TEI lease creation failed, else true
- */
-bool
-cp_cco_action_create_tei_lease(cp_t *ctx, tei_t *p_tei);
-
-/**
- * check for TEI lease expiration.
- *
- * \param ctx control plane context
- * \param p_tei pointer to TEI lease to be checked
- *
- * \return true if TEI lease expired, else false
- */
-bool
-cp_cco_action_check_tei_lease(cp_t *ctx, tei_t *p_tei);
-
-/**
- * remove a TEI lease.
- *
- * \param ctx control plane context
- * \param p_tei pointer to TEI lease to be removed
- *
- * \return false if removing TEI lease failed, else true
- */
-bool
-cp_cco_action_remove_tei_lease(cp_t *ctx, tei_t *p_tei);
-
-/**
- * generate a new NEK value.
- *
- * \param ctx control plane context
- * \param sl security level
- *
- * \return generated nek value
- */
-nek_t
-cp_cco_action_gen_nek(cp_t *ctx, u8 sl);
-
-/**
- * manage association of a station.
- *
- * \param ctx control plane context
- */
-void cp_cco_action_manage_sta_assoc(cp_t *ctx);
-
-/**
- * manage authentication of a station.
- *
- * \param ctx control plane context
- */
-void cp_cco_action_manage_sta_auth(cp_t *ctx);
-
-END_DECLS
-
-#endif /* cp_cco_action_action_h */
diff --git a/cp2/cco/action/doc/CCo Con.odt b/cp2/cco/action/doc/CCo Con.odt
deleted file mode 100755
index 3d3fa51285..0000000000
--- a/cp2/cco/action/doc/CCo Con.odt
+++ /dev/null
Binary files differ
diff --git a/cp2/cco/bw/doc/Bandwidth_Manager.odt b/cp2/cco/bw/doc/Bandwidth_Manager.odt
deleted file mode 100755
index 50ccce066e..0000000000
--- a/cp2/cco/bw/doc/Bandwidth_Manager.odt
+++ /dev/null
Binary files differ
diff --git a/cp2/cco/region/doc/Region_Manager.odt b/cp2/cco/region/doc/Region_Manager.odt
deleted file mode 100755
index bb652ca06f..0000000000
--- a/cp2/cco/region/doc/Region_Manager.odt
+++ /dev/null
Binary files differ
diff --git a/cp2/cl_interf/cl_interf.h b/cp2/cl_interf/cl_interf.h
deleted file mode 100644
index 6f51494e99..0000000000
--- a/cp2/cl_interf/cl_interf.h
+++ /dev/null
@@ -1,126 +0,0 @@
-#ifndef cl_interf__h__
-#define cl_interf__h__
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file Cesare/cp/cl_interf/cl_interf.h
- * \brief mme interface between CP and DP
- * \ingroup cp/cl_interf
- *
- * This module will :
- * - get the mme from CL
- * - if necessary, reassemble it
- * - manage the Tx buffer
- * - send mme to the CL
- */
-
-#include "inc/cl_interf_defs.h"
-
-
-
-BEGIN_DECLS
-
-/**
- * initialisation of cp_cl_interf module.
- *
- * \param ctx the cp context
- *
- * register callbacks in DP/CL module,
- * clear buffers etc.
- *
- */
-void
-cp_cl_interf_init(cp_t *ctx);
-
-/**
- * callback for Rx MME.
- *
- * \param ctx the cp context
- * \param payload the mme itself
- * \param payload_size size of the payload
- * \param mfs the receiving mfs
- * \param hardware_encrypted set to true if the mme was hardwarely encrypted
- *
- * !!! this function is executed in the CL context !!!
- * 1) push the message in the MMEs fifo
- * 2) set the flag to unlock the station core
- */
-void
-cp_cl_interf_rx_mme(cp_t *ctx, char *payload, int payload_size, mfs_t * mfs, bool hardware_encrypted);
-
-/**
- * return the last received and completed mme.
- *
- * \param ctx the cp context
- * \return mme_rx_t the mme context (for unit test purpose only)
- *
- * 1) get the last MME from the MMEs fifo
- * 2) read the MME's header and store it in a newly allocated MME Tx context
- * 3) check the ODA, and the MME constants
- * 4) if it is a fragment from a bigger MME
- * - update the MME context
- * - copy the payload in 512 byte blocs
- * 5) if the message is completed, call the msg_dispatch function
- */
-mme_rx_t *
-cp_cl_interf_give_last_mme(cp_t *ctx);
-
-
-/**
- * return the Tx MME buffer.
- *
- * \param ctx the cp context
- * \return mme_rx_t the mme context
- *
- * !!! This function must be thread-safe !!!
- * If the Tx buffer is available, return it.
- * else, wait for it.
- * It can be called either from CP or CE thread, and the Tx buffer is given
- * from the CL environnement.
- */
-mme_tx_t *
-cp_cl_interf_give_tx_buffer(cp_t *ctx);
-
-/**
- * will send the MME buffer to the DP.
- *
- * \param ctx the cp context
- * \param mme the mme to send and it context
- *
- * Must retreive the MFS and send the message through this MFS.
- * if necessary, will pad the message to the minimum MME size
- */
-void
-cp_cl_interf_mme_send(cp_t *ctx, mme_tx_t *mme);
-
-/**
- * callback used by the CL to give back the Tx buffer.
- *
- * \param ctx the cp context
- * \param buffer the buffer
- *
- * * !!! this function is executed in the CL context
- */
-void
-cp_cl_interf_receive_tx_buffer(cp_t *ctx, char * buffer);
-
-/**
- * this function will remove expired block of fragmented mme.
- *
- * \param ctx the cp context
- *
- * it is called periodicly, and will check all the currently stored MME
- * fragments. If necessary, release it.
- */
-void
-cp_cl_interf_garbage_collector(cp_t *ctx);
-
-
-END_DECLS
-
-#endif \ No newline at end of file
diff --git a/cp2/cl_interf/inc/cl_interf_defs.h b/cp2/cl_interf/inc/cl_interf_defs.h
deleted file mode 100644
index d4265ffee3..0000000000
--- a/cp2/cl_interf/inc/cl_interf_defs.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef CL_INTERF_DEFS_H_
-#define CL_INTERF_DEFS_H_
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file Cesare/cp/cl_interf/inc/cl_interf_defs.h
- * \brief definition of the cl_interf module
- * \ingroup cp/cl_interf
- *
- */
-
-
-#endif /*CL_INTERF_DEFS_H_*/
diff --git a/cp2/defs.h b/cp2/defs.h
deleted file mode 100644
index 48ed1193fa..0000000000
--- a/cp2/defs.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef cp2_defs_h
-#define cp2_defs_h
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp2/defs.h
- * \brief Definition for the Contol Plane.
- * \ingroup cp2
- *
- */
-
-/** min size of NPW password. */
-#define MIN_NPW_SIZE 8 // bytes
-#define MAX_NPW_SIZE 64 // bytes
-
-/** max size of hfid (human-friendly identifier). */
-#define HFID_SIZE 64 // bytes
-
-/** NMK size. */
-#define NMK_SIZE 16 // 16 bytes
-
-/** Devince password length. */
-#define MIN_DPW_SIZE 16 // bytes
-#define MAX_DPW_SIZE 64 // bytes
-
-#endif /* cp2_defs_h */
diff --git a/cp2/mme.h b/cp2/mme.h
deleted file mode 100644
index 47f4573f40..0000000000
--- a/cp2/mme.h
+++ /dev/null
@@ -1,229 +0,0 @@
-#ifndef MME_H_
-#define MME_H_
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file Cesare/cp/mme.h
- * \brief definition of the mme types
- * \ingroup cp/
- *
- */
-
-
-
-// MMTYPE base-values for DRV-MME messages
-#define DRV_STA_SET_MAC_ADDR 0xA000
-#define DRV_STA_SET_CCO_PREF 0xA004
-#define DRV_STA_SET_WAS_CCO 0xA008
-#define DRV_STA_SET_NPW 0xA00C
-#define DRV_STA_SET_DPW 0xA010
-#define DRV_STA_SET_SL 0xA014
-#define DRV_STA_SET_M_STA_HFID 0xA018
-#define DRV_STA_SET_U_STA_HFID 0xA01C
-#define DRV_STA_SET_AVLN_HFID 0xA020
-#define DRV_STA_SET_TONEMASK 0xA024
-#define DRV_STA_START 0xA028
-#define DRV_STA_STOP 0xA02C
-
-// MMTYPE sub-values for MMEs (REQ, CNF, IND or RSP)
-#define REQ 0x00
-#define CNF 0x01
-#define IND 0x02
-#define RSP 0x03
-/*
- * mm type constants
- * take care of the following :
- * according to Intellon technical reference manual of Homeplug AV firmware p9,
- * the two LSB value of messages should be :
- * 0b00 for REQ
- * 0b01 for CNF
- * 0b10 for IND
- * 0b11 for RSP
- * this is very unclear in the Homeplug AV specification v1.0.10
- */
-typedef enum cp_mmtype_t
-{
- CC_CCO_APPOINT_REQ = 0x0000,
- CC_CCO_APPOINT_CNF = 0x0001,
- CC_BACKUP_APPOINT_REQ = 0x0004,
- CC_BACKUP_APPOINT_CNF = 0x0005,
- CC_LINK_INFO_REQ = 0x0008,
- CC_LINK_INFO_CNF = 0x0009,
- CC_LINK_INFO_IND = 0x000A,
- CC_LINK_INFO_RSP = 0x000B,
- CC_HANDOVER_REQ = 0x000C,
- CC_HANDOVER_CNF = 0x000D,
- CC_HANDOVER_INFO_IND = 0x0012,
- CC_HANDOVER_INFO_RSP = 0x0013,
- CC_DISCOVER_LIST_REQ = 0x0014,
- CC_DISCOVER_LIST_CNF = 0x0015,
- CC_DISCOVER_LIST_IND = 0x0016,
- CC_LINK_NEW_REQ = 0x0018,
- CC_LINK_NEW_CNF = 0x0019,
- CC_LINK_MOD_REQ = 0x001C,
- CC_LINK_MOD_CNF = 0x001D,
- CC_LINK_SQZ_REQ = 0x0020,
- CC_LINK_SQZ_CNF = 0x0021,
- CC_LINK_REL_REQ = 0x0024,
- CC_LINK_REL_IND = 0x0025,
- CC_DETECT_REPORT_REQ = 0x0028,
- CC_DETECT_REPORT_CNF = 0x0029,
- CC_WHO_RU_REQ = 0x002C,
- CC_WHO_RU_CNF = 0x002D,
- CC_ASSOC_REQ = 0x0030,
- CC_ASSOC_CNF = 0x0031,
- CC_LEAVE_REQ = 0x0034,
- CC_LEAVE_CNF = 0x0035,
- CC_LEAVE_IND = 0x0036,
- CC_LEAVE_RSP = 0x0037,
- CC_SET_TEI_MAP_REQ = 0x0038,
- CC_SET_TEI_MAP_IND = 0x0039,
- CC_RELAY_REQ = 0x003C,
- CC_RELAY_IND = 0x003D,
- CC_BEACON_RELIABILITY_REQ = 0x0040,
- CC_BEACON_RELIABILITY_CNF = 0x0041,
- CC_ALLOC_MOVE_REQ = 0x0044,
- CC_ALLOC_MOVE_CNF = 0x0045,
- CC_ACCESS_NEW_REQ = 0x0048,
- CC_ACCESS_NEW_CNF = 0x0049,
- CC_ACCESS_NEW_IND = 0x004A,
- CC_ACCESS_NEW_RSP = 0x004B,
- CC_ACCESS_REL_REQ = 0x004C,
- CC_ACCESS_REL_CNF = 0x004D,
- CC_ACCESS_REL_IND = 0x004E,
- CC_ACCESS_REL_RSP = 0x004F,
- CC_DCPPC_IND = 0x0052,
- CC_DCPPC_RSP = 0x0053,
- CC_HP1_DET_REQ = 0x0054,
- CC_HP1_DET_CNF = 0x0055,
- CC_BLE_UPDATE_IND = 0x005A,
-
- CP_PROXY_APPOINT_REQ = 0x2000,
- CP_PROXY_APPOINT_CNF = 0x2001,
- PH_PROXY_APPOINT_IND = 0x2006,
- CP_PROXY_WAKE_REQ = 0x2008,
-
- NN_INL_REQ = 0x4000,
- NN_INL_CNF = 0x4001,
- NN_NEW_REQ = 0x4004,
- NN_NEW_CNF = 0x4005,
- NN_NEW_IND = 0x4006,
- NN_ADD_ALLOC_REQ = 0x4008,
- NN_ADD_ALLOC_CNF = 0x4009,
- NN_ADD_ALLOC_IND = 0x400A,
- NN_REL_ALLOC_REQ = 0x400C,
- NN_REL_ALLOC_CNF = 0x400D,
- NN_REL_NET_IND = 0x4012,
-
- CM_UNASSOCIATED_STA_IND = 0x6002,
- CM_ENCRYPTED_PAYLOAD_IND = 0x6006,
- CM_ENCRYPTED_PAYLOAD_RSP = 0x6007,
- CM_SET_KEY_REQ = 0x6008,
- CM_SET_KEY_CNF = 0x6009,
- CM_GET_KEY_REQ = 0x600C,
- CM_GET_KEY_CNF = 0x600D,
- CM_SC_JOIN_REQ = 0x6010,
- CM_SC_JOIN_CNF = 0x6011,
- CM_CHAN_EST_IND = 0x6016,
- CM_TM_UPDATE_IND = 0x601A,
- CM_AMP_MAP_REQ = 0x601C,
- CM_AMP_MAP_CNF = 0x601D,
- CM_BRG_INFO_REQ = 0x6020,
- CM_BRG_INFO_CNF = 0x6021,
- CM_CONN_NEW_REQ = 0x6024,
- CM_CONN_NEW_CNF = 0x6025,
- CM_CONN_REL_IND = 0x602A,
- CM_CONN_REL_RSP = 0x602B,
- CM_CONN_MOD_REQ = 0x602C,
- CM_CONN_MOD_CNF = 0x602D,
- CM_CONN_INFO_REQ = 0x6030,
- CM_CONN_INFO_CNF = 0x6031,
- CM_STA_CAP_REQ = 0x6034,
- CM_STA_CAP_CNF = 0x6035,
- CM_NW_INFO_REQ = 0x6038,
- CM_NW_INFO_CNF = 0x6039,
- CM_GET_BEACON_REQ = 0x603C,
- CM_GET_BEACON_CNF = 0x603D,
- CM_HFID_REQ = 0x6040,
- CM_HFID_CNF = 0x6041,
- CM_MME_ERROR_IND = 0x6046,
- CM_NW_STATS_REQ = 0x6048,
- CM_NW_STATS_CNF = 0x6049,
- CM_LINK_STATS_REQ = 0x604C,
- CM_LINK_STATS_CNF = 0x604D,
-
- DRV_STA_SET_MAC_ADDR_REQ = DRV_STA_SET_MAC_ADDR + REQ,
- DRV_STA_SET_MAC_ADDR_CNF = DRV_STA_SET_MAC_ADDR + CNF,
- DRV_STA_SET_CCO_PREF_REQ = DRV_STA_SET_CCO_PREF + REQ,
- DRV_STA_SET_CCO_PREF_CNF = DRV_STA_SET_CCO_PREF + CNF,
- DRV_STA_SET_WAS_CCO_REQ = DRV_STA_SET_WAS_CCO + REQ,
- DRV_STA_SET_WAS_CCO_CNF = DRV_STA_SET_WAS_CCO + CNF,
- DRV_STA_SET_WAS_CCO_IND = DRV_STA_SET_WAS_CCO + IND,
- DRV_STA_SET_WAS_CCO_RSP = DRV_STA_SET_WAS_CCO + RSP,
- DRV_STA_SET_NPW_REQ = DRV_STA_SET_NPW + REQ,
- DRV_STA_SET_NPW_CNF = DRV_STA_SET_NPW + CNF,
- DRV_STA_SET_DPW_REQ = DRV_STA_SET_DPW + REQ,
- DRV_STA_SET_DPW_CNF = DRV_STA_SET_DPW + CNF,
- DRV_STA_SET_SL_REQ = DRV_STA_SET_SL + REQ,
- DRV_STA_SET_SL_CNF = DRV_STA_SET_SL + CNF,
- DRV_STA_SET_M_STA_HFID_REQ = DRV_STA_SET_M_STA_HFID + REQ,
- DRV_STA_SET_M_STA_HFID_CNF = DRV_STA_SET_M_STA_HFID + CNF,
- DRV_STA_SET_U_STA_HFID_REQ = DRV_STA_SET_U_STA_HFID + REQ,
- DRV_STA_SET_U_STA_HFID_CNF = DRV_STA_SET_U_STA_HFID + CNF,
- DRV_STA_SET_AVLN_HFID_REQ = DRV_STA_SET_AVLN_HFID + REQ,
- DRV_STA_SET_AVLN_HFID_CNF = DRV_STA_SET_AVLN_HFID + CNF,
- DRV_STA_SET_TONEMASK_REQ = DRV_STA_SET_TONEMASK + REQ,
- DRV_STA_SET_TONEMASK_CNF = DRV_STA_SET_TONEMASK + CNF,
- DRV_STA_START_REQ = DRV_STA_START + REQ,
- DRV_STA_START_CNF = DRV_STA_START + CNF,
- DRV_STA_STOP_REQ = DRV_STA_STOP + REQ,
- DRV_STA_STOP_CNF = DRV_STA_STOP + CNF,
-
- TEST_MSG_NUM,
- MSG_UNKNOW = 0xFFFF
-} cp_mmtype_t;
-
-
-typedef struct cp_mme_header_t // Table 11-178
-{
- mac_address_t oda; // original destination adress
- mac_address_t osa; // original source adress
- u32 v_lan_tag; // ieee 802.1 tag (optional)
- u16 m_type; // const = 0x88E1
- u8 mmv; // management message version
- cp_mmtype_t mmtype; // management message type
- u8 nf_mi; // Number of fragments for message
- u8 fn_mi; // fragment number
- u8 fmsn; // fragmentation message sequence number
-} cp_mme_header_t;
-
-
-typedef struct cp_mme_rx_t
-{
- char *p_mme; // pointer to the received MME
- blk_t *p_frag; // pointer to the mme's fragments
- uint length; // size of the mme (including header)
- mfs_t mfs; // pointer to the rx mfs
- tei_t s_tei; // source tei
- cp_mme_header_t header; // readen header
- // todo : add bitstream context
-} cp_mme_rx_t;
-
-typedef struct cp_mme_tx_t
-{
- char *p_mme; // pointer to the Tx buffer
- uint length; // size of the mme (including header)
- mfs_t mfs; // pointer to the rx mfs
- tei_t d_tei; // destination tei
- bool relay; // true if the message is encapsulated in cc_relay
- cp_mme_header_t header; // readen header
- // todo : add bitstream context
-} cp_mme_tx_t;
-
-
-#endif /*MME_H_*/
diff --git a/cp2/msg/inc/msg_cc.h b/cp2/msg/inc/msg_cc.h
deleted file mode 100644
index 6d3a0e417d..0000000000
--- a/cp2/msg/inc/msg_cc.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef MSG_CC_H_
-#define MSG_CC_H_
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file Cesare/cp/msg/inc/msg_cc.h
- * \brief creation and decoding of cc prefixed MMEs
- * \ingroup cp/msg
- *
- * « long description »
- */
-
-
-
-BEGIN_DECLS
-
-void cp_msg_cc_who_ru_req_send (cp_t *ctx);
-void cp_msg_cc_who_ru_req_receive(cp_t *ctx, mme_rx_t *mme);
-
-void cp_msg_cc_who_ru_cnf_send (cp_t *ctx);
-void cp_msg_cc_who_ru_cnf_receive(cp_t *ctx, mme_rx_t *mme);
-
-void cp_msg_cc_assoc_req_send (cp_t *ctx);
-void cp_msg_cc_assoc_req_receive(cp_t *ctx, mme_rx_t *mme);
-
-void cp_msg_cc_assoc_cnf_send (cp_t *ctx);
-void cp_msg_cc_assoc_cnf_receive(cp_t *ctx, mme_rx_t *mme);
-
-void cp_msg_cc_leave_req_send (cp_t *ctx);
-void cp_msg_cc_leave_req_receive(cp_t *ctx, mme_rx_t *mme);
-
-void cp_msg_cc_leave_cnf_send (cp_t *ctx);
-void cp_msg_cc_leave_cnf_receive(cp_t *ctx, mme_rx_t *mme);
-
-void cp_msg_cc_leave_ind_send (cp_t *ctx);
-void cp_msg_cc_leave_ind_receive(cp_t *ctx, mme_rx_t *mme);
-
-void cp_msg_cc_set_tei_map_ind_send (cp_t *ctx);
-void cp_msg_cc_set_tei_map_ind_receive (cp_t *ctx, mme_rx_t *mme);
-
-void cp_msg_cc_relay_req_send (cp_t *ctx);
-void cp_msg_cc_relay_req_receive (cp_t *ctx, mme_rx_t *mme);
-
-void cp_msg_cc_relay_ind_send (cp_t *ctx);
-void cp_msg_cc_relay_ind_receive (cp_t *ctx, mme_rx_t *mme);
-
-#endif /*MSG_CC_H_*/
diff --git a/cp2/msg/inc/msg_cm.h b/cp2/msg/inc/msg_cm.h
deleted file mode 100644
index 5bcc9e4f41..0000000000
--- a/cp2/msg/inc/msg_cm.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef MSG_CM_H_
-#define MSG_CM_H_
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file Cesare/cp/msg/inc/msg_cm.h
- * \brief creation and decoding of cm prefixed MMEs
- * \ingroup cp/msg
- *
- * « long description »
- */
-
-
-
-BEGIN_DECLS
-
-void cp_msg_cm_unassociated_sta_ind_send (cp_t *ctx);
-void cp_msg_cm_unassociated_sta_ind_receive (cp_t *ctx, mme_rx_t *mme);
-
-void cp_msg_cm_encrypted_payload_ind_send (cp_t *ctx);
-void cp_msg_cm_encrypted_payload_ind_receive (cp_t *ctx, mme_rx_t *mme);
-
-void cp_msg_cm_set_key_req_send (cp_t *ctx);
-void cp_msg_cm_set_key_req_receive (cp_t *ctx, mme_rx_t *mme);
-
-void cp_msg_cm_set_key_cnf_send (cp_t *ctx);
-void cp_msg_cm_set_key_cnf_receive (cp_t *ctx, mme_rx_t *mme);
-
-
-void cp_msg_cm_get_key_req_send (cp_t *ctx);
-void cp_msg_cm_get_key_req_receive (cp_t *ctx, mme_rx_t *mme);
-
-void cp_msg_cm_get_key_cnf_send (cp_t *ctx);
-void cp_msg_cm_get_key_cnf_receive (cp_t *ctx, mme_rx_t *mme);
-
-void cp_msg_cm_mme_error_ind_send (cp_t *ctx);
-void cp_msg_cm_mme_error_ind_receive (cp_t *ctx, mme_rx_t *mme);
-
-#endif /*MSG_CM_H_*/
diff --git a/cp2/msg/msg.h b/cp2/msg/msg.h
deleted file mode 100644
index e222968b22..0000000000
--- a/cp2/msg/msg.h
+++ /dev/null
@@ -1,105 +0,0 @@
-#ifndef msg__h__
-#define msg__h__
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file Cesare/cp/msg/msg.h
- * \brief mme creation and decoding
- * \ingroup cp/msg
- *
- * This module contain all the function related to the interpretation and
- * creation of MME messages.
- * These functions are grouped with messages prefix.
- */
-
-#include "inc/msg_cc.h"
-#include "inc/msg_cm.h"
-#include "../mme.h"
-
-BEGIN_DECLS
-
-
-/**
- * initialisation of cp_msg module.
- *
- * \param ctx the cp context
- *
- */
-void
-cp_msg_init(cp_t *ctx);
-
-
-/**
- * lookup the message number.
- *
- * \param ctx the cp context
- * \param mme is the message to lookup
- *
- * 1) lookup the visual state event from the mmtype
- * 2) check that the encryption level is compliant with the mme type and the
- * station status
- * 3) send the event in the visual state fsm
- */
-void
-cp_msg_dispatch(cp_t *ctx, cp_mme_rx_t *mme);
-
-
-/**
- * initialize the buffer for a new message.
- *
- * \param ctx the cp context
- * \param d_tei destination tei of the MME
- * \return context of the mme (with the header, pointer to the buffer etc)
- *
- * 1) will get a buffer for mme transmition,
- * 2) if the mme is encapsulated in cc_relay, then préformat the cc_relay header
- * 3) preformat the mme header
- *
- */
-cp_mme_tx_t *
-cp_msg_init_mme (cp_t *ctx, tei_t d_tei);
-
-/**
- * initialize the buffer for an encrypted message.
- *
- * \param ctx the cp context
- * \param d_tei
- * \param pid protocol id
- * \param peks encryption key
- * \return context of the mme (with the header, pointer to the buffer etc)
- *
- * same as cp_msg_init, but add : 2b
- * 1) will get a buffer for mme transmition,
- * 2) if the mme is encapsulated in cc_relay, then preformat the cc_relay header
- * 2b) preformat the encrypted header
- * 3) preformat the mme header
- *
- */
-cp_mme_tx_t *
-cp_msg_init_encrypted_mme (cp_t *ctx, tei_t d_tei, pid, peks);
-
-/**
- * send the message through the cp_cl_interf api.
- *
- * \param ctx the cp context
- * \param mme_tx context of the mme (with the header, pointer to the buffer etc)
- *
- * if requested, complete the mme encapsulation
- * if requested, complete the header
- * send the messsage through cp_cl_interf
- * free the mme_tx context
- *
- */
-void
-cp_msg_mme_send (cp_t *ctx, cp_mme_tx_t *mme_tx);
-
-
-
-END_DECLS
-
-#endif \ No newline at end of file
diff --git a/cp2/secu/secu.h b/cp2/secu/secu.h
deleted file mode 100644
index 8ee67c700f..0000000000
--- a/cp2/secu/secu.h
+++ /dev/null
@@ -1,160 +0,0 @@
-#ifndef secu__h__
-#define secu__h__
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file Cesare/cp/secu/secu.h
- * \brief library of security related functions (crypto, ...)
- * \ingroup cp/secu
- *
- * « long description »
- */
-
-struct cp_secu_ctx_t
-
-
-BEGIN_DECLS
-
-/**
- * start a new protocol run.
- *
- * \param PID PID of the futur protocol run
- * \param p_run context of the current protocol run
- */
-void
-cp_secu_start_new_protocol_run(const cp_pid_t pid, protocol_run_t *p_run);
-
-/**
- * Check parameters of received protocol run.
- *
- * \param p_run security context of the current protocol run
- * \param pid pid to compare with the current protocol run
- * \param prn Protocol Run Number to check
- * \param pmn Protocol Message Number to check
- * \param nonce nonce to check
- *
- * \return error code or 0 if success
- */
-E_ErrCode
-cp_secu_check_protocol_run_param (
- const protocol_run_t p_run,
- const cp_pid_t pid,
- const s16 prn, // Protocol Run Number
- const u8 pmn, // Protocol Message Number
- const s32 nonce
- );
-
-/**
- * generate parameters for the protocol run.
- *
- * \param p_run security context of the current protocol run
- * \param pid pid to use for this protocol run
- * \param prn Protocol Run Number to use
- * \param pmn Protocol Message Number to use
- * \param nonce nonce to use
- *
- * \return error code or 0 if success
- */
-E_ErrCode
-secu_gen_protocol_run_param (protocol_run_t *p_run, cp_pid_t *pid, s16 *prn, u8 *pmn, s32 *nonce);
-
-
-/**
- * AES-CBC buffer encryption.
- *
- * \param ctx AES context
- * \param iv initialization vector (modified after use) (16 bytes)
- * \param input buffer holding the plaintext
- * \param output buffer holding the ciphertext
- * \param len length of the data to be encrypted
- */
-void
-cp_secu_aes_cbc_encrypt (aes_context *ctx, unsigned char iv[16], unsigned char *input, unsigned char *output, int len);
-/**
- * AES-CBC buffer decryption.
- *
- * \param ctx AES context
- * \param iv initialization vector (modified after use)
- * \param input buffer holding the ciphertext
- * \param output buffer holding the plaintext
- * \param len length of the data to be decrypted
- */
-void
-cp_secu_aes_cbc_decrypt (aes_context *ctx, unsigned char iv[16], unsigned char *input, unsigned char *output, int len);
-
-/**
- * set AES key.
- *
- * \param ctx AES context to be initialized
- * \param key the secret key
- * \param keysize must be 128, 192 or 256 bits long
- */
-void
-cp_secu_aes_set_key (aes_context *ctx, unsigned char *key, int keysize);
-
-/**
- * Output = SHA-256( input buffer ).
- *
- * \param input buffer holding the data
- * \param ilen length of the input data
- * \param output SHA-224/256 checksum result size is SHA256OutputSize bytes
- * \param is224 0 = use SHA256, 1 = use SHA224
- */
-void
-cp_secu_sha2 (unsigned char *input, int ilen, unsigned char *output, int is224);
-
-/**
- * pbkdf1 function
- * \param input the input data to hash (can be a clear ascii password)
- * \param input_len length of input
- * \param salt salt to apply to input data
- * \param salt_len length of salt
- * \param it_count iteration number for the hash function
- * \param output_key result of hash
- * \return error code or 0 if success
- */
-E_ErrCode
-cp_secu_pbkdf1 (u8 input[], int input_len, u8 salt[], int salt_len, int it_count, u8 output_key[]);
-
-
-/**
- * generate AES key (NEK, NMK or TEK).
- * \param
- * \return error code or 0 if success
- *
- * see 7.10.7.2 for details
- */
-void
-cp_secu_gen_aes_key(void);
-
-/*
- * Hash a 128 bits NMK key to generate a 54 bits NID.
- * conforming to the security level specified.
- * \param nmk, the NMK buffer pointer (input)
- * \param security_level, the station security-level
- * \param nid, the NID buffer pointer (output)
- * \return E_ErrCode, return code (0 if success)
- */
-E_ErrCode
-cp_secu_nmk2nid(u8 *nmk, u8 security_level, u8 *nid);
-
-/*
- * Hash a NPW password (1 to 64 chars in the 0x20-0x7F standard ASCII interval)
- * to generate a 16 octets (128 bits) NMK key.
- * \param npw,the NPW buffer pointer (input)
- * \param nmk, the NMK buffer pointer (output)
- * \return E_ErrCode, return code (0 if success)
- */
-E_ErrCode
-cp_secu_npw2nmk(char *npw, u8 *nmk);
-
-
-
-END_DECLS
-
-#endif \ No newline at end of file
diff --git a/cp2/sta/action/action.h b/cp2/sta/action/action.h
deleted file mode 100644
index 6182b65964..0000000000
--- a/cp2/sta/action/action.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef cp_sta_action_action_h
-#define cp_sta_action_action_h
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp/sta/action/action.h
- * \brief STA action.
- * \ingroup cp_sta
- *
- * This module implements actions defined in the FSM and actions corresponding
- * to MME reception.
- */
-#include "cp/sta/action/assoc.h"
-#include "cp/sta/action/key.h"
-#include "cp/sta/action/misc.h"
-
-BEGIN_DECLS
-
-/**
- * Process a CM_UNASSOCIATED_STA.IND, 11.5.1.
- * \param ctx control plane context
- * \param mme received MME handle
- * \param nid NID the STA try to associate with
- * \param cco_cap CCo capabilities of the sending STA
- *
- * Update the STA list and if should become CCo, post an event to do so.
- *
- * Need:
- * - our NID
- *
- * Update:
- * - STA mgr.
- */
-void
-cp_sta_action_process_cm_unassociated_sta_ind (cp_t *ctx, cp_mme_t *mme,
- cp_nid_t nid,
- cp_cco_cap_t cco_cap);
-
-END_DECLS
-
-#endif /* cp_sta_action_action_h */
diff --git a/cp2/sta/action/assoc.h b/cp2/sta/action/assoc.h
deleted file mode 100644
index 2e8a872133..0000000000
--- a/cp2/sta/action/assoc.h
+++ /dev/null
@@ -1,190 +0,0 @@
-#ifndef cp_sta_action_assoc_h
-#define cp_sta_action_assoc_h
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp/sta/action/assoc.h
- * \brief STA action, association related definitions.
- * \ingroup cp_sta
- *
- * Association/disassociation
- * ==========================
- *
- * This part relates to association and disassociation for a STA. A state
- * machine is used to handle the association status of the station:
- *
- * \image html assoc.png "Association state machine"
- *
- * - (1) send CC_ASSOC.REQ
- * - (2) send CM_GET_KEY.REQ
- * - (3) send CC_ASSOC.REQ for renewal
- * - (4) send CM_SET_KEY.CNF
- * - (5) send CC_LEAVE.REQ
- * - (6) send CC_LEAVE.RSP
- * - (7) cleanup data plane
- *
- * For the moment, only one association scheme is supported: association with
- * matching NID, without proxy network.
- *
- * Related: 7.3.2, 7.3.3, 7.3.4.1, 7.3.5.1, 7.3.6.
- *
- *
- * Association
- * -----------
- *
- * When the station wants to associate, it set the association parameters and
- * trigger the "to assoc" event. This will send the CC_ASSOC.REQ message to
- * the CCo and wait for response.
- *
- * If no response is received, retry. Retry is needed because we are not
- * associated and broadcast is used.
- *
- * If a negative response is received, association has failed, this is
- * remembered in order not to try to associate too often to the same CCo.
- *
- * If a positive response is received, go to associated state.
- *
- *
- * Authentication
- * --------------
- *
- * When entering this state, send a payload encrypted CM_GET_KEY.REQ to
- * request the NEK.
- *
- * Once the station is authenticated, CC_SET_TEI_MAP.IND messages can be
- * received.
- *
- * As unicast transmissions are used, a timeout will directly break the
- * association sequence.
- *
- * If a negative response is received, association has failed, the CCo is
- * using a different NMK. This is remembered in order not to associate with
- * this CCo again (until keys are changed).
- *
- * If a positive response is received, the station is authenticated.
- *
- * Once authenticated, the CCo can change the NEK periodically.
- *
- * Lease renewal
- * -------------
- *
- * Association is granted for a given time. When the station is associated,
- * program a timer to renew the association. When this timer expires, send a
- * CC_ASSOC.REQ for renewal and set the timer for a second chance.
- *
- * The station will not leave the AVLN by itself due to lease expiration. It
- * will wait an eventual CC_LEAVE.IND message to do so.
- *
- * When the CCo confirms the renewal, the renew timer is reset to the value
- * given in its confirmation message. Ignore renewal failure, will wait for
- * the CC_LEAVE.IND message.
- *
- *
- * Leaving
- * -------
- *
- * If the request comes from the sta, trigger the "leave" event. This will
- * send the CC_LEAVE.REQ message to the CCo and wait for response. If no
- * response cames for three beacon periods, resend and go to the "leave wait"
- * state.
- *
- * If the request comes from the CCo (CC_LEAVE.IND), send a response and go to
- * the "leave wait" state.
- *
- * The "leave wait" state is there to give time to the data plane to send the
- * MME. After a fixed timer, go back to unassociated state and cleanup the
- * data plane from all AVLN related parameters.
- */
-
-BEGIN_DECLS
-
-/**
- * Start a association procedure.
- * \param ctx control plane context
- * \param cco CCo to associate with
- *
- * Send a CC_ASSOC.REQ to the CCo and trigger TO_ASSOC event.
- *
- * Need:
- * - CCo to associate to (MAC, TEI, NID).
- * - our CCo cap and proxy network cap.
- */
-void
-cp_sta_action_assoc_start (cp_t *ctx, cp_sta_t *cco);
-
-/**
- * Process a CC_ASSOC.CNF, 11.2.29.
- * \param ctx control plane context
- * \param mme received MME handle
- * \param result association result
- * \param nid NID of the sender network
- * \param snid SNID of the sender network
- * \param tei new TEI to use, valid if association is successful
- * \param lease_time_min period of time of TEI validity
- *
- * Confirmation from the CCo on association request. If this does not
- * correspond to a previously sent request, drop.
- *
- * If we were associating and if the CCo accepted our association, update
- * association information, send the CC_GET_KEY.REQ, and post a TO_SUCCESS
- * event. If the CCo refused, post a TO_FAILURE and update the CCo
- * information to remember the failure.
- *
- * If we were renewing, just update the lease time.
- *
- * Need:
- * - whether a association is pending and its characteristics.
- *
- * Update:
- * - our TEI.
- * - our TEI lease time (update lease timer).
- * - our AVLN.
- * - our AVLN SNID.
- * - CCo failure info.
- */
-void
-cp_sta_action_process_cc_assoc_cnf (cp_t *ctx, cp_mme_t *mme,
- cp_msg_cc_assoc_cnf_result_t result,
- cp_nid_t nid, cp_snid_t snid,
- cp_tei_t tei, uint lease_time_min);
-
-/**
- * Process a CC_LEAVE.CNF, 11.2.31.
- * \param ctx control plane context
- * \param mme received MME handle
- *
- * Confirmation from the CCo on leave request. If this does not correspond to
- * a previously sent request, drop. Else, post an event to leave the AVLN.
- *
- * Need:
- * - whether a leave is pending and its characteristics.
- */
-void
-cp_sta_action_process_cc_leave_cnf (cp_t *ctx, cp_mme_t *mme);
-
-/**
- * Process a CC_LEAVE.IND, 11.2.32.
- * \param ctx control plane context
- * \param mme received MME handle
- * \param reason reason for the disassociation
- * \param nid NID
- *
- * The CCo ask us to leave the AVLN. Send a CC_LEAVE.RSP, and post an event
- * to leave the AVLN.
- *
- * Need:
- * - our AVLN NID (to check message).
- */
-void
-cp_sta_action_process_cc_leave_ind (cp_t *ctx, cp_mme_t *mme,
- cp_msg_cc_leave_ind_reason_t reason,
- nid_t nid);
-
-END_DECLS
-
-#endif /* cp_sta_action_assoc_h */
diff --git a/cp2/sta/action/doc/Makefile b/cp2/sta/action/doc/Makefile
deleted file mode 100644
index 44acd4bd16..0000000000
--- a/cp2/sta/action/doc/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-PAGES = assoc key misc
-GRAPHS = assoc
-
-DOTFLAGS = -Gbgcolor='\#f7f7f7' -Nfillcolor=white
-CONVERTFLAGS = -border 1 -bordercolor '\#d7d7d7'
-
-TOOLS_DIR = ../../../../common/tools
-DOC_DIR = ../../../../common/doc
-SDL2DOT = $(TOOLS_DIR)/sdl2dot
-SDLPS = $(TOOLS_DIR)/sdl.ps
-EXTRACT_DOC = $(DOC_DIR)/extractdoc
-DOX2RST = $(DOC_DIR)/dox2rst
-
-all: png rst
-
-png: $(GRAPHS:%=%.png)
-ps: $(GRAPHS:%=%.ps)
-
-%.png: %.ps
- convert $(CONVERTFLAGS) $< $@
-
-%.ps: %.dot Makefile
- dot $(DOTFLAGS) -Tps -l $(SDLPS) -o $@ $<
-
-%.dot: %.sdl
- $(SDL2DOT) $< > $@
-
-rst: top.rst
-html: png top.html
-odt: top.odt
-
-top.rst: $(PAGES:%=%.rst)
- cat $^ > $@
-
-%.rst: ../%.h
- $(EXTRACT_DOC) $< | $(DOX2RST) > $@
-
-%.html: %.rst
- rst2html $< $@
-
-%.odt: %.rst
- rst2odt.py $< $@
-
-clean:
- rm -f $(GRAPHS:%=%.ps) $(GRAPHS:%=%.png)
- rm -f $(PAGES:%=%.rst) $(PAGES:%=%.html)
- rm -f top.rst top.html top.odt
diff --git a/cp2/sta/action/doc/assoc.sdl b/cp2/sta/action/doc/assoc.sdl
deleted file mode 100644
index 62da4a08c3..0000000000
--- a/cp2/sta/action/doc/assoc.sdl
+++ /dev/null
@@ -1,21 +0,0 @@
-(unassociated) -to assoc(1)-> (wait assoc cnf)
-
-(wait assoc cnf) -CC_ASSOC.CNF-> <w:ok?> -y(2)-> (associated)
- <w:ok?> -n-> (unassociated)
-(wait assoc cnf) -timeout-> <retry?> -y(1)-> (wait assoc cnf)
- <retry?> -n-> (unassociated)
-
-(associated) -CM_GET_KEY.CNF-> <a:ok?> -y-> (authenticated)
- <a:ok?> -n-> (unassociated)
-(associated) -timeout-> (unassociated)
-
-(authenticated) -renew(3)-> (authenticated)
-(authenticated) -CC_ASSOC.CNF-> (authenticated)
-(authenticated) -CM_SET_KEY.REQ(4)-> (authenticated)
-(authenticated) -leave(5)-> (leaving)
-(authenticated) -CC_LEAVE.IND(6)-> (leave wait)
-
-(leaving) -CC_LEAVE.CNF(7)-> (unassociated)
-(leaving) -timeout(5) (3pb)-> (leave wait)
-
-(leave wait) -timeout(7)-> (unassociated)
diff --git a/cp2/sta/action/doc/cp_sta_action.odt b/cp2/sta/action/doc/cp_sta_action.odt
deleted file mode 100644
index 68dc798f8b..0000000000
--- a/cp2/sta/action/doc/cp_sta_action.odt
+++ /dev/null
Binary files differ
diff --git a/cp2/sta/action/key.h b/cp2/sta/action/key.h
deleted file mode 100644
index d55fc824b5..0000000000
--- a/cp2/sta/action/key.h
+++ /dev/null
@@ -1,165 +0,0 @@
-#ifndef cp_sta_action_key_h
-#define cp_sta_action_key_h
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp/sta/action/key.h
- * \brief STA action, key exchange messages.
- * \ingroup cp_sta
- *
- * Key exchanges
- * =============
- *
- * This part handle key exchange messages. As theses messages are used for
- * many unrelated protocol, theses functions will only handle generic
- * verifications and will then forward the message to the right recipient.
- */
-
-BEGIN_DECLS
-
-/**
- * Process a CM_SET_KEY.REQ, 11.5.4.
- * \param ctx control plane context
- * \param mme received MME handle
- * \param key_type key type being set
- * \param my_nounce to be used in next message
- * \param your_nounce used in previous message
- * \param pid protocol identifier
- * \param prn protocol run number
- * \param pmn protocol message number
- * \param cco_cap CCo capabilities of the sending STA
- * \param nid NID of the sender network, associated with the NMK
- * \param new_eks EKS of the key being set
- * \param new_key new key, or NULL if none.
- *
- * This message is used in several protocols. First check that this message
- * is legitimate, then depending of the protocol, call the corresponding
- * function.
- *
- * Used to:
- * - from STA to STA:
- * - NMK provisioning using DAK (PID=2):
- * - set TEK, DAK encrypted (not handled): used to start the protocol
- * - set NMK, DAK encrypted (not handled)
- * - NMK provisioning using UKE (PID=3):
- * - set NMK, TEK encrypted (not handled)
- * - from CCo to STA:
- * - set NEK (PID=1), done periodically by the CCo
- * - from HLE to STA:
- * - set NMK (not handled)
- */
-void
-cp_sta_action_process_cm_set_key_req (cp_t *ctx, cp_mme_t *mme,
- cp_key_type_t key_type,
- u32 my_nounce, u32 your_nounce,
- cp_pid_t pid,
- u16 prn, u8 pmn,
- cp_cco_cap_t cco_cap,
- cp_nid_t nid,
- u8 new_eks,
- cp_key_t *new_key);
-
-/**
- * Process a CM_SET_KEY.CNF, 11.5.5.
- * \param ctx control plane context
- * \param mme received MME handle
- * \param result transaction result
- * \param my_nounce to be used in next message
- * \param your_nounce used in previous message
- * \param pid protocol identifier
- * \param prn protocol run number
- * \param pmn protocol message number
- * \param cco_cap CCo capabilities of the sending STA
- *
- * Response from a preceding CM_SET_KEY.REQ. First check that this message is
- * legitimate and that it correspond to a sent request, then call the
- * corresponding function.
- *
- * This message can be forwarded to the CCo module.
- */
-void
-cp_sta_action_process_cm_set_key_cnf (cp_t *ctx, cp_mme_t *mme,
- cp_msg_cm_set_key_cnf_result_t result,
- u32 my_nounce, u32 your_nounce,
- cp_pid_t pid,
- u16 prn, u8 pmn,
- cp_cco_cap_t cco_cap);
-
-/**
- * Process a CM_GET_KEY.REQ, 11.5.6.
- * \param ctx control plane context
- * \param mme received MME handle
- * \param req_type request type (relayed or not)
- * \param key_type requested key type
- * \param nid NID of the network of the sender, or the sender want to join
- * \param my_nounce to be used in next message
- * \param pid protocol identifier
- * \param prn protocol run number
- * \param pmn protocol message number
- * \param hash HASH key, used to generate a TEK, or NULL if not present
- *
- * This message is used in several protocols. First check that this message
- * is legitimate, then depending of the protocol, call the corresponding
- * function.
- *
- * This message can be forwarded to the CCo module.
- *
- * Used to:
- * - from STA to STA:
- * - NMK provisioning using UKE (PID=3):
- * - get HASH KEY, unencrypted unicast (not handled): used to derive the
- * TEK
- * - from STA to CCo:
- * - get NEK, NMK encrypted (PID=0)
- * - from HLE to STA:
- * - get NMK (not handled)
- */
-void
-cp_sta_action_process_cm_get_key_req (cp_t *ctx, cp_mme_t *mme,
- cp_msg_cm_get_key_req_type_t req_type,
- cp_key_type_t key_type,
- cp_nid_t nid,
- u32 my_nounce,
- cp_pid_t pid,
- u16 prn, u8 pmn,
- u8 *hash);
-
-/**
- * Process a CM_GET_KEY.CNF, 11.5.7.
- * \param ctx control plane context
- * \param mme received MME handle
- * \param result transaction result
- * \param key_type requested key type
- * \param my_nounce to be used in next message
- * \param your_nounce used in previous message
- * \param nid NID of the sender network
- * \param eks EKS of the received key
- * \param pid protocol identifier
- * \param prn protocol run number
- * \param pmn protocol message number
- * \param hash HASH key, used to generate a TEK, or NULL if not present
- * \param key received key, or NULL if not present
- *
- * Response from a preceding CM_GET_KEY.REQ. First check that this message is
- * legitimate and that it correspond to a sent request, then call the
- * corresponding function.
- */
-void
-cp_sta_action_process_cm_get_key_cnf (cp_t *ctx, cp_mme_t *mme,
- cp_msg_cm_get_key_cnd_result_t result,
- cp_key_type_t key_type,
- u32 my_nounce, u32 your_nounce,
- cp_nid_t nid,
- u8 eks,
- cp_pid_t pid,
- u16 prn, u8 pmn,
- u8 *hash, cp_key_t *key);
-
-END_DECLS
-
-#endif /* cp_sta_action_key_h */
diff --git a/cp2/sta/action/misc.h b/cp2/sta/action/misc.h
deleted file mode 100644
index 8a9b717578..0000000000
--- a/cp2/sta/action/misc.h
+++ /dev/null
@@ -1,117 +0,0 @@
-#ifndef misc_h
-#define misc_h
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file misc.h
- * \brief STA action, miscellaneous definitions.
- * \ingroup cp_sta
- *
- * Miscellaneous
- * =============
- *
- * This part handle other miscellaneous STA function, most of theses are
- * simple enough to be handled without any remembered state.
- */
-
-BEGIN_DECLS
-
-/**
- * Process a CC_WHO_RU.REQ, 11.2.26.
- * \param ctx control plane context
- * \param mme received MME handle
- * \param nid NID of network being queried
- *
- * Provide AVLN identity and CCo MAC address. If the NID correspond to our
- * NID, send a CC_WHO_RU.CNF. In other cases, drop.
- *
- * Need:
- * - our CCo MAC address.
- * - our AVLN HFID.
- */
-void
-cp_sta_action_process_cc_who_ru_req (cp_t *ctx, cp_mme_t *mme, cp_nid_t nid);
-
-/**
- * Process a CC_SET_TEI_MAP.IND, 11.2.35.
- * \param ctx control plane context
- * \param mme received MME handle
- * \param mode update, add or remove
- *
- * The CCo send an update of the AVLN list of STA. According to the mode,
- * update the whole list, add or remove a STA.
- *
- * Need:
- * - use a cp_msg function to read the rest of the message.
- *
- * Update:
- * - STA mgr.
- */
-void
-cp_sta_action_process_cc_set_tei_map_ind_update (
- cp_t *ctx, cp_mme_t *mme, cp_msg_cc_set_tei_map_ind_mode_t mode);
-
-/**
- * Process a CC_RELAY.REQ, 11.2.36.
- * \param ctx control plane context
- * \param mme received MME handle
- * \param fda final destination address
- * \param ftei final destination TEI
- * \param len payload size
- *
- * Extract the payload from the MME, and encapsulate it in a CC_RELAY.IND to
- * the final destination.
- *
- * There is special behaviour depending on the contained payload. If the
- * relay request is not encrypted, only relay MME which are permitted to be
- * unencrypted. If the relay request is not encrypted and contains a
- * CM_ENCRYPTED_PAYLOAD.IND, the CC_RELAY.IND should be sent broadcast. This
- * could be done by the cp_msg module.
- *
- * - What to do with the MAC address?
- */
-void
-cp_sta_action_process_cc_relay_req (cp_t *ctx, cp_mme_t *mme, mac_t fda,
- cp_tei_t ftei, uint len);
-
-/**
- * Process a CC_RELAY.IND, 11.2.37.
- * \param ctx control plane context
- * \param mme received MME handle
- * \param osa original source address
- * \param otei original source TEI
- * \param len payload size
- *
- * Extract the payload and insert the message back.
- *
- * Relay station is trusted as long as it is authenticated. It should have
- * filtered unauthorised payload.
- */
-void
-cp_sta_action_process_cc_relay_ind (cp_t *ctx, cp_mme_t *mme, mac_t osa,
- cp_tei_t otei, uint len);
-
-/**
- * Process a CM_MME_ERROR.IND, 11.5.32.
- * \param ctx control plane context
- * \param mme received MME handle
- * \param reason reason of the error
- * \param rx_mmv MMV of the erroneous MME
- * \param rx_mmtype MMTYPE of the erroneous MME
- * \param invalid_byte_offset offset in the MME of the error
- *
- * Used for debug. Trace the error.
- */
-void
-cp_sta_action_process_cm_mme_error_ind (
- cp_t *ctx, cp_mme_t *mme, cp_msg_cm_mme_error_ind_reason_t reason,
- u8 rx_mmv, u16 rx_mmtype, u16 invalid_byte_offset);
-
-END_DECLS
-
-#endif /* misc_h */
diff --git a/cp2/sta/core/core.h b/cp2/sta/core/core.h
deleted file mode 100644
index d0d02fea2e..0000000000
--- a/cp2/sta/core/core.h
+++ /dev/null
@@ -1,122 +0,0 @@
-#ifndef cp_sta_core_core_h
-#define cp_sta_core_core_h
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp/sta/core/core.h
- * \brief STA core.
- * \ingroup cp_sta
- *
- * station core module implements following elements and functionalities
- * *CP thread
- * *main CP thread wait event loop
- * station events as eCos event flags
- * eCos event flag mask initialisation, event masking & unmasking,
- * manage MME, beacon, FSM and garbage events
- * garbage collector event flag
- * manage (set/stop) the garbage collector timer
- * *garbage collector timer DSR function (activation of the garbage flag,
- * the garbage collector event flag will be taken into account with the
- * lowest priority by the main wait event loop)
- * *in case of garbage flag event activated, garbage collector consists in
- * freeing "not terminated" MME messages buffers (i.e. MME messages which
- * were not fully re-assembled, that is, which have a recorded date exceeding
- * the current date + 1 second)
- * dispatch a MME message beeing received
- * in case of MME event flag activated, call the cp_interf() function which
- * takes the available MME in the Rx FIFO and then calls the msg_dispatch()
- * function that will post the relevant FSM event in the FSM event FIFO
- * manage beacon data
- * in case of beacon event flag activated
- * implement various utility functions
- * launch/stop a timer
- * timer callback function for each sort of timer
- * API function to put a FSM event in the FSM event FIFO.
- */
-
-BEGIN_DECLS
-
-/**
- * initialisation of station core.
- *
- * \param ctx control plane context
- */
-void
-cp_station_core_init(cp_t *ctx);
-
-/**
- * garbage collector, that is, freeing "not terminated" MME messages buffers
- * (i.e. MME messages which were not fully re-assembled, that is, which have
- * a recorded date exceeding the current date + 1 second).
- *
- * \param ctx control plane context
- */
-void
-cp_station_core_garbage_collector(cp_t *ctx);
-
-/**
- * garbage collector timer DSR (set the relevant event flag).
- *
- * \param ctx control plane context
- */
-void
-cp_station_core_garbage_collector_timer_dsr(cp_t *ctx);
-
-/**
- * create an alarm that will generate an event after the specified delay.
- *
- * \param cyg_flag the event handle
- * \param station_flag the event flag
- * \param event_delay_ms the amount of time to wait in millisecond
- */
-void
-cp_station_core_gen_timed_event(cyg_flag_t *cyg_flag, station_flag_t station_flag, SEM_EVENT_TYPE event_type, uint event_delay_ms);
-
-/**
- * will stop an alarm previously created with cp_station_core_gen_timed_event
- *
- * \param cyg_flag the event handle
- * \param station_flag the event flag
- */
-void
-cp_station_core_stop_timed_event(cyg_flag_t *cyg_flag, station_flag_t station_flag);
-
-/**
- * this function is called when the amount of time specified
- * with station_wait_event() has elapsed.
- *
- * \param alarm
- * \param data
- *
- * see eCos manual about alarm
- * warning : this function is called in DSR context
- */
-void
-cp_station_core_alarm_handler(cyg_handle_t alarm, cyg_addrword_t data);
-
-
-/**
- * CP main wait event loop.
- *
- * \param ctx control plane context
- */
-void
-cp_station_core_wait_event_loop(cp_t *ctx);
-
-/**
- * main CP thread (Control-Plane thread).
- *
- * \param data thread entry data
- *
- * calls the CP main wait event loop
- */
-void cp_station_core_cp_thread(cyg_addrword_t data);
-
-END_DECLS
-
-#endif /* cp_sta_core_core_h */
diff --git a/cp2/sta/data/inc/own_data.h b/cp2/sta/data/inc/own_data.h
deleted file mode 100644
index df9e67ca0c..0000000000
--- a/cp2/sta/data/inc/own_data.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef cp2_sta_data_inc_own_data_h
-#define cp2_sta_data_inc_own_data_h
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp2/sta/data/inc/own_data.h
- * \brief Station own data.
- * \ingroup cp_sta_data
- *
- * Structure containing the station own data.
- */
-
-struct cp_sta_own_data_private
-{
- /** STA's tei. */
- u8 tei;
- /** Mac address. */
- mac_t mac_address;
- /** Security level. */
- u8 security_level;
-};
-typedef struct cp_sta_own_data_private cp_sta_own_data_private;
-
-
-#endif /* cp2_sta_data_inc_own_data_h */
diff --git a/cp2/sta/data/inc/sta_data.h b/cp2/sta/data/inc/sta_data.h
deleted file mode 100644
index 9bfe395837..0000000000
--- a/cp2/sta/data/inc/sta_data.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef cp2_sta_data_inc_sta_data_h
-#define cp2_sta_data_inc_sta_data_h
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp2/sta/data/inc/sta_data.h
- * \brief Sta private paramters.
- * \ingroup cp_sta_data
- *
- */
-
-struct cp_sta_private_t
-{
- /** TEI of the station. */
- u8 tei;
- /** STA's mac address. */
- mac_t mac_address;
- /** boolean associated. */
- bool assoc;
- /** CCo status. */
- bool cco_status;
- /** PCo status. */
- bool pco_status;
- /** backup CCo status. */
- bool backup_cco_status;
-};
-
-#endif /* cp2_sta_data_inc_sta_data_h */
diff --git a/cp2/sta/data/net_list.h b/cp2/sta/data/net_list.h
deleted file mode 100644
index 52f1ff1d8e..0000000000
--- a/cp2/sta/data/net_list.h
+++ /dev/null
@@ -1,83 +0,0 @@
-#ifndef cp2_sta_data_net_list_h
-#define cp2_sta_data_net_list_h
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp2/sta/data/net_list.h
- * \brief CP Net list managing an AVLN.
- * \ingroup cp_sta_data
- *
- * The Network list data for one AVLN.
- */
-
-#include "cp2/sta/data/sta_list.h"
-
-struct cp_net_list_t
-{
- /** Short Network ID. */
- u16 snid;
- /** Network ID. */
- u64 nid;
- /** Network Membership Key. */
- uint nmk;
- /** Network password. */
- u128 npw;
- /** Network present. */
- bool present;
- /** CCo in the AVLN. */
- cp_sta_t cco;
- /** PCo in the AVLN. */
- cp_sta_t pco;
-};
-typedef struct cp_net_list_t cp_net_list_t;
-
-/** Add a sta to this AVLN.
- * \param net_list the net list to add the sta.
- * \param sta the sta to add.
- */
-void
-cp_net_list_add_sta(cp_net_list_t *net_list, cp_sta_t *sta);
-
-/** Remove a station from the AVLN.
- * \param net_list the list to remove ths sta.
- * \param the sta to remove.
- */
-void
-cp_net_list_remove_sta(cp_net_list_t *net_list, cp_sta_t *sta);
-
-/** Remove the sta by providing the STA's tei from this AVLN.
- * \param net_list the net_list from the one the sta shall be removed.
- * \param tei the station's tei.
- */
-void
-cp_net_list_remove_sta_from_tei(cp_net_list_t *net_list, u8 tei);
-
-/** Get the station from the AVLN.
- * \param net_list the net_list to get the station.
- * \param tei the tei of the station.
- * \return the station if it is in the AVLN, NULL otherwise.
- */
-cp_sta_t *
-cp_net_list_get_sta(cp_net_list_t *net_list, u8 tei);
-
-/** Get the first station of the AVLN.
- * \param net_list the AVLN list to get it's first sta.
- * \return the first station if the AVLN has one.
- */
-cp_sta_t *
-cp_net_list_first_sta(cp_net_list_t *net_list);
-
-/** Get the next station from the AVLN.
- * \param net_list the AVLN net list.
- * \param sta the current station to get the next one.
- * \return the next station of the one provided.
- */
-cp_sta_t *
-cp_sta_t cp_net_list_next_sta(cp_net_list_t *net_list, cp_sta_t *sta);
-
-#endif /* cp2_sta_data_net_list_h */
diff --git a/cp2/sta/data/own_data.h b/cp2/sta/data/own_data.h
deleted file mode 100644
index 2865cd1346..0000000000
--- a/cp2/sta/data/own_data.h
+++ /dev/null
@@ -1,111 +0,0 @@
-#ifndef cp2_sta_data_own_data_h
-#define cp2_sta_data_own_data_h
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp2/sta/data/own_data.h
- * \brief Station own data.
- * \ingroup cp_sta_data
- *
- * Structure containing the station own data.
- */
-
-#include "cp2/defs.h"
-#include "cp2/sta/data/inc/own_data.h"
-
-/** Waning When storing data bigger than one word, think about the access. */
-
-struct cp_sta_own_data
-{
- /** Private part only usable with the accessor defined below. */
- cp_sta_own_data_private private;
-
- /** NID. */
- u64 nid;
- /** NMK. */
- u8 nmk[NMK_SIZE];
- /** Network password. */
- u8 npw[MAX_NPW_SIZE];
- /** Devide password. */
- u8 dpw[MAX_DPW_SIZE];
-
-
- /** CCo prefered status. */
- bool cco_prefered;
- /** Was CCo status. */
- bool was_cco;
-
-
- /** Manufacturer Human identifier. */
- u8 hfid_manu[HFID_SIZE];
- /** User HFID. */
- u8 hfid_user[HFID_SIZE];
- /** Avln HFID. */
- u8 hfid_avln[HFID_SIZE];
-};
-typedef struct cp_sta_own_data cp_sta_own_data;
-
-/** Initialise the sta own data
- * \param ctx the CP context.
- */
-void
-cp_sta_data_own_init (cp_t *ctx);
-
-/** Uninitialise the sta own data.
- * \param ctx the cp context.
- */
-void
-cp_sta_data_own_uninit (cp_t *ctx);
-
-/** Set the Mac address of the sta.
- * \param ctx the CP context.
- * \param mac the mac address of the station.
- *
- * This function will update the mac config to update the mac address in it.
- */
-void
-cp_sta_data_own_set_mac_address (cp_t *ctx);
-
-/** Get the Mac address of the sta.
- * \param ctx the CP context.
- * \return the station's mac address.
- */
-mac_t
-cp_sta_data_own_get_mac_address (cp_t *ctx);
-
-/** Set the TEI of the station.
- * \param ctx the cp context.
- * \param tei the station's tei.
- *
- * This function will update the mac config.
- */
-void
-cp_sta_data_own_set_tei (cp_t *ctx, u8 tei);
-
-/** Get the station's tei.
- * \param ctx the CP context.
- * \return the station's tei.
- */
-u8
-cp_sta_data_own_get_tei (cp_t *ctx);
-
-/** Set the station Security level.
- * \param ctx the CP context.
- * \param sl the security level policy.
- */
-void
-cp_sta_data_own_set_security_level (cp_t *ctx, u8 sl);
-
-/** Get the security level.
- * \param ctx the CP context.
- * \return the station's security level.
- */
-u8
-cp_sta_data_own_get_security_level (cp_t *ctx);
-
-#endif /* cp2_sta_data_own_data_h */
diff --git a/cp2/sta/data/sta_data.h b/cp2/sta/data/sta_data.h
deleted file mode 100644
index d7dba97021..0000000000
--- a/cp2/sta/data/sta_data.h
+++ /dev/null
@@ -1,122 +0,0 @@
-#ifndef cp2_sta_data_sta_data_h
-#define cp2_sta_data_sta_data_h
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp2/sta/data/sta_data.h
- * \brief Sta data.
- * \ingroup cp_sta_data
- *
- * Sta data.
- */
-
-/* forward declaration. */
-typedef struct cp_sta_data_private_t cp_sta_data_private_t;
-
-struct cp_msg_reassembly_ctx_t
-{
-
-};
-typedef struct cp_msg_reassembly_ctx_t cp_msg_reassembly_ctx_t;
-
-struct cp_sta_data_t
-{
- /** Private part. */
- cp_sta_data_private_t private;
- /** Visible true if the STA is visible by out STA. */
- bool visible;
- /** Last seen. */
- uint last_seen_ntb;
- /** Reassembly context. */
- cp_msg_reassembly_ctx_t rea;
-};
-typedef struct cp_sta_data_t cp_sta_data_t;
-
-/** Get the TEI of the station.
- * \param sta the station.
- * \return the sta's tei.
- */
-u8
-cp_sta_get_tei(cp_sta_t *sta);
-
-/** Get the mac address of the station.
- * \param sta the station.
- * \return the sta's mac address.
- */
-mac_t
-cp_sta_get_mac_address(cp_sta_t *sta);
-
-/** Set the associated status of the station.
- * \param sta the station.
- * \param associated the association status, true if associated, false
- * otherwise.
- */
-void
-cp_sta_set_associated (cp_sta_t *sta, bool associated);
-
-/** Get the association status.
- * \param sta the station.
- * \return the association status.
- *
- * This function will return true if the station is associated, false
- * otherwise.
- */
-bool
-cp_sta_is_associated (cp_sta_t *sta);
-
-/** Set the CCo status of the station.
- * \param sta the station.
- * \param cco the cco status, true if the sta is cco, false otherwise.
- */
-void
-cp_sta_set_cco_status (cp_sta_t *sta, bool cco);
-
-/** Get the station CCo's status.
- * \param sta the station.
- * \return the cco status of the sta.
- *
- * This function will return true if the Station is CCo, false otherwise.
- */
-bool
-cp_sta_is_cco_status (cp_sta_t *sta);
-
-/** Set the PCo status of the station.
- * \param sta the station.
- * \param pco the pco status, true if the sta is pco false otherwise.
- */
-void
-cp_sta_set_pco_status (cp_sta_t *sta, bool pco);
-
-/** Get the PCo status of the station.
- * \param sta the station.
- * \return the PCo's station status.
- *
- * This will return true if the STA is PCo, false otherwise.
- */
-bool
-cp_sta_is_pco_status (cp_sta_t *sta);
-
-/** Set the backup CCo status of the station.
- * \param sta the station.
- * \param backup_cco the backup cco status.
- *
- * This shall set true if the station is backup CCo, false otherwise.
- */
-void
-cp_sta_set_backup_cco_status (cp_sta_t *sta, bool backup_cco);
-
-/** Get the backup CCo of the station.
- * \param sta the sta.
- * \return the sta's backup cco status.
- *
- * This will return true if the station is backup cco, false otherwise.
- */
-bool
-cp_sta_is_backup_cco_status (cp_sta_t *sta);
-
-#endif /* cp2_sta_data_sta_data_h */
diff --git a/cp2/sta/mgr/doc/sta_manager.odt b/cp2/sta/mgr/doc/sta_manager.odt
deleted file mode 100644
index b7df7da727..0000000000
--- a/cp2/sta/mgr/doc/sta_manager.odt
+++ /dev/null
Binary files differ
diff --git a/cp2/sta/mgr/sta_mgr.h b/cp2/sta/mgr/sta_mgr.h
deleted file mode 100644
index 190b8d011e..0000000000
--- a/cp2/sta/mgr/sta_mgr.h
+++ /dev/null
@@ -1,163 +0,0 @@
-#ifndef cp2_sta_data_sta_mgr_h
-#define cp2_sta_data_sta_mgr_h
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp2/sta/data/sta_mgr.h
- * \brief Station and AVLN manager.
- * \ingroup cp_sta_data
- *
- * Manage the network list and its Stations. The station manager job it to
- * keep the integrity of the differents databases.
- */
-
-#include "cp2/sta/data/net_list.h"
-#include "cp2/sta/data/sta_data.h"
-
-struct cp_t
-{
- /** the index 0 represents our avln. The others are the neighbour avln. */
- cp_net_list_t avln[8];
- /** Last AVLN access in the neigbour avln. */
- cp_net_list_t *current_avln;
-};
-typedef struct cp_t cp_sta_mgr_t;
-
-/** Initialise the cp.
- * \return the cp context.
- */
-cp_t *
-cp_sta_mgr_init(void);
-
-/** Uninitialise the cp.
- * \param ctx the cp context.
- */
-void
-cp_sta_mgr_uninit(cp_t *ctx);
-
-/** Get an AVLN from the cp.
- * \param ctx the cp context.
- * \return the avln identified by its snid.
- *
- * This function shall return an avln with the snid provided or NULL if the
- * avln does not exists.
- */
-cp_net_list_t*
-cp_sta_mgr_get_avln(cp_t *ctx, u16 snid);
-
-/** Get our AVLN.
- * \param ctx the cp context.
- * \return Our AVLN.
- */
-cp_net_list_t*
-cp_sta_mgr_get_our_avln(cp_t *ctx);
-
-/** Add an AVLN.
- * \param ctx the cp context.
- * \param snid the new avln's snid.
- * \return the new avln.
- */
-cp_net_list_t*
-cp_sta_mgr_add_avln(cp_t *ctx, u16 snid);
-
-/** Remove an AVLN from the list and all the STAs associated in it.
- * \param ctx the cp context.
- * \param snid the avln snid.
- *
- * This function shall not remove our AVLN.
- */
-void
-cp_sta_mgr_remove_avln(cp_t *ctx, u16 snid);
-
-/** Add a station to a specified AVLN.
- * \param ctx the cp context.
- * \param tei the tei of the station
- * \param mac_addr the mac address
- * \param added true if the station was just create, flase otherwise.
- * \return the station just created.
- *
- * This function shall return the station just created and fill the added
- * boolean parameters with true value if the station has just been created or
- * false if the station already exists.
- */
-cp_sta_t*
-cp_sta_mgr_add_sta(cp_t *ctx, u16 snid, u8 tei, mac_t mac_addr,
- bool added);
-
-/** Remove a sta from the specified AVLN.
- * \param ctx the cp context.
- * \param snid the AVLN's snid.
- * \param tei the station tei.
- */
-void
-cp_sta_mgr_remove_sta(cp_t *ctx, u16 snid, u8 tei);
-
-/** Add a STA to our AVLN.
- * \param ctx the cp context.
- * \param tei the station tei
- * \param mac_address the station mac address.
- * \param added true if the station was just create, flase otherwise.
- * \return the station just created.
- *
- * This function shall return the station just created and fill the added
- * boolean parameters with true value if the station has just been created or
- * false if the station already exists.
- */
-cp_sta_t*
-cp_sta_mgr_add_sta_our_avln(cp_t *ctx, u8 tei, mac_t mac_address);
-
-/** Remove a STA of our AVLN.
- * \param ctx the cp context.
- * \param tei the station tei.
- */
-void
-cp_sta_mgr_remove_sta_our_avln(cp_t *ctx, u8 tei);
-
-/** Get a STA from an AVLN.
- * \param ctx the cp context.
- * \param snid the AVLN's snid.
- * \param tei the STA's tei.
- * \return The station associated of NULL of no tei is associated.
- */
-cp_sta_t*
-cp_sta_mgr_get_sta(cp_t *ctx, u16 snid, u8 tei);
-
-/** Get the STA in our AVLN corresponding to the tei provided.
- * \param ctx the cp context.
- * \param tei the station's tei
- * \return the station corresponding to the tei.
- */
-cp_sta_t*
-cp_sta_mgr_get_sta_in_avln(cp_t *ctx, u8 tei);
-
-/** Update the STA data in our AVLN.
- * \param ctx the cp context.
- * \param sta the station to update
- * \param tei the station's new tei
- * \param mac address the station's new mac address.
- */
-void
-cp_sta_mgr_update_sta_in_avln(cp_t *ctx, cp_sta_t *sta,
- u8 tei, mac_t mac_addr);
-
-/** Update the STA data in any AVLN.
- * \param ctx the cp context.
- * \param sta the station to update the data.
- * \param tei the station new tei.
- * \param mac_addr the station's new mac address.
- */
-void
-cp_sta_mgr_update_sta(cp_sta_t sta, u8 tei, mac_t mac_addr);
-
-/** Commit the modification done when a STA has been removed of added.
- * \param ctx the cp context.
- */
-void
-cp_sta_mgr_commit (cp_t *ctx);
-
-#endif /* cp2_sta_data_sta_mgr_h */
diff --git a/cp2/vstate_fsm/vstate_fsm.h b/cp2/vstate_fsm/vstate_fsm.h
deleted file mode 100644
index cf9f89cf24..0000000000
--- a/cp2/vstate_fsm/vstate_fsm.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef vstate_fsm__h__
-#define vstate_fsm__h__
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file Cesare/cp/vstate_fsm/vstate_fsm.h
- * \brief functions to run the visual state fsm
- * \ingroup cp/vstate_fsm
- *
- * « long description »
- */
-
-
-
-BEGIN_DECLS
-
-
-/**
- * initialisation of the vstate fsm.
- *
- * \param ctx cp context
- */
-void
-cp_vstate_fsm_init(cp_t *ctx);
-
-
-/**
- * process the event from the fsm queue.
- *
- * \param ctx the cp context
- *
- * 1) get the last event for the fsm and process it
- * 2) if the event was related to a MME, free the buffer
- */
-void
-cp_vstate_fsm__process_event(cp_t *ctx);
-
-/**
- * process the event immediately.
- *
- * \param ctx the cp context
- * \param event_type the visual state event to process
- *
- * The event must be a transition from one state to another.
- */
-void
-cp_vstate_fsm_process_event_now(cp_t *ctx, SEM_EVENT_TYPE event_type);
-
-
-/**
- * debugging function, will print the fsm state.
- */
-void
-cp_vstate_fsm_print_state(void);
-
-
-
-END_DECLS
-
-#endif \ No newline at end of file