#ifndef INC_PLCD_CTX_H #define INC_PLCD_CTX_H /* Cleopatre project {{{ * * Copyright (C) 2009 Spidcom * * <<>> * * }}} */ /** * \file devkit/plcd/inc/plcd_ctx.h * \brief context structures of plc daemon * \ingroup plcd */ /* FIXME: This include cannot be moved, * there is a compilation error with lib*.h . */ #include #include "libmme.h" #include "libspid.h" #include "mmtypes.h" #include #include #include #include #define PLCD_ASSERT(condition) \ { \ if (!(condition)) \ { \ syslog (LOG_ERR, "%s: %d: %s: Assertion '%s' failed.", \ __FILE__, __LINE__, __PRETTY_FUNCTION__, __STRING(condition)); \ abort(); \ } \ } #define MME_TYPE_MASK 0x0003 #define MME_RESULT_SUCCESS 0x00 #define PLCD_EVENT_REFRESH_TIMEOUT_MS 1000 #define PLCD_INIT_RETRIES 10 typedef enum { MME_DRV_STATUS_ASSOC_UNASSOCIATED = 0, MME_DRV_STATUS_ASSOC_ASSOCIATED, MME_DRV_STATUS_ASSOC_AUTHENTICATED, MME_DRV_STATUS_ASSOC_NB } mme_drv_status_assoc_t; typedef enum { MME_DRV_STATUS_CCO_STATION = 0, MME_DRV_STATUS_CCO_PROXY, MME_DRV_STATUS_CCO_MAIN, MME_DRV_STATUS_CCO_NB } mme_drv_status_cco_t; typedef enum { MME_DRV_SC_ADD = 0, MME_DRV_SC_JOIN, MME_DRV_SC_NB } mme_drv_sc_t; typedef enum { MME_DRV_KEY_TYPE_NID = 0, MME_DRV_KEY_TYPE_SL, MME_DRV_KEY_TYPE_NB } mme_drv_key_type_t; typedef enum { MME_DRV_KEY_SL_SC = 0, MME_DRV_KEY_SL_HS, MME_DRV_KEY_SL_NB } mme_drv_key_sl_t; /** NVRAM fields needed by plcd */ typedef struct { unsigned char plc_address[6]; char device_password[32]; char product_name[64]; char tonemask[192]; } plcd_nvram_t; /** main context of plc daemon */ typedef struct { /** Pointer on the program name (argv[0]). */ const char *my_name; /** full path of HPAV info file */ const char *hpav_info_path; /** full path of HPAV config file */ const char *hpav_conf_path; /** full path of PHY config file */ const char *phy_conf_path; /** full path of internal config file */ const char *internal_conf_path; /** netlink socket descriptor for PLC driver comm */ int plc_sock; /** plcd netlink address descriptor for PLC driver comm */ struct sockaddr_nl plcd_addr; /** NVRAM structure */ plcd_nvram_t *nvram; /** indicates if configuration files have to be saved in flash */ libspid_boolean_t is_save_conf_needed; /** indicates if other processes have to be informed about files modifications */ libspid_boolean_t is_warn_needed; /* hpav.conf last values */ struct { /* CCo preference */ libspid_boolean_t is_cco_preferred; /* CCo status at boot */ libspid_boolean_t was_cco; /* NMK value */ char nmk_str[LIBSPID_HPAV_CONF_NMK_STR_LEN]; /* NID value */ char nid_str[LIBSPID_HPAV_CONF_NID_STR_LEN]; /* SL value */ char sl_str[LIBSPID_HPAV_CONF_SL_STR_MAX_LEN]; /* user HFID value */ char user_hfid[LIBSPID_HPAV_CONF_HFID_MAX_LEN]; /* AVLN HFID value */ char avln_hfid[LIBSPID_HPAV_CONF_HFID_MAX_LEN]; } hpav_conf; /* hpav.info last values */ libspid_hpav_info_t hpav_info; /** Last time the multicast info file was checked. */ struct timespec mcast_last_check; } plcd_ctx_t; #endif /* INC_PLCD_CTX_H */