From 3d58a62727346b7ac1a6cb36fed1a06ed72228dd Mon Sep 17 00:00:00 2001 From: save Date: Mon, 7 Apr 2008 14:17:42 +0000 Subject: Moved the complete svn base into the cesar directory. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@1769 017c9cb6-072f-447c-8318-d5b54f68fe89 --- cesar/interface/interface.h | 166 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 cesar/interface/interface.h (limited to 'cesar/interface/interface.h') diff --git a/cesar/interface/interface.h b/cesar/interface/interface.h new file mode 100644 index 0000000000..e9e995dfbc --- /dev/null +++ b/cesar/interface/interface.h @@ -0,0 +1,166 @@ +#ifndef interface_interface_h +#define interface_interface_h +/* Cesar project {{{ + * + * Copyright (C) 2008 Spidcom + * + * <<>> + * + * }}} */ +/** + * \file interface/interface.h + * \brief Inteface module public functions. + * \ingroup interface + * + * The interface module allows the communication between Actors and + * the Data plane. + */ + +#include "hle/hle.h" +#include "cl/cl.h" +#include "mac/sar/sar.h" + +#include "interface/interface_module.h" + +#define INTERFACE_BUFFER_LIST_NUM_SLOTS 2 + +/** Forward declaration. */ +typedef struct interface_t interface_t; + +/** + * Function to call when the interface receives a new MME. + * \param ctx the interface context + * \param mfs the mfs from the one the MF comes if it comes from the PWL. + * \param buffer the buffer containing the MME. + * \param length the MME length + * \param mme_data data use by the CL. + * \param encrypted inform if the packet comes from the PWL if it has been + * crypted. + */ +typedef void +(*interface_mme_recv_cb_t) (void *user_data, mfs_rx_t *mfs, u8 *buffer, uint length, + void *mme_recv, bool encryption); + +/** + * Function to call when the interface receives a empty buffer. + * \param user_data the data registered by the actor in the init function. + * \param buffer the buffer to add. + */ +typedef void +(*interface_mme_buffer_add_cb_t) (void *user_data, u8 *buffer); + +/** + * Function to call when the interface receives a beacon. + * \param user_data the data registered by the actor in the init function. + * \param beacon the beacon freshly received. + */ +typedef void +(*interface_beacon_add_cb_t) (void *user_data, pb_beacon_t *beacon); + +/** + * Initialise the interface module. + * \param hle the hle context. + * \param cl the cl context. + * \param sar the sar context. + * \param mac_config the mac config context. + * \return the interface module context. + */ +interface_t* +interface_init (hle_t *hle, cl_t *cl, sar_t *sar, mac_config_t + *mac_config); + +/** + * Interface uninit. + * \param ctx the interface context. + */ +void +interface_uninit (interface_t *ctx); + +/** + * Initialise the callbacks functions. + * \param ctx the interface context. + * \param mme_recv_cb the function to call on reception of a MME. + * \param buffer_add_cb the function to call on buffer reception. + * \param beacon_add_cb the function to call on beacon reception + * \param user_data the data to provide on each callback function. + */ +void +interface_callback_init (interface_t *ctx, interface_mme_recv_cb_t mme_recv_cb, + interface_mme_buffer_add_cb_t buffer_add_cb, + interface_beacon_add_cb_t beacon_add_cb, void *user_data); + + +/** + * Configure the interface. + * \param ctx the interface context. + * \param data the data to configure the module of sub module. + */ +void +interface_configure (interface_t *ctx, u8 *data); + +/** Receives an MME from the PWL or the HLE. + * \param ctx the interface context + * \param mfs the mfs from the one the MF comes if it comes from the PWL. + * \param buffer the buffer containing the MME. + * \param length the MME length + * \param mme_data data use by the CL. + * \param encrypted inform if the packet comes from the PWL if it has been + * crypted. + */ +void +interface_mme_recv (interface_t *ctx, mfs_rx_t *mfs, u8 *buffer, uint length, + cl_mme_recv_t *mme_data, bool encrypted); + + +/** + * Inform the Data plane when the MME as been processed by the CP. + * \param ctx the interface context + * \param mme_recv the cl data (as a void pointer). + */ +void +interface_mme_recv_done (interface_t *ctx, void *mme_recv); + +/** Provides a MME to send to the CL. This MME can be send as a MME or a data. + * \param ctx the interface context. + * \param buffer the buffer containing the MME. + * \param length the length of the MME. + * \param mfs the MFS to send the MME if the mme is to be sent over the PWL, + * otherwise this pointer is NULL. + */ +void +interface_mme_send (interface_t *ctx, u8* buffer, uint length, mfs_tx_t *mfs); + +/** + * Sends a beacon, the interface will provide it to the SAR. + * \param ctx the interface context. + * \param beacon the beacon to send. + * \param the source mac address. + * \param beacon_mfs the mfs to use to send the beacon. + * \param bto_bpsto the four bto to use for the beacon and the bpsto address + * to be stamp by the pbproc. + */ +void +interface_beacon_prepare (interface_t *ctx, pb_beacon_t *beacon, mac_t + mac_address, mfs_tx_t *beacon_mfs, void *bto_bpsto); + +/** +* add a beacon to the interface. +* It will provide it to the CP to process the beacon. +* +* \param ctx the interface context. +* \param pb pb containing the beacon +* \param params the rx params. +*/ +void interface_beacon_add (interface_t *ctx, pb_beacon_t *pb, + pbproc_rx_beacon_params_t *params); + +/** + * Sends a message to the IPMbox + * \param ctx the interface context + * \param data the message to post in the ipmbox. + * \param length the length of the data in bytes. + */ +void +interface_hle_send (interface_t *ctx, uint *data, uint length); + +#endif /* interface_interface_h */ -- cgit v1.2.3