Browse Source

minor fix

funshine 9 years ago
parent
commit
4332b21ef3
3 changed files with 44 additions and 4 deletions
  1. 9 1
      app/smart/smart.c
  2. 34 0
      app/smart/smart.h
  3. 1 3
      app/spiffs/spiffs_nucleus.h

+ 9 - 1
app/smart/smart.c

@@ -127,11 +127,19 @@ int smart_check(uint8_t *nibble, uint16_t len, uint8_t *dst, uint8_t *got){
   return res;
 }
 
-void detect(uint8 *buf, uint16 len){
+void detect(uint8 *arg, uint16 len){
   uint16_t seq;
   int16_t seq_delta = 0;
   uint16_t byte_num = 0, bit_num = 0;
   int16_t c = 0;
+  uint8 *buf = NULL;
+  if( len == 12 ){
+    return;
+  } else if (len >= 64){
+    buf = arg + sizeof(struct RxControl);
+  } else {
+    return;
+  }
   if( ( (buf[0]) & TYPE_SUBTYPE_MASK) != TYPE_SUBTYPE_QOS_DATA){
     return;
   }

+ 34 - 0
app/smart/smart.h

@@ -59,6 +59,40 @@ extern "C" {
 
 #define STATION_CHECK_TIME	(2*1000)
 
+struct RxControl{ 
+	signed rssi:8;//表示该包的信号强度
+    unsigned rate:4;
+    unsigned is_group:1;
+    unsigned:1;
+    unsigned sig_mode:2;//表示该包是否是11n 的包,0 表示非11n,非0 表示11n
+    unsigned legacy_length:12;//如果不是11n 的包,它表示包的长度
+    unsigned damatch0:1;
+    unsigned damatch1:1;
+    unsigned bssidmatch0:1;
+    unsigned bssidmatch1:1;
+    unsigned MCS:7;//如果是11n 的包,它表示包的调制编码序列,有效值:0-76
+    unsigned CWB:1;//如果是11n 的包,它表示是否为HT40 的包
+    unsigned HT_length:16;//如果是11n 的包,它表示包的长度
+    unsigned Smoothing:1;
+    unsigned Not_Sounding:1;
+    unsigned:1;
+    unsigned Aggregation:1;
+    unsigned STBC:2;
+    unsigned FEC_CODING:1;//如果是11n 的包,它表示是否为LDPC 的包
+    unsigned SGI:1;
+    unsigned rxend_state:8;
+    unsigned ampdu_cnt:8;
+    unsigned channel:4;//表示该包所在的信道
+    unsigned:12;
+};
+
+struct sniffer_buf{
+	struct RxControl rx_ctrl;	// 12-bytes
+	u8 buf[48];//包含ieee80211 包头
+	u16 cnt;//包的个数
+	u16 len[1];//包的长度
+};
+
 struct _my_addr_map {
 	uint8 addr[ADDR_LENGTH*3];
 	uint8_t addr_len;

+ 1 - 3
app/spiffs/spiffs_nucleus.h

@@ -395,13 +395,11 @@ typedef struct __attribute(( packed )) {
   // common page header
   spiffs_page_header p_hdr;
   // alignment
-  u8_t _align[4 - (sizeof(spiffs_page_header)&3)==0 ? 4 : (sizeof(spiffs_page_header)&3)];
+  u8_t _align[4 - ((sizeof(spiffs_page_header)+sizeof(spiffs_obj_type)+SPIFFS_OBJ_NAME_LEN)&3)==0 ? 4 : ((sizeof(spiffs_page_header)+sizeof(spiffs_obj_type)+SPIFFS_OBJ_NAME_LEN)&3)];
   // size of object
   u32_t size;
   // type of object
   spiffs_obj_type type;
-  // alignment2
-  u8_t _align2[4 - (sizeof(spiffs_obj_type)&3)==0 ? 4 : (sizeof(spiffs_obj_type)&3)];
   // name of object
   u8_t name[SPIFFS_OBJ_NAME_LEN];
 } spiffs_page_object_ix_header;