summaryrefslogtreecommitdiff
path: root/polux/application/autodiscod/inc/autodiscod.h
diff options
context:
space:
mode:
Diffstat (limited to 'polux/application/autodiscod/inc/autodiscod.h')
-rw-r--r--polux/application/autodiscod/inc/autodiscod.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/polux/application/autodiscod/inc/autodiscod.h b/polux/application/autodiscod/inc/autodiscod.h
new file mode 100644
index 0000000000..cdfc2bba08
--- /dev/null
+++ b/polux/application/autodiscod/inc/autodiscod.h
@@ -0,0 +1,89 @@
+/*-----------------------------------------------------------------------------
+ File: autodiscod.h
+ Description: header file of daemon for autodiscovery protocol : run on EoCmaster;
+ Project: POLUX 3-10-03
+ Target: SPiDCOM modem w/ SPC200e-SPC200c
+ Version: 0.1
+ Revision list: -
+ Company: SPiDCOM
+ Author: Marie Rannou
+ Date: December 2009
+-----------------------------------------------------------------------------*/
+
+#ifndef AUTODISCOD_H
+#define AUTODISCOD_H
+
+#include "nvram.h"
+
+/* ---------------------- Frame size -----------------------*/
+#define AUTODISCO_FRAME_SIZE 72
+#define AUTODISCOD_HEADER_SIZE 16
+
+#define AUTODISCO_PAYLOAD_SIZE 56
+#define AUTODISCOD_MAC_STR_SIZE 18
+
+/*-------------------- Payload offsets ---------------------*/
+#define AUTODISCO_P_OFFSET_MANUFACTURE 0
+#define AUTODISCO_P_OFFSET_EQUIPMENT 17
+#define AUTODISCO_P_OFFSET_PRODUCT 20
+#define AUTODISCO_P_OFFSET_SOFT 32
+#define AUTODISCO_P_OFFSET_MIB 37
+#define AUTODISCO_P_OFFSET_IP 42
+#define AUTODISCO_P_OFFSET_MAC 48
+
+#define AUTODISCOD_HEADER_LEN_FIELD_OFFSET 14
+
+/* ---------------- Payload fields size ------------------*/
+#define AUTODISCO_P_SIZE_MANU 15
+#define AUTODISCO_P_SIZE_EQUIPMENT 1
+#define AUTODISCO_P_SIZE_PRODUCT 10
+#define AUTODISCO_P_SIZE_SOFT 3
+#define AUTODISCO_P_SIZE_MIB 3
+#define AUTODISCO_P_SIZE_IP 4
+#define AUTODISCO_P_SIZE_MAC 6
+
+
+#define SOFT_VERSION_PATH "/proc/sys/net/plc/software_version"
+#define AUTODISCOD_MIB_VERSION "207"
+#define AUTODISCOD_DEFAULT_INTERFACE "eth0"
+#define AUTODISCOD_ETHER_TYPE 0x88B7
+
+/* -----------Sending Period settings--------------*/
+#define MAX_PERIOD_SEC 65535
+#define DEFAULT_PERIOD_SEC 60
+
+
+/*------------------- interfaces ---------------*/
+#define INT_ETH "eth0"
+#define INT_PLC "plc0"
+
+/*----------------------included functions----------------*/
+extern int spidlib_get_current_ip_address( char *ip);
+extern int spidlib_ip_str_to_bin(const char *str, unsigned char *bin);
+extern int spidlib_get_mac(const char *iface, char *mac, int buffer_len);
+extern int spidlib_mac_str_to_bin(const char *str, unsigned char *bin);
+extern int spidlib_get_nvram(spidcom_nvram_t* nvram);
+extern int spidlib_get_software_version(char *software_version, int buffer_len);
+
+
+/*------------Autodiscovery ethernet payload ---------*/
+typedef struct
+{
+ unsigned char p_type;
+ unsigned char p_length;
+ unsigned char value[15];
+}autodisco_payload_elt_t;
+
+/* ------------- Equiments types ------------- */
+typedef enum{
+ EQUIP_MOCA = 1 ,
+ EQUIP_HOME_PLUG_BPL,
+ EQUIP_HOME_PLUG_AV,
+ EQUIP_HPNA,
+ EQUIP_WIFI,
+ EQUIP_EOC,
+ EQUIP_OTHER
+}equipment_type_t;
+
+#endif
+