Work on data channel
This commit is contained in:
parent
1297c46a15
commit
ec6809b552
@ -509,7 +509,7 @@ void process_cw_data_packet (int index, struct sockaddr *addr, uint8_t * buffer,
|
|||||||
|
|
||||||
dataman_list_unlock();
|
dataman_list_unlock();
|
||||||
|
|
||||||
//dataman_add_packet (dm, buffer, len);
|
dataman_add_packet (dm, buffer, len);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -5,10 +5,12 @@
|
|||||||
#include "cw/timer.h"
|
#include "cw/timer.h"
|
||||||
#include "cw/cw.h"
|
#include "cw/cw.h"
|
||||||
#include "cw/format.h"
|
#include "cw/format.h"
|
||||||
#include "cw/netconn.h"
|
#include "cw/conn.h"
|
||||||
|
|
||||||
#include "cw/log.h"
|
#include "cw/log.h"
|
||||||
#include "cw/dbg.h"
|
#include "cw/dbg.h"
|
||||||
|
#include "cw/file.h"
|
||||||
|
#include "cw/dot11.h"
|
||||||
|
|
||||||
#include "wtplist.h"
|
#include "wtplist.h"
|
||||||
#include "dataman.h"
|
#include "dataman.h"
|
||||||
@ -19,8 +21,8 @@ pthread_mutex_t dataman_list_mutex;
|
|||||||
|
|
||||||
static int cmp(const void *d1, const void *d2)
|
static int cmp(const void *d1, const void *d2)
|
||||||
{
|
{
|
||||||
struct netconn *nc1 = ((struct dataman *) d1)->nc;
|
struct cw_Conn *nc1 = ((struct dataman *) d1)->nc;
|
||||||
struct netconn *nc2 = ((struct dataman *) d1)->nc;
|
struct cw_Conn *nc2 = ((struct dataman *) d1)->nc;
|
||||||
|
|
||||||
int r = nc1->sock - nc2->sock;
|
int r = nc1->sock - nc2->sock;
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
@ -52,7 +54,7 @@ void dataman_destroy(struct dataman *dm)
|
|||||||
{
|
{
|
||||||
if (!dm)
|
if (!dm)
|
||||||
return;
|
return;
|
||||||
netconn_destroy(dm->nc);
|
conn_destroy(dm->nc);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct dataman *dataman_create(int sock, struct sockaddr *addr)
|
struct dataman *dataman_create(int sock, struct sockaddr *addr)
|
||||||
@ -60,15 +62,15 @@ struct dataman *dataman_create(int sock, struct sockaddr *addr)
|
|||||||
struct dataman *dm = malloc(sizeof(struct dataman));
|
struct dataman *dm = malloc(sizeof(struct dataman));
|
||||||
if (!dm)
|
if (!dm)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
memset(dm,0,sizeof(struct dataman));
|
||||||
dm->nc = netconn_create(sock, addr, 100);
|
dm->nc = cw_conn_create(sock, addr, 100);
|
||||||
return dm;
|
return dm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct dataman *dataman_list_get(int sock, struct sockaddr *addr)
|
struct dataman *dataman_list_get(int sock, struct sockaddr *addr)
|
||||||
{
|
{
|
||||||
struct netconn search_nc;
|
struct cw_Conn search_nc;
|
||||||
struct dataman search_dm;
|
struct dataman search_dm;
|
||||||
|
|
||||||
search_nc.sock = sock;
|
search_nc.sock = sock;
|
||||||
@ -91,7 +93,7 @@ struct dataman *dataman_list_add(struct dataman *dm)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int dataman_process_keep_alive(struct netconn *nc, uint8_t *rawmsg, int len)
|
int dataman_process_keep_alive(struct cw_Conn *nc, uint8_t *rawmsg, int len)
|
||||||
{
|
{
|
||||||
struct dataman * dm = (struct dataman *)(nc->data);
|
struct dataman * dm = (struct dataman *)(nc->data);
|
||||||
|
|
||||||
@ -133,7 +135,7 @@ int dataman_process_keep_alive(struct netconn *nc, uint8_t *rawmsg, int len)
|
|||||||
printf("len len %d\n",l);
|
printf("len len %d\n",l);
|
||||||
printf("Total len = %d\n",total_len);
|
printf("Total len = %d\n",total_len);
|
||||||
|
|
||||||
netconn_send_capwap_msg(nc,buffer,total_len);
|
cw_send_msg(nc,buffer,total_len);
|
||||||
return len;
|
return len;
|
||||||
|
|
||||||
|
|
||||||
@ -167,26 +169,47 @@ int dataman_process_keep_alive(struct netconn *nc, uint8_t *rawmsg, int len)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dataman_process_message0(struct netconn *nc, uint8_t * rawmsg, int len,
|
int dataman_process_message0(struct cw_Conn *nc, uint8_t * rawmsg, int len,
|
||||||
struct sockaddr *from)
|
struct sockaddr *from)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
static int c=0;
|
||||||
|
char fn[100];
|
||||||
|
sprintf(fn,"wificap-%03d",c++);
|
||||||
|
/// cw_save_file(fn,(char*)rawmsg,len);
|
||||||
|
/// cw_dbg(DBG_X,"saving %d bytes",len);
|
||||||
|
|
||||||
|
uint8_t * dot11frame = rawmsg + cw_get_hdr_msg_offset(rawmsg);
|
||||||
|
|
||||||
|
cw_dbg(DBG_X,"802.11 - %s",dot11_get_frame_name(dot11frame));
|
||||||
|
|
||||||
/* The very first data message MUST be a keep-alive message */
|
/* The very first data message MUST be a keep-alive message */
|
||||||
if (!cw_get_hdr_flag_k(rawmsg)){
|
if (!cw_get_hdr_flag_k(rawmsg)){
|
||||||
|
|
||||||
|
cw_dbg(DBG_X,"No K Flag founde");
|
||||||
errno = EAGAIN;
|
errno = EAGAIN;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cw_dbg(DBG_X, "Goto Keep Alive Pack");
|
||||||
return dataman_process_keep_alive(nc,rawmsg,len);
|
return dataman_process_keep_alive(nc,rawmsg,len);
|
||||||
}
|
}
|
||||||
|
|
||||||
int dataman_process_message(struct netconn *nc, uint8_t * rawmsg, int len,
|
int dataman_process_message(struct cw_Conn *nc, uint8_t * rawmsg, int len,
|
||||||
struct sockaddr *from)
|
struct sockaddr *from)
|
||||||
{
|
{
|
||||||
if (cw_get_hdr_flag_k(rawmsg)){
|
if (cw_get_hdr_flag_k(rawmsg)){
|
||||||
return dataman_process_keep_alive(nc,rawmsg,len);
|
return dataman_process_keep_alive(nc,rawmsg,len);
|
||||||
}
|
}
|
||||||
|
static int c=0;
|
||||||
|
|
||||||
|
char fn[100];
|
||||||
|
sprintf(fn,"wificap-%03d",c++);
|
||||||
|
cw_save_file(fn,(char*)rawmsg,len);
|
||||||
|
|
||||||
|
|
||||||
cw_dbg(DBG_X,"There was someting else than dataman");
|
cw_dbg(DBG_X,"There was someting else than dataman");
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -195,12 +218,22 @@ void dataman_run(struct dataman *dm)
|
|||||||
{
|
{
|
||||||
time_t timer = cw_timer_start(2);
|
time_t timer = cw_timer_start(2);
|
||||||
|
|
||||||
dm->nc->process_packet=netconn_process_packet;
|
dm->nc->process_packet=conn_process_packet;
|
||||||
dm->nc->process_message=dataman_process_message0;
|
dm->nc->process_message=dataman_process_message0;
|
||||||
dm->nc->data = dm;
|
dm->nc->data = dm;
|
||||||
|
|
||||||
|
|
||||||
|
while (1){
|
||||||
|
time_t timer = cw_timer_start(2);
|
||||||
while (!cw_timer_timeout(timer)){
|
while (!cw_timer_timeout(timer)){
|
||||||
netconn_read_messages(dm->nc);
|
cw_read_messages(dm->nc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
while (!cw_timer_timeout(timer)){
|
||||||
|
cw_read_messages(dm->nc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dm->wtpman){
|
if (!dm->wtpman){
|
||||||
@ -215,7 +248,7 @@ void dataman_run(struct dataman *dm)
|
|||||||
while (1){
|
while (1){
|
||||||
time_t timer = cw_timer_start(2);
|
time_t timer = cw_timer_start(2);
|
||||||
while (!cw_timer_timeout(timer)){
|
while (!cw_timer_timeout(timer)){
|
||||||
netconn_read_messages(dm->nc);
|
cw_read_messages(dm->nc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,12 +3,11 @@
|
|||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
/*#include "cw/netconn.h"*/
|
|
||||||
|
|
||||||
#include "wtpman.h"
|
#include "wtpman.h"
|
||||||
|
|
||||||
struct dataman {
|
struct dataman {
|
||||||
struct netconn *nc;
|
struct cw_Conn *nc;
|
||||||
pthread_t thread;
|
pthread_t thread;
|
||||||
struct wtpman * wtpman;
|
struct wtpman * wtpman;
|
||||||
|
|
||||||
@ -28,6 +27,6 @@ extern pthread_mutex_t dataman_list_mutex;
|
|||||||
#define dataman_list_lock() pthread_mutex_lock(&dataman_list_mutex)
|
#define dataman_list_lock() pthread_mutex_lock(&dataman_list_mutex)
|
||||||
#define dataman_list_unlock() pthread_mutex_unlock(&dataman_list_mutex)
|
#define dataman_list_unlock() pthread_mutex_unlock(&dataman_list_mutex)
|
||||||
|
|
||||||
#define dataman_add_packet(dm,data,len) (netconn_q_add_packet(dm->nc,data,len))
|
#define dataman_add_packet(dm,data,len) (conn_q_add_packet(dm->nc,data,len))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -665,7 +665,13 @@ int cw_cfg_get_bool(cw_Cfg_t * cfg, const char * key, int def)
|
|||||||
return v.val.boolean;
|
return v.val.boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
int cw_cfg_set_bool(cw_Cfg_t * cfg, const char * key, int val)
|
||||||
|
{
|
||||||
|
return cw_cfg_set(cfg,key,val ? "true":"false");
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
uint8_t cw_cfg_get_byte(cw_Cfg_t * cfg, char *key, uint8_t def)
|
uint8_t cw_cfg_get_byte(cw_Cfg_t * cfg, char *key, uint8_t def)
|
||||||
{
|
{
|
||||||
struct cw_Val v;
|
struct cw_Val v;
|
||||||
|
@ -92,6 +92,8 @@ int cw_cfg_get_first_index_l(cw_Cfg_t ** cfgs, const char *key, int n);
|
|||||||
int cw_cfg_get_int(cw_Cfg_t * cfg, const char *key, int def);
|
int cw_cfg_get_int(cw_Cfg_t * cfg, const char *key, int def);
|
||||||
int cw_cfg_write_to_file(FILE *f, cw_Cfg_t * cfg);
|
int cw_cfg_write_to_file(FILE *f, cw_Cfg_t * cfg);
|
||||||
|
|
||||||
|
#define cw_cfg_set_bool(cfg,key,val) \
|
||||||
|
cw_cfg_set(cfg,key,(val) ? "true":"false")
|
||||||
|
|
||||||
|
|
||||||
int cw_cfg_set_val(cw_Cfg_t * cfg, const char *key, const struct cw_Type *t, const void * valguard, const uint8_t * data, int len);
|
int cw_cfg_set_val(cw_Cfg_t * cfg, const char *key, const struct cw_Type *t, const void * valguard, const uint8_t * data, int len);
|
||||||
|
@ -765,24 +765,22 @@ int conn_process_packet2(struct cw_Conn *conn, uint8_t * packet, int len,
|
|||||||
|
|
||||||
if (cw_get_hdr_flag_f(packet)) {
|
if (cw_get_hdr_flag_f(packet)) {
|
||||||
/* fragmented, add the packet to fragman */
|
/* fragmented, add the packet to fragman */
|
||||||
uint8_t *f;
|
uint8_t *f,*fp;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
f = fragman_add(conn->fragman, packet, offs, payloadlen);
|
fp = fragman_add(conn->fragman, packet, offs, payloadlen);
|
||||||
if (f == NULL) {
|
if (fp == NULL) {
|
||||||
errno = EAGAIN;
|
errno = EAGAIN;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
f =fp+MAX_PKT_HDR_LEN;
|
||||||
|
|
||||||
cw_dbg_pkt(DBG_PKT_IN, conn, f + 4, *(uint32_t *) f, from);
|
cw_dbg_pkt(DBG_PKT_IN, conn, fp, *(uint32_t *) f+MAX_PKT_HDR_LEN, from);
|
||||||
/*// cw_dbg_msg(DBG_MSG_IN, conn, f + 4, *(uint32_t *) f, from);*/
|
|
||||||
|
|
||||||
/* // XXX: Modify fragman to not throw away CAPWAP headers*/
|
|
||||||
|
|
||||||
rc = conn->process_message(conn, f + 4, *(uint32_t *) f, from);
|
rc = conn->process_message(conn, f + 4, *(uint32_t *) f, from);
|
||||||
|
|
||||||
free(f);
|
free(fp);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#include "val.h"
|
#include "val.h"
|
||||||
|
#include "cfg.h"
|
||||||
|
#include "dbg.h"
|
||||||
|
|
||||||
static int get_len(const struct cw_ValBit *bits)
|
static int get_len(const struct cw_ValBit *bits)
|
||||||
{
|
{
|
||||||
@ -16,15 +18,28 @@ static int get_bit(const uint8_t * src,int pos, int len)
|
|||||||
return src[b]&m ? 1:0;
|
return src[b]&m ? 1:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void set_bit(uint8_t * dst,int pos, int len,int val)
|
||||||
|
{
|
||||||
|
int b;
|
||||||
|
uint8_t m;
|
||||||
|
cw_dbg(DBG_X,"set bit val %d",val);
|
||||||
|
if (!val)
|
||||||
|
return;
|
||||||
|
b = len-1-pos/8;
|
||||||
|
m = 1<<(pos%8);
|
||||||
|
dst[b]|=m;
|
||||||
|
}
|
||||||
|
|
||||||
static int bread(cw_Cfg_t *cfg, const char * key, const uint8_t *src, int len, const void *param)
|
static int bread(cw_Cfg_t *cfg, const char * key, const uint8_t *src, int len, const void *param)
|
||||||
{
|
{
|
||||||
|
char skey[CW_CFG_MAX_KEY_LEN];
|
||||||
const struct cw_ValBit * bits=param;
|
const struct cw_ValBit * bits=param;
|
||||||
int l,i;
|
int l,i;
|
||||||
|
|
||||||
l = get_len(bits);
|
l = get_len(bits);
|
||||||
for(i=0;bits[i].key!=NULL;i++){
|
for(i=0;bits[i].key!=NULL;i++){
|
||||||
int rc;
|
sprintf(skey,"%s/%s",key,bits[i].key);
|
||||||
printf("%s: %d\n",bits[i].key,get_bit(src,bits[i].bit,l));
|
cw_cfg_set_bool(cfg,skey,get_bit(src,bits[i].bit,l));
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -32,9 +47,24 @@ static int bread(cw_Cfg_t *cfg, const char * key, const uint8_t *src, int len, c
|
|||||||
|
|
||||||
static int bwrite(cw_Cfg_t ** cfgs, const char *key, uint8_t *dst, const void * param)
|
static int bwrite(cw_Cfg_t ** cfgs, const char *key, uint8_t *dst, const void * param)
|
||||||
{
|
{
|
||||||
return 0;
|
int l,i;
|
||||||
|
char skey[CW_CFG_MAX_KEY_LEN];
|
||||||
|
const struct cw_ValBit * bits=param;
|
||||||
|
l = get_len(bits);
|
||||||
|
memset(dst,0,l);
|
||||||
|
for(i=0;bits[i].key!=NULL;i++){
|
||||||
|
uint8_t val;
|
||||||
|
int rc;
|
||||||
|
val=0;
|
||||||
|
sprintf(skey,"%s/%s",key,bits[i].key);
|
||||||
|
rc = CW_TYPE_BOOL->write(cfgs, skey, &val, NULL);
|
||||||
|
if (rc<0)
|
||||||
|
val=0;
|
||||||
|
cw_dbg(DBG_X,"%s (rc: %d)",skey,rc);
|
||||||
|
set_bit(dst,bits[i].bit,l,val);
|
||||||
|
}
|
||||||
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const struct cw_Type cw_type_bits = {
|
const struct cw_Type cw_type_bits = {
|
||||||
|
@ -38,3 +38,25 @@ const char * dot11_type_strings[]=
|
|||||||
"Probe Req",
|
"Probe Req",
|
||||||
"Probe Resp"
|
"Probe Resp"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct dot11_name{
|
||||||
|
uint8_t val;
|
||||||
|
const char * str;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cw_StrListElem dot11_names[]={
|
||||||
|
{DOT11_ASSOC_REQ, "Assoc Req"},
|
||||||
|
{DOT11_ASSOC_RESP, "Assoc Resp"},
|
||||||
|
{DOT11_REASSOC_REQ, "Reassoc Req"},
|
||||||
|
{DOT11_REASSOC_RESP, "Reassoc Resp"},
|
||||||
|
{DOT11_PROBE_REQ, "Probe Req"},
|
||||||
|
{DOT11_PROBE_RESP, "Probe Resp"},
|
||||||
|
{DOT11_TIMING_ADV, "Timing Adv"},
|
||||||
|
{DOT11_MGM_RES111, "MGMRES111"},
|
||||||
|
{DOT11_BEACON, "Beacon"},
|
||||||
|
{CW_STR_STOP,"Unknown"},
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <endian.h>
|
#include <endian.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "strlist.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup DOT11_FRAME_TYPES Frame Types
|
* @defgroup DOT11_FRAME_TYPES Frame Types
|
||||||
@ -47,17 +48,17 @@
|
|||||||
*
|
*
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define DOT11_FC_ASSOC_REQ dot11_fc_mgm(0b0000)
|
#define DOT11_ASSOC_REQ dot11_fc_mgm(0b0000)
|
||||||
#define DOT11_FC_ASSOC_RESP dot11_fc_mgm(0b0001)
|
#define DOT11_ASSOC_RESP dot11_fc_mgm(0b0001)
|
||||||
#define DOT11_FC_REASSOC_REQ dot11_fc_mgm(0b0010)
|
#define DOT11_REASSOC_REQ dot11_fc_mgm(0b0010)
|
||||||
#define DOT11_FC_REASSOC_RESP dot11_fc_mgm(0b0011)
|
#define DOT11_REASSOC_RESP dot11_fc_mgm(0b0011)
|
||||||
#define DOT11_FC_PROBE_REQ dot11_fc_mgm(0b0100)
|
#define DOT11_PROBE_REQ dot11_fc_mgm(0b0100)
|
||||||
#define DOT11_FC_PROBE_RESP dot11_fc_mgm(0b0101)
|
#define DOT11_PROBE_RESP dot11_fc_mgm(0b0101)
|
||||||
#define DOT11_FC_TIMING_ADV dot11_fc_mgm(0b0110)
|
#define DOT11_TIMING_ADV dot11_fc_mgm(0b0110)
|
||||||
#define DOT11_FC_MGM_RES111 dot11_fc_mgm(0b0111)
|
#define DOT11_MGM_RES111 dot11_fc_mgm(0b0111)
|
||||||
#define DOT11_FC_BEACON dot11_fc_mgm(0b1000)
|
#define DOT11_BEACON dot11_fc_mgm(0b1000)
|
||||||
|
|
||||||
#define DOT11_FC_DATA dot11_fc_dta(0b0000)
|
#define DOT11_DATA dot11_fc_dta(0b0000)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
@ -125,9 +126,9 @@ extern const uint8_t dot11_tab_br[256];
|
|||||||
|
|
||||||
#define dot11_get_byte(ptr) (*(ptr))
|
#define dot11_get_byte(ptr) (*(ptr))
|
||||||
|
|
||||||
#define dot11_put_byte(ptr,b) (*(ptr) = b)
|
#define dot11_put_byte(ptr,b) (*(ptr) = b,1)
|
||||||
#define dot11_put_word(dst,v) ((*((uint16_t*)(dst))=htobe16(v)),2)
|
#define dot11_put_word(dst,v) ((*((uint16_t*)(dst))=htobe16(v)),2)
|
||||||
#define dot11_put_dword(dst,v) ((*((uint16_t*)(dst))=htobe16(v)),4)
|
#define dot11_put_dword(dst,v) ((*((uint32_t*)(dst))=htobe32(v)),4)
|
||||||
#define dot11_put_qword(dst,v) ((*((uint64_t*)(dst))=htobe64(v)),8)
|
#define dot11_put_qword(dst,v) ((*((uint64_t*)(dst))=htobe64(v)),8)
|
||||||
|
|
||||||
|
|
||||||
@ -135,9 +136,11 @@ uint16_t dot11_get_word(uint8_t * ptr);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define dot11_get_version(frame) ((frame[1])&0x03)
|
#define cw_dot11_get_version(frame) ( (frame)[1] & 0x03)
|
||||||
#define dot11_get_type(frame) (((frame[1])&0x0c) >> 2)
|
#define cw_dot11_get_type(frame) ( ((frame)[1] & 0x0c) >> 2)
|
||||||
#define dot11_get_subtype(frame) (((frame[1])&0xf0) >> 4)
|
#define cw_dot11_get_subtype(frame) ( (frame)[1] >> 4 )
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Frame Control field
|
* Get Frame Control field
|
||||||
* @param frame
|
* @param frame
|
||||||
@ -235,6 +238,9 @@ extern uint8_t dot11_broadcast_address[6];
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
extern struct cw_StrListElem dot11_names[];
|
||||||
|
|
||||||
|
#define dot11_get_frame_name(data) cw_strlist_get_str(dot11_names,(data)[1])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,7 +85,26 @@ static cw_ValValRange_t mac_types[]={
|
|||||||
{0,0,NULL}
|
{0,0,NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
struct cw_ValBit xx[] = {
|
||||||
|
{0,"ess"},
|
||||||
|
{1,"ibss"},
|
||||||
|
{2,"cf-pollable"},
|
||||||
|
{3,"cf-poll-request"},
|
||||||
|
{4,"privacy"},
|
||||||
|
{5,"short-preamble"},
|
||||||
|
{2,"pbcc"},
|
||||||
|
{3,"cf-poll-request"},
|
||||||
|
{2,NULL}
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
struct cw_ValBit frame_tunnel_bits[] = {
|
||||||
|
{3,"native"},
|
||||||
|
{2,"802-3"},
|
||||||
|
{1,"local-bridging"},
|
||||||
|
{0,"reserved"},
|
||||||
|
{1, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static cw_ValStruct_t radio_admin_state[] = {
|
static cw_ValStruct_t radio_admin_state[] = {
|
||||||
@ -151,10 +170,13 @@ static struct cw_ElemHandler handlers[] = {
|
|||||||
CAPWAP_ELEM_WTP_FRAME_TUNNEL_MODE, /* Element ID */
|
CAPWAP_ELEM_WTP_FRAME_TUNNEL_MODE, /* Element ID */
|
||||||
0,0, /* Vendor / Proto */
|
0,0, /* Vendor / Proto */
|
||||||
1,1, /* min/max length */
|
1,1, /* min/max length */
|
||||||
CW_TYPE_BYTE, /* type */
|
CW_TYPE_BITS, /* type */
|
||||||
"capwap/wtp-frame-tunnel-mode", /* Key */
|
"capwap/wtp-frame-tunnel-mode", /* Key */
|
||||||
cw_in_generic, /* get */
|
cw_in_generic, /* get */
|
||||||
cw_out_generic /* put */
|
cw_out_generic, /* put */
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
frame_tunnel_bits
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
|
@ -48,6 +48,16 @@ int cisco_out_radio_info(struct cw_ElemHandler * handler, struct cw_ElemHandlerP
|
|||||||
, uint8_t * dst);
|
, uint8_t * dst);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
struct cw_ValBit frame_tunnel_bits_draft7[] = {
|
||||||
|
{2,"native"},
|
||||||
|
{1,"802-3"},
|
||||||
|
{0,"local-bridging"},
|
||||||
|
{1, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static cw_ValValRange_t cfg_type[]={
|
static cw_ValValRange_t cfg_type[]={
|
||||||
{1,1,"1 - global"},
|
{1,1,"1 - global"},
|
||||||
{2,2,"2 - custom"},
|
{2,2,"2 - custom"},
|
||||||
@ -957,6 +967,20 @@ static int cisco_data(struct cw_ElemHandler *eh,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static struct cw_ElemHandler handlers70[] = {
|
static struct cw_ElemHandler handlers70[] = {
|
||||||
|
{
|
||||||
|
"WTP Frame Tunnel Mode (Draft 7)", /* name */
|
||||||
|
CAPWAP_ELEM_WTP_FRAME_TUNNEL_MODE, /* Element ID */
|
||||||
|
0,0, /* Vendor / Proto */
|
||||||
|
1,1, /* min/max length */
|
||||||
|
CW_TYPE_BITS, /* type */
|
||||||
|
"capwap/wtp-frame-tunnel-mode", /* Key */
|
||||||
|
cw_in_generic, /* get */
|
||||||
|
cw_out_generic, /* put */
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
frame_tunnel_bits_draft7
|
||||||
|
}
|
||||||
|
,
|
||||||
|
|
||||||
{
|
{
|
||||||
"AC Name - (zero-length allowed)", /* name */
|
"AC Name - (zero-length allowed)", /* name */
|
||||||
|
@ -322,6 +322,9 @@ struct beacon_data{
|
|||||||
int dot11_get_beacon_data(struct apdata *ap,struct beacon_data *bd);
|
int dot11_get_beacon_data(struct apdata *ap,struct beacon_data *bd);
|
||||||
|
|
||||||
|
|
||||||
|
#define cw_dot11_get_version(frame) ( (frame)[1] & 3)
|
||||||
|
#define cw_dot11_get_type(frame) ( ( (frame)[1] & 0x0c) >> 2)
|
||||||
|
#define cw_dot11_get_subtype(frame) ( (frame)[1] >> 4)
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
\
|
|
||||||
|
|
||||||
#include "cw/val.h"
|
#include "cw/val.h"
|
||||||
#include "cw/dbg.h"
|
#include "cw/dbg.h"
|
||||||
@ -88,6 +88,40 @@ static int parse_args (int argc, char *argv[], struct bootcfg * bootcfg)
|
|||||||
struct bootcfg bootcfg;
|
struct bootcfg bootcfg;
|
||||||
|
|
||||||
|
|
||||||
|
#include "cw/file.h"
|
||||||
|
#include <libwifi.h>
|
||||||
|
|
||||||
|
#include "cw/dot11.h"
|
||||||
|
|
||||||
|
int test()
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
char *f;
|
||||||
|
size_t len;
|
||||||
|
f=cw_load_file("wificap-005",&len);
|
||||||
|
cw_dbg(DBG_X, "Loaded %d bytes",len);
|
||||||
|
|
||||||
|
// static int got_radiotap = 0;
|
||||||
|
// struct libwifi_frame frame = {0};
|
||||||
|
// rc = libwifi_get_wifi_frame(&frame, (unsigned char*)(f+16), len-16, got_radiotap);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// if (rc != 0) {
|
||||||
|
// printf("[!] Error getting libwifi_frame: %d\n", rc);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// cw_dbg(DBG_X,"Frame CTL:%d,%d",frame.frame_control.type, frame.frame_control.subtype);
|
||||||
|
|
||||||
|
cw_dbg(DBG_X,"MY RESULT: Type %d, SubType %d",cw_dot11_get_type(f+16), cw_dot11_get_subtype(f+16));
|
||||||
|
cw_dbg(DBG_X,"FRAME: %s",dot11_get_frame_name(f+16+1));
|
||||||
|
|
||||||
|
free(f);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main (int argc, char **argv)
|
int main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct cw_Mod * mod;
|
struct cw_Mod * mod;
|
||||||
@ -102,6 +136,7 @@ int main (int argc, char **argv)
|
|||||||
const char *bind_addr, *disc_addr;
|
const char *bind_addr, *disc_addr;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -135,6 +170,10 @@ int main (int argc, char **argv)
|
|||||||
bootcfg.nmods=2;
|
bootcfg.nmods=2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// test();
|
||||||
|
// stop();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* set ths for production
|
* set ths for production
|
||||||
* cw_dbg_set_level(DBG_X,0);
|
* cw_dbg_set_level(DBG_X,0);
|
||||||
|
Loading…
Reference in New Issue
Block a user