summaryrefslogtreecommitdiff
path: root/cleopatre/devkit/plcd/inc
diff options
context:
space:
mode:
Diffstat (limited to 'cleopatre/devkit/plcd/inc')
-rw-r--r--cleopatre/devkit/plcd/inc/plcd.h12
-rw-r--r--cleopatre/devkit/plcd/inc/plcd_stack.h176
2 files changed, 183 insertions, 5 deletions
diff --git a/cleopatre/devkit/plcd/inc/plcd.h b/cleopatre/devkit/plcd/inc/plcd.h
index cd4738d30b..2b4224f54a 100644
--- a/cleopatre/devkit/plcd/inc/plcd.h
+++ b/cleopatre/devkit/plcd/inc/plcd.h
@@ -15,15 +15,20 @@
#ifndef PLCD_H
#define PLCD_H
+/* FIXME: This include <net/ethernet.h> cannot be moved,
+ * there is a compilation error with lib*.h . */
#include <net/ethernet.h>
+
+#include "libmme.h"
+#include "libspid.h"
+#include "mmtypes.h"
+
#include <sys/types.h>
#include <sys/socket.h>
#include <stdint.h>
#include <time.h>
#include <linux/netlink.h>
-#include "mmtypes.h"
-
#define PLCD_ASSERT(condition) \
{ \
if (!(condition)) \
@@ -149,9 +154,6 @@ extern int autoswitch_timer_alive;
void plcd_autoswitch_timer_init (void);
void plcd_autoswitch_image_update (void);
-int plcd_send_recv_drv_mme (const plcd_ctx_t *ctx, const mme_ctx_t *request_ctx,
- mme_ctx_t *confirm_ctx, mme_ctx_t *indication_ctx);
-
/**
* Tell whether the multicast info file was updated since last check.
* \param ctx The context;
diff --git a/cleopatre/devkit/plcd/inc/plcd_stack.h b/cleopatre/devkit/plcd/inc/plcd_stack.h
index cbd472742f..9d844610bd 100644
--- a/cleopatre/devkit/plcd/inc/plcd_stack.h
+++ b/cleopatre/devkit/plcd/inc/plcd_stack.h
@@ -11,5 +11,181 @@
* \file devkit/plcd/inc/plcd_stack.h
* \ingroup plcd
*/
+#include "plcd.h"
+#include "libmme.h"
+#include "libspid.h"
+
+/**
+ * Send all DRV MME-s for initialization process.
+ *
+ * \param ctx plcd context
+ * \return -1 on error, 0 otherwise
+ */
+int
+plcd_stack_init (const plcd_ctx_t *ctx);
+
+/**
+ * Receive DRV MME-s from PLC driver,
+ * i.e. events coming from AV / EoC stack, and to dispatch them.
+ *
+ * \param ctx plcd context
+ * \return -1 on error, 0 otherwise
+ */
+int
+plcd_stack_event_dispatch (plcd_ctx_t *ctx);
+
+/**
+ * Transmit a DRV MME to PLC driver.
+ * Send the given MME and,
+ * depending on given confirmation and indication contexts,
+ * wait - or not (if they are NULL) - for corresponding .CNF / .IND DRV MME-s.
+ *
+ * \param ctx plcd context
+ * \param request_ctx mme context for .REQ
+ * \param confirm_ctx mme context for .CNF
+ * \param indication_ctx mme context for .IND
+ * \return -1 on error, 0 otherwise
+ */
+int
+plcd_send_recv_drv_mme (
+ const plcd_ctx_t *ctx, const mme_ctx_t *request_ctx,
+ mme_ctx_t *confirm_ctx, mme_ctx_t *indication_ctx);
+
+/**
+ * Send a DRV MME in which there is only one data field (maximum).
+ * If value is NULL, then MME data is empty.
+ * This helper function is used to send almost all initialization DRV MME-s.
+ *
+ * \param ctx plcd context
+ * \param mmtype mmtype of mme to send
+ * \param value mme data
+ * \param length length of mme data
+ * \return -1 on error, 0 otherwise
+ */
+int
+plcd_send_recv_single_value (
+ const plcd_ctx_t *ctx, unsigned int mmtype,
+ const void *value, unsigned int length);
+
+/**
+ * Send DRV_STA_MAC_ADDR.REQ and receive DRV_STA_MAC_ADDR.CNF.
+ *
+ * \param ctx plcd context
+ * \param mac_addr data to send in mme
+ * \return -1 on error, 0 otherwise
+ */
+int
+plcd_stack_set_mac_address (
+ const plcd_ctx_t *ctx, const unsigned char *mac_addr);
+
+/**
+ * Send DRV_STA_SET_CCO_PREF.REQ and receive DRV_STA_SET_CCO_PREF.CNF.
+ *
+ * \param ctx plcd context
+ * \param is_cco_preferred data to send in mme
+ * \return -1 on error, 0 otherwise
+ */
+int
+plcd_stack_set_cco_preferred (
+ const plcd_ctx_t *ctx, libspid_boolean_t is_cco_preferred);
+
+/**
+ * Send DRV_STA_SET_WAS_CCO.REQ and receive DRV_STA_SET_WAS_CCO.CNF.
+ *
+ * \param ctx plcd context
+ * \param was_cco data to send in mme
+ * \return -1 on error, 0 otherwise
+ */
+int
+plcd_stack_set_was_cco (
+ const plcd_ctx_t *ctx, libspid_boolean_t was_cco);
+
+/**
+ * Send DRV_STA_SET_KEY.REQ and receive DRV_STA_SET_KEY.CNF.
+ *
+ * \param ctx plcd context
+ * \param nmk_str data to send in mme
+ * \param nid_str data to possibly send in mme (data contain nid xor sl)
+ * \param sl_str data to possibly send in mme (data contain nid xor sl)
+ * \return -1 on error, 0 otherwise
+ */
+int
+plcd_stack_set_key (
+ const plcd_ctx_t *ctx, const char *nmk_str,
+ const char *nid_str, const char *sl_str);
+
+/**
+ * Send DRV_STA_SET_DAK.REQ and receive DRV_STA_SET_DAK.CNF.
+ *
+ * \param ctx plcd context
+ * \param dpw device passwork used to generate device access key to send in mme
+ * \return -1 on error, 0 otherwise
+ */
+int
+plcd_stack_set_dak (
+ const plcd_ctx_t *ctx, const char *dpw);
+
+/**
+ * Send DRV_STA_SET_M_STA_HFID.REQ and receive DRV_STA_SET_M_STA_HFID.CNF.
+ *
+ * \param ctx plcd context
+ * \param manu_hfid data to send in mme
+ * \return -1 on error, 0 otherwise
+ */
+int
+plcd_stack_set_manu_hfid (
+ const plcd_ctx_t *ctx, const char *manu_hfid);
+
+/**
+ * Send DRV_STA_SET_U_STA_HFID.REQ and receive DRV_STA_SET_U_STA_HFID.CNF.
+ *
+ * \param ctx plcd context
+ * \param user_hfid data to send in mme
+ * \return -1 on error, 0 otherwise
+ */
+int
+plcd_stack_set_user_hfid (
+ const plcd_ctx_t *ctx, const char *user_hfid);
+
+/**
+ * Send DRV_STA_SET_AVLN_HFID.REQ and receive DRV_STA_SET_AVLN_HFID.CNF.
+ *
+ * \param ctx plcd context
+ * \param avln_hfid data to send in mme
+ * \return -1 on error, 0 otherwise
+ */
+int
+plcd_stack_set_avln_hfid (
+ const plcd_ctx_t *ctx, const char *avln_hfid);
+/**
+ * Send DRV_STA_SET_TONEMASK.REQ and receive DRV_STA_SET_TONEMASK.CNF.
+ *
+ * \param ctx plcd context
+ * \param tonemask data to send in mme
+ * \return -1 on error, 0 otherwise
+ */
+int
+plcd_stack_set_tonemask (
+ const plcd_ctx_t *ctx, const unsigned char *tonemask);
+
+/**
+ * Send DRV_STA_SET_CONFIG.REQ with contents of internal.conf file,
+ * and receive DRV_STA_SET_CONFIG.CNF.
+ *
+ * \param ctx plcd context
+ * \return -1 on error, 0 otherwise
+ */
+int
+plcd_stack_set_internal (const plcd_ctx_t *ctx);
+
+/**
+ * Send DRV_STA_MAC_START.REQ and receive DRV_STA_MAC_START.CNF.
+ *
+ * \param ctx plcd context
+ * \return -1 on error, 0 otherwise
+ */
+int
+plcd_stack_start (const plcd_ctx_t *ctx);
+
#endif /* INC_PLCD_STACK_H */