handlers for header_len and write_headr in conn
FossilOrigin-Name: 672de93a2c0d038b6d8c9104a8e0b4fdacbe7f181485ee2f185cb81626876391
This commit is contained in:
parent
ad07cbcf1c
commit
7bedc7659b
@ -283,6 +283,7 @@
|
|||||||
<File Name="src/cw/cw_detect_nat.c"/>
|
<File Name="src/cw/cw_detect_nat.c"/>
|
||||||
<File Name="src/cw/cw_in_generic_enum.c"/>
|
<File Name="src/cw/cw_in_generic_enum.c"/>
|
||||||
<File Name="src/cw/cw_in_radio_generic_struct.c"/>
|
<File Name="src/cw/cw_in_radio_generic_struct.c"/>
|
||||||
|
<File Name="src/cw/cw_write_header.c"/>
|
||||||
</VirtualDirectory>
|
</VirtualDirectory>
|
||||||
</VirtualDirectory>
|
</VirtualDirectory>
|
||||||
<Description/>
|
<Description/>
|
||||||
|
@ -17,10 +17,11 @@ capwap/ac-descriptor/hardware/vendor:Bstr16: 12346
|
|||||||
#ac-descriptor/station-limit :Word: 1000
|
#ac-descriptor/station-limit :Word: 1000
|
||||||
#ac-descriptor/stations :Word: 0
|
#ac-descriptor/stations :Word: 0
|
||||||
|
|
||||||
ac-descriptor/dtls-policy :Byte: 0
|
ac-descriptor/dtls-policy :Byte: 1
|
||||||
ac-descriptor/hardware/vendor :Dword: 4232704
|
ac-descriptor/hardware/vendor :Dword: 4232704
|
||||||
ac-descriptor/hardware/version :Bstr16: .x01000001
|
ac-descriptor/hardware/version :Bstr16: .x01000001
|
||||||
ac-descriptor/max-wtps :Word: 200
|
ac-descriptor/max-wtps :Word: 200
|
||||||
|
ac-descriptor/active-wtps: Word: 2
|
||||||
ac-descriptor/r-mac-field :Byte: 1
|
ac-descriptor/r-mac-field :Byte: 1
|
||||||
ac-descriptor/reserved1 :Byte: 0
|
ac-descriptor/reserved1 :Byte: 0
|
||||||
ac-descriptor/security :Byte: 2
|
ac-descriptor/security :Byte: 2
|
||||||
@ -30,11 +31,7 @@ ac-descriptor/station-limit :Word: 1000
|
|||||||
ac-descriptor/stations :Word: 0
|
ac-descriptor/stations :Word: 0
|
||||||
ac-name :Bstr16: CiscoAC73
|
ac-name :Bstr16: CiscoAC73
|
||||||
capwap-control-ip-address/address.0 :IPAddress: 192.168.0.14
|
capwap-control-ip-address/address.0 :IPAddress: 192.168.0.14
|
||||||
capwap-control-ip-address/address.1 :IPAddress: d96c:4c0a:da6c:4c0a:db6c:4c0a:dc6c:4c0a
|
|
||||||
capwap-control-ip-address/address.2 :IPAddress: 192.168.0.14
|
|
||||||
capwap-control-ip-address/wtps.0 :Word: 2
|
capwap-control-ip-address/wtps.0 :Word: 2
|
||||||
capwap-control-ip-address/wtps.1 :Word: 10
|
|
||||||
capwap-control-ip-address/wtps.2 :Word: 2
|
|
||||||
cisco/mwar-type :Byte: 0
|
cisco/mwar-type :Byte: 0
|
||||||
maximum-message-length :Word: 4096
|
maximum-message-length :Word: 4096
|
||||||
radio/0/wtp-radio-information :Dword: 7
|
radio/0/wtp-radio-information :Dword: 7
|
||||||
@ -54,7 +51,8 @@ capwap-control-ip-address/wtps.0:Word:0
|
|||||||
|
|
||||||
cisco/ssl-keyfile:Str:"../../ssl/certs/ac-cisco.key"
|
cisco/ssl-keyfile:Str:"../../ssl/certs/ac-cisco.key"
|
||||||
cisco/ssl-certfile:Str:"../../ssl/certs/ac-cisco.pem"
|
cisco/ssl-certfile:Str:"../../ssl/certs/ac-cisco.pem"
|
||||||
cisco/ssl-cipher:Str:+DHE-RSA:+AES-256-CBC:+AES-128-CBC:+SHA1:+PSK
|
cisco/ssl-cipher:Str:NORMAL
|
||||||
|
#+DHE-RSA:+AES-256-CBC:+AES-128-CBC:+SHA1:+PSK
|
||||||
cisco/ssl-dhbits:Word:2048
|
cisco/ssl-dhbits:Word:2048
|
||||||
|
|
||||||
capwap/ssl-cipher:Str:+DHE-RSA:+RSA:+AES-256-CBC:+AES-128-CBC:+SHA1:+PSK
|
capwap/ssl-cipher:Str:+DHE-RSA:+RSA:+AES-256-CBC:+AES-128-CBC:+SHA1:+PSK
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
|
|
||||||
#include "intavltree.h"
|
#include "intavltree.h"
|
||||||
#include "bstr.h"
|
#include "bstr.h"
|
||||||
|
#include "msgset.h"
|
||||||
|
|
||||||
#include "mod.h"
|
#include "mod.h"
|
||||||
|
|
||||||
@ -75,7 +76,8 @@ struct conn {
|
|||||||
mavl_t local_cfg;
|
mavl_t local_cfg;
|
||||||
mavl_t global_cfg;
|
mavl_t global_cfg;
|
||||||
|
|
||||||
|
int (*write_header)(struct cw_ElemHandler * handler, uint8_t * dst, int len);
|
||||||
|
int (*header_len)(struct cw_ElemHandler *handler);
|
||||||
|
|
||||||
/* mbag_t outgoing;
|
/* mbag_t outgoing;
|
||||||
mbag_t incomming;
|
mbag_t incomming;
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
#include "conn.h"
|
#include "conn.h"
|
||||||
#include "sock.h"
|
#include "sock.h"
|
||||||
|
|
||||||
|
#include "msgset.h"
|
||||||
|
#include "cw.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,6 +27,21 @@
|
|||||||
|
|
||||||
#include "conn.h"
|
#include "conn.h"
|
||||||
#include "capwap.h"
|
#include "capwap.h"
|
||||||
|
#include "cw.h"
|
||||||
|
|
||||||
|
static int write_header(struct cw_ElemHandler * handler, uint8_t * dst, int len)
|
||||||
|
{
|
||||||
|
if (handler->vendor)
|
||||||
|
return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len);
|
||||||
|
|
||||||
|
return len + cw_put_elem_hdr(dst, handler->id, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int header_len(struct cw_ElemHandler * handler)
|
||||||
|
{
|
||||||
|
return handler->vendor ? 10 : 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic initialization of a conn object
|
* Basic initialization of a conn object
|
||||||
@ -48,7 +63,8 @@ void conn_init(struct conn * conn)
|
|||||||
conn->process_packet=conn_process_packet;
|
conn->process_packet=conn_process_packet;
|
||||||
conn->process_message=process_message;
|
conn->process_message=process_message;
|
||||||
|
|
||||||
|
conn->write_header = write_header;
|
||||||
|
conn->header_len = header_len;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,11 +21,12 @@ int cw_ktv_write_struct(mavl_t ktv, const cw_KTVStruct_t * stru, const char *pke
|
|||||||
result = cw_ktv_get(ktv,key,stru[i].type);
|
result = cw_ktv_get(ktv,key,stru[i].type);
|
||||||
|
|
||||||
if (result == NULL){
|
if (result == NULL){
|
||||||
cw_log(LOG_ERR,"Can't put %s, no value found",key);
|
cw_log(LOG_ERR,"Can't put %s, no value found, filling zero.",key);
|
||||||
continue;
|
memset(dst+pos,0,stru[i].len);
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
result->type->put(result,dst+pos);
|
result->type->put(result,dst+pos);
|
||||||
|
}
|
||||||
|
|
||||||
pos+=stru[i].len;
|
pos+=stru[i].len;
|
||||||
|
|
||||||
|
@ -44,17 +44,21 @@ int cw_out_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams
|
|||||||
|
|
||||||
/* Size for msg elem header depends on
|
/* Size for msg elem header depends on
|
||||||
vendor specific payload */
|
vendor specific payload */
|
||||||
start = handler->vendor ? 10 : 4;
|
/* start = handler->vendor ? 10 : 4; */
|
||||||
|
start = params->conn->header_len(handler);
|
||||||
|
|
||||||
len = ((const cw_Type_t*)(handler->type))->put(elem,dst+start);
|
len = ((const cw_Type_t*)(handler->type))->put(elem,dst+start);
|
||||||
|
|
||||||
/* ((const cw_Type_t*)(handler->type))->to_str(elem,detail,120);
|
/* ((const cw_Type_t*)(handler->type))->to_str(elem,detail,120);
|
||||||
sprintf(params->debug_details, " Value = %s", detail);
|
sprintf(params->debug_details, " Value = %s", detail);
|
||||||
params->elem = elem;*/
|
params->elem = elem;*/
|
||||||
|
|
||||||
if (handler->vendor)
|
/* if (handler->vendor)
|
||||||
return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len);
|
return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len);
|
||||||
|
|
||||||
l = len + cw_put_elem_hdr(dst, handler->id, len);
|
l = len + cw_put_elem_hdr(dst, handler->id, len); */
|
||||||
|
l = params->conn->write_header(handler,dst,len);
|
||||||
|
|
||||||
cw_dbg_elem(DBG_ELEM_OUT,params->conn,params->msgdata->type,handler,dst,l);
|
cw_dbg_elem(DBG_ELEM_OUT,params->conn,params->msgdata->type,handler,dst,l);
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
@ -10,20 +10,25 @@ int cw_out_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHandler
|
|||||||
int start;
|
int start;
|
||||||
int len,l;
|
int len,l;
|
||||||
|
|
||||||
start = handler->vendor ? 10 : 4;
|
|
||||||
|
|
||||||
if (!handler->type){
|
if (!handler->type){
|
||||||
cw_log(LOG_ERR,"Can't handle element: %s, no type defined",handler->name);
|
cw_log(LOG_ERR,"Can't handle element: %s, no type defined",handler->name);
|
||||||
return CAPWAP_RESULT_UNRECOGNIZED_MESSAGE_ELEMENT;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
start = params->conn->header_len(handler);
|
||||||
|
|
||||||
|
|
||||||
len = cw_ktv_write_struct(params->conn->local_cfg,handler->type,handler->key,dst+start);
|
len = cw_ktv_write_struct(params->conn->local_cfg,handler->type,handler->key,dst+start);
|
||||||
|
|
||||||
if (handler->vendor)
|
return params->conn->write_header(handler,dst,len);
|
||||||
|
|
||||||
|
/* if (handler->vendor)
|
||||||
return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len);
|
return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len);
|
||||||
|
|
||||||
l = len + cw_put_elem_hdr(dst, handler->id, len);
|
l = len + cw_put_elem_hdr(dst, handler->id, len);
|
||||||
|
*/
|
||||||
return l;
|
return l;
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ cw_KTVStruct_t acstatus [] = {
|
|||||||
/* type key len, pos */
|
/* type key len, pos */
|
||||||
{CW_TYPE_WORD, "stations", 2, -1},
|
{CW_TYPE_WORD, "stations", 2, -1},
|
||||||
{CW_TYPE_WORD, "station-limit", 2, -1},
|
{CW_TYPE_WORD, "station-limit", 2, -1},
|
||||||
{CW_TYPE_WORD, "avtive-wtps", 2, -1},
|
{CW_TYPE_WORD, "active-wtps", 2, -1},
|
||||||
{CW_TYPE_WORD, "max-wtps", 2, -1},
|
{CW_TYPE_WORD, "max-wtps", 2, -1},
|
||||||
{CW_TYPE_BYTE, "security", 1, -1},
|
{CW_TYPE_BYTE, "security", 1, -1},
|
||||||
{CW_TYPE_BYTE, "r-mac-field", 1, -1},
|
{CW_TYPE_BYTE, "r-mac-field", 1, -1},
|
||||||
|
12
src/cw/cw_write_header.c
Normal file
12
src/cw/cw_write_header.c
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
#include "msgset.h"
|
||||||
|
#include "cw.h"
|
||||||
|
|
||||||
|
int cw_write_header(struct cw_ElemHandler * handler, uint8_t * dst, int len)
|
||||||
|
{
|
||||||
|
if (handler->vendor)
|
||||||
|
return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len);
|
||||||
|
|
||||||
|
return len + cw_put_elem_hdr(dst, handler->id, len);
|
||||||
|
}
|
||||||
|
|
@ -35,7 +35,7 @@ static cw_KTVStruct_t wtp_reboot_statistics[] = {
|
|||||||
{CW_TYPE_WORD, "hw-failure-count", 2,-1},
|
{CW_TYPE_WORD, "hw-failure-count", 2,-1},
|
||||||
{CW_TYPE_WORD, "other-failure-count", 2,-1},
|
{CW_TYPE_WORD, "other-failure-count", 2,-1},
|
||||||
{CW_TYPE_WORD, "unknown-failure-count", 2,-1},
|
{CW_TYPE_WORD, "unknown-failure-count", 2,-1},
|
||||||
{CW_TYPE_WORD, "last-failure-type", 2,-1},
|
{CW_TYPE_BYTE, "last-failure-type", 1,-1},
|
||||||
{NULL,NULL,0,0}
|
{NULL,NULL,0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
#define CW_CISCO_AP_MODEL 127
|
#define CW_CISCO_AP_MODEL 127
|
||||||
#define CW_CISCO_AP_RESET_BUTTON_STATE 128
|
#define CW_CISCO_AP_RESET_BUTTON_STATE 128
|
||||||
|
|
||||||
#define CW_CISCO_AP_REGULATORY_DOMAIN 126
|
#define CISCO_ELEM_AP_REGULATORY_DOMAIN 126
|
||||||
|
|
||||||
#define CW_CISCO_LWAPP_CHANNEL_POWER 134
|
#define CW_CISCO_LWAPP_CHANNEL_POWER 134
|
||||||
#define CW_CISCO_AP_CORE_DUMP 135
|
#define CW_CISCO_AP_CORE_DUMP 135
|
||||||
|
@ -122,6 +122,14 @@ static cw_KTVStruct_t cisco_ap_static_ip_addr[]={
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static cw_KTVStruct_t cisco_ap_regulatory_domain[]={
|
||||||
|
{CW_TYPE_BOOL,"set",1,-1},
|
||||||
|
{CW_TYPE_BYTE,"slot",1,-1},
|
||||||
|
{CW_TYPE_BYTE,"code0",1,-1},
|
||||||
|
{CW_TYPE_BYTE,"code1",1,-1},
|
||||||
|
{NULL,NULL,0,0}
|
||||||
|
};
|
||||||
|
|
||||||
static struct cw_ElemHandler handlers[] = {
|
static struct cw_ElemHandler handlers[] = {
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -473,6 +481,30 @@ static struct cw_ElemHandler handlers[] = {
|
|||||||
cw_out_generic /* put */
|
cw_out_generic /* put */
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"AP Ethernet Port Type", /* name */
|
||||||
|
CISCO_LWELEM_AP_ETHERNET_PORT_SUBTYPE, /* Element ID */
|
||||||
|
CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP, /* Vendor / Proto */
|
||||||
|
3,3, /* min/max length */
|
||||||
|
CW_TYPE_BSTR16, /* type */
|
||||||
|
"cisco/ap-ethernet-port-type", /* Key */
|
||||||
|
cw_in_generic, /* get */
|
||||||
|
cw_out_generic /* put */
|
||||||
|
},
|
||||||
|
|
||||||
|
{ /* it's wrong to store the reg domain in radio/xy/...
|
||||||
|
and has to be corected in the future */
|
||||||
|
|
||||||
|
"AP Regulatory Domain", /* name */
|
||||||
|
CISCO_ELEM_AP_REGULATORY_DOMAIN, /* Element ID */
|
||||||
|
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
|
||||||
|
5,5, /* min/max length */
|
||||||
|
cisco_ap_regulatory_domain, /* type */
|
||||||
|
"cisco/regulatory-domain", /* Key */
|
||||||
|
cw_in_radio_generic_struct, /* get */
|
||||||
|
NULL /* put */
|
||||||
|
},
|
||||||
|
|
||||||
{0,0,0,0,0,0,0,0}
|
{0,0,0,0,0,0,0,0}
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -520,8 +552,10 @@ static struct cw_ElemDef join_request_elements[] ={
|
|||||||
|
|
||||||
static int join_response_states[] = {CAPWAP_STATE_JOIN,0};
|
static int join_response_states[] = {CAPWAP_STATE_JOIN,0};
|
||||||
static struct cw_ElemDef join_response_elements[] ={
|
static struct cw_ElemDef join_response_elements[] ={
|
||||||
{0,CW_VENDOR_ID_CISCO, CISCO_ELEM_SPAM_VENDOR_SPECIFIC,0, CW_IGNORE},
|
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_SPAM_VENDOR_SPECIFIC,0, CW_IGNORE},
|
||||||
|
|
||||||
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_PATH_MTU, 0, 0},
|
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_PATH_MTU, 0, 0},
|
||||||
|
|
||||||
{0,0, CAPWAP_ELEM_ECN_SUPPORT, 0, CW_DELETE},
|
{0,0, CAPWAP_ELEM_ECN_SUPPORT, 0, CW_DELETE},
|
||||||
|
|
||||||
{0,0,0,00}
|
{0,0,0,00}
|
||||||
@ -545,11 +579,13 @@ static struct cw_ElemDef configuration_status_request_elements[] ={
|
|||||||
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_STATIC_IP_ADDR, 0, 0},
|
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_STATIC_IP_ADDR, 0, 0},
|
||||||
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_MIN_IOS_VERSION, 0, 0},
|
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_MIN_IOS_VERSION, 0, 0},
|
||||||
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_BACKUP_SOFTWARE_VERSION, 0, 0},
|
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_BACKUP_SOFTWARE_VERSION, 0, 0},
|
||||||
|
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_REGULATORY_DOMAIN, 1, 0},
|
||||||
|
|
||||||
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_USERNAME_PASSWORD, 1, 0},
|
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_USERNAME_PASSWORD, 1, 0},
|
||||||
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_LOGHOST_CONFIG, 1, 0},
|
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_LOGHOST_CONFIG, 1, 0},
|
||||||
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_TELNET_SSH, 1, 0},
|
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_TELNET_SSH, 1, 0},
|
||||||
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_SUBMODE, 1, 0},
|
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_SUBMODE, 1, 0},
|
||||||
|
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_ETHERNET_PORT_SUBTYPE, 1, 0},
|
||||||
|
|
||||||
{0,0,0,00}
|
{0,0,0,00}
|
||||||
|
|
||||||
@ -561,9 +597,9 @@ static struct cw_MsgDef messages[] = {
|
|||||||
NULL, /* name */
|
NULL, /* name */
|
||||||
CAPWAP_MSG_DISCOVERY_REQUEST, /* type */
|
CAPWAP_MSG_DISCOVERY_REQUEST, /* type */
|
||||||
CW_ROLE_AC, /* role */
|
CW_ROLE_AC, /* role */
|
||||||
discovery_request_states,
|
discovery_request_states, /* states */
|
||||||
discovery_request_elements,
|
discovery_request_elements, /* elements */
|
||||||
NULL
|
postprocess_discovery /* postprocess fun */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
NULL, /* name */
|
NULL, /* name */
|
||||||
|
@ -20,12 +20,12 @@ static int put_ac_status(mavl_t global, mavl_t local, uint8_t *dst, const char *
|
|||||||
char key[CW_KTV_MAX_KEY_LEN];
|
char key[CW_KTV_MAX_KEY_LEN];
|
||||||
|
|
||||||
|
|
||||||
d += cw_put_word(d,cw_ktv_get_word(global,"ac-descriptor/stations",0));
|
d += cw_put_word(d,cw_ktv_get_word(local,"ac-descriptor/stations",0));
|
||||||
d += cw_put_word(d,cw_ktv_get_word(global,"ac-descriptor/station-limit",0));
|
d += cw_put_word(d,cw_ktv_get_word(local,"ac-descriptor/station-limit",0));
|
||||||
d += cw_put_word(d,cw_ktv_get_word(global,"ac-descriptor/active-wtps",0));
|
d += cw_put_word(d,cw_ktv_get_word(local,"ac-descriptor/active-wtps",0));
|
||||||
d += cw_put_word(d,cw_ktv_get_word(global,"ac-descriptor/max-wtps",0));
|
d += cw_put_word(d,cw_ktv_get_word(local,"ac-descriptor/max-wtps",0));
|
||||||
|
|
||||||
d += cw_put_byte(d,cw_ktv_get_byte(global,"ac-descriptor/security",0));
|
d += cw_put_byte(d,cw_ktv_get_byte(local,"ac-descriptor/security",0));
|
||||||
/*
|
/*
|
||||||
security = 0;
|
security = 0;
|
||||||
if (cw_ktv_get(local,"dtls-cert-file",CW_TYPE_BSTR16))
|
if (cw_ktv_get(local,"dtls-cert-file",CW_TYPE_BSTR16))
|
||||||
@ -40,14 +40,14 @@ static int put_ac_status(mavl_t global, mavl_t local, uint8_t *dst, const char *
|
|||||||
d += cw_put_byte(dst,security);
|
d += cw_put_byte(dst,security);
|
||||||
*/
|
*/
|
||||||
sprintf(key,"%s/%s",parent_key,"ac-descriptor/r-mac-field");
|
sprintf(key,"%s/%s",parent_key,"ac-descriptor/r-mac-field");
|
||||||
d += cw_put_byte(d,cw_ktv_get_byte(global,"ac-descriptor/r-mac-field",0));
|
d += cw_put_byte(d,cw_ktv_get_byte(local,"ac-descriptor/r-mac-field",0));
|
||||||
/*d += cw_put_byte(d,3);*/
|
/*d += cw_put_byte(d,3);*/
|
||||||
|
|
||||||
d += cw_put_byte(d,0);
|
d += cw_put_byte(d,0);
|
||||||
|
|
||||||
|
|
||||||
sprintf(key,"%s/%s",parent_key,CW_SKEY_DTLS_POLICY);
|
sprintf(key,"%s/%s",parent_key,CW_SKEY_DTLS_POLICY);
|
||||||
d += cw_put_byte(d,cw_ktv_get_byte(local,key,0));
|
d += cw_put_byte(d,cw_ktv_get_byte(local,"ac-descriptor/dtls-policy",0));
|
||||||
|
|
||||||
return d - dst;
|
return d - dst;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#define LW_CISCO_MANAGER_IP_ADDR 19
|
#define LW_CISCO_MANAGER_IP_ADDR 19
|
||||||
#define LW_CISCO_RADIO_MODULE_INFO 21
|
#define LW_CISCO_RADIO_MODULE_INFO 21
|
||||||
#define LW_CISCO_AC_IP_ADDR_WITH_INDEX 32
|
#define LW_CISCO_AC_IP_ADDR_WITH_INDEX 32
|
||||||
#define LW_CISCO_AP_ETHERNET_PORT_SUBTYPE 34
|
#define CISCO_LWELEM_AP_ETHERNET_PORT_SUBTYPE 34
|
||||||
#define CISCO_LWELEM_AP_LOGHOST_CONFIG 36
|
#define CISCO_LWELEM_AP_LOGHOST_CONFIG 36
|
||||||
#define LW_CISCO_MCAST_MGID_INFO 39
|
#define LW_CISCO_MCAST_MGID_INFO 39
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include "cw/vendors.h"
|
#include "cw/vendors.h"
|
||||||
|
|
||||||
#include "mod_cisco.h"
|
#include "mod_cisco.h"
|
||||||
|
#include "capwap_cisco.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
extern int cisco_register_actions80211_ac(struct cw_actiondef *def);
|
extern int cisco_register_actions80211_ac(struct cw_actiondef *def);
|
||||||
@ -58,6 +58,7 @@ static struct cw_MsgSet * register_messages(struct cw_MsgSet *set, int mode)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
static void errfunc(cfg_t *cfg, const char *fmt, va_list ap){
|
static void errfunc(cfg_t *cfg, const char *fmt, va_list ap){
|
||||||
|
|
||||||
if (cfg && cfg->filename && cfg->line)
|
if (cfg && cfg->filename && cfg->line)
|
||||||
@ -66,21 +67,22 @@ static void errfunc(cfg_t *cfg, const char *fmt, va_list ap){
|
|||||||
else if (cfg && cfg->filename)
|
else if (cfg && cfg->filename)
|
||||||
cw_log(LOG_ERR, "MOD Cisco cfg file in %s:", cfg->filename);
|
cw_log(LOG_ERR, "MOD Cisco cfg file in %s:", cfg->filename);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
static int init(struct cw_Mod *mod, mavl_t global_cfg, int role)
|
static int init(struct cw_Mod *mod, mavl_t global_cfg, int role)
|
||||||
{
|
{
|
||||||
uint8_t * str;
|
/* uint8_t * str;*/
|
||||||
static char * hardware_version; /*strdup(".x01000001");*/
|
static char * hardware_version; /*strdup(".x01000001");*/
|
||||||
static char * software_version; /* = NULL; */
|
static char * software_version; /* = NULL; */
|
||||||
cfg_t *cfg;
|
/* cfg_t *cfg;*/
|
||||||
|
|
||||||
int rc = 1;
|
int rc = 1;
|
||||||
cfg_opt_t opts[] = {
|
/* cfg_opt_t opts[] = {
|
||||||
CFG_SIMPLE_STR("hardware_version", &hardware_version),
|
CFG_SIMPLE_STR("hardware_version", &hardware_version),
|
||||||
CFG_SIMPLE_STR("software_version",&software_version),
|
CFG_SIMPLE_STR("software_version",&software_version),
|
||||||
CFG_END()
|
CFG_END()
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
cw_dbg(DBG_INFO, "CISCO: Initialiazing mod_cisco ...");
|
cw_dbg(DBG_INFO, "CISCO: Initialiazing mod_cisco ...");
|
||||||
cw_dbg(DBG_MOD, "CISCO: Loading base module: capwap");
|
cw_dbg(DBG_MOD, "CISCO: Loading base module: capwap");
|
||||||
|
|
||||||
@ -191,10 +193,38 @@ static struct cw_Mod capwap_ac = {
|
|||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static int write_header(struct cw_ElemHandler * handler, uint8_t * dst, int len)
|
||||||
|
{
|
||||||
|
if (handler->proto == 0){
|
||||||
|
if (handler->vendor)
|
||||||
|
return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len);
|
||||||
|
|
||||||
|
return len + cw_put_elem_hdr(dst, handler->id, len);
|
||||||
|
}
|
||||||
|
/* put the lwap elem header */
|
||||||
|
lw_set_dword(dst + 10, handler->vendor);
|
||||||
|
lw_set_word(dst + 14, handler->id);
|
||||||
|
return len + 6 + cw_put_elem_vendor_hdr(dst, handler->vendor,
|
||||||
|
CISCO_ELEM_SPAM_VENDOR_SPECIFIC, len+6);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static int header_len(struct cw_ElemHandler * handler)
|
||||||
|
{
|
||||||
|
if (handler->proto==0)
|
||||||
|
return handler->vendor ? 10 : 4;
|
||||||
|
|
||||||
|
return 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int static setup_cfg(struct conn * conn)
|
int static setup_cfg(struct conn * conn)
|
||||||
{
|
{
|
||||||
int security;
|
int security;
|
||||||
|
|
||||||
|
conn->write_header=write_header;
|
||||||
|
conn->header_len=header_len;
|
||||||
|
|
||||||
security = cw_setup_dtls(conn,conn->local_cfg,"cisco",CAPWAP_CIPHER);
|
security = cw_setup_dtls(conn,conn->local_cfg,"cisco",CAPWAP_CIPHER);
|
||||||
cw_ktv_set_byte(conn->local_cfg,"ac-descriptor/security",security);
|
cw_ktv_set_byte(conn->local_cfg,"ac-descriptor/security",security);
|
||||||
|
@ -32,7 +32,7 @@ endif
|
|||||||
|
|
||||||
|
|
||||||
#SRC=$(wildcard *.c)
|
#SRC=$(wildcard *.c)
|
||||||
SRC=wtp_main.c discovery.c join.c
|
SRC=wtp_main.c discovery.c join.c configure.c
|
||||||
|
|
||||||
OBJS=$(patsubst %.c,%.o,$(SRC))
|
OBJS=$(patsubst %.c,%.o,$(SRC))
|
||||||
OBJS:=$(patsubst %.o,$(OBJDIR)/%.o,$(OBJS))
|
OBJS:=$(patsubst %.o,$(OBJDIR)/%.o,$(OBJS))
|
||||||
|
@ -1,46 +1,37 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "cw/capwap.h"
|
#include "cw/capwap.h"
|
||||||
#include "cw/conn.h"
|
#include "cw/conn.h"
|
||||||
#include "cw/log.h"
|
#include "cw/log.h"
|
||||||
#include "cw/mbag.h"
|
#include "cw/dbg.h"
|
||||||
#include "cw/capwap_items.h"
|
|
||||||
|
|
||||||
#include "wtp_interface.h"
|
#include "wtp_interface.h"
|
||||||
#include "cfg.h"
|
#include "cfg.h"
|
||||||
|
|
||||||
int configure()
|
|
||||||
|
int configure(struct conn * conn)
|
||||||
{
|
{
|
||||||
|
char sockbuff[SOCK_ADDR_BUFSIZE];
|
||||||
|
|
||||||
struct conn *conn = get_conn();
|
cw_dbg_ktv_dump(conn->local_cfg,DBG_INFO,"KTV DUMP ----------------","LOCAL:", "DUMP done -------");
|
||||||
|
|
||||||
// mbag_del_all(conn->incomming);
|
int rc;
|
||||||
conn->incomming=conn->config;
|
rc = cw_send_request(conn, CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST);
|
||||||
mbag_del(conn->incomming,CW_ITEM_RESULT_CODE);
|
|
||||||
|
|
||||||
mbag_set_str(conn->local,CW_ITEM_AC_NAME,"abc");
|
|
||||||
// mbag_set_byte(conn->config,CW_ITEM_WTP_MAC_TYPE,WTP_MAC_TYPE_BOTH);
|
|
||||||
// mbag_set_byte(conn->config,CW_ITEM_WTP_MAC_TYPE,CAPWAP_WTP_MAC_TYPE_SPLIT);
|
|
||||||
|
|
||||||
/* for config status request send the whole config */
|
|
||||||
mbag_t radios_upd = conn->radios_upd;
|
|
||||||
conn->radios_upd=conn->radios;
|
|
||||||
|
|
||||||
int rc = cw_send_request(conn, CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST);
|
|
||||||
conn->radios_upd=radios_upd;
|
|
||||||
|
|
||||||
if (!cw_result_is_ok(rc)) {
|
if (!cw_result_is_ok(rc)) {
|
||||||
if (rc > 0) {
|
if (rc > 0) {
|
||||||
cw_log(LOG_ERR,
|
cw_log(LOG_ERR,
|
||||||
"Error sending Configuration Status Request to AC at %s, AC said: %d - %s.",
|
"Error sending Configuration Status Request to AC at %s, AC said: %d - %s.",
|
||||||
sock_addr2str(&conn->addr), rc, cw_strerror(rc));
|
sock_addr2str(&conn->addr,sockbuff), rc, cw_strerror(rc));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
cw_log(LOG_ERR,
|
cw_log(LOG_ERR,
|
||||||
"Error sending Configuration Status Request to AC at %s: %d - %s.",
|
"Error sending Configuration Status Request to AC at %s: %d - %s.",
|
||||||
sock_addr2str(&conn->addr), errno, cw_strerror(rc));
|
sock_addr2str(&conn->addr,sockbuff), errno, cw_strerror(rc));
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg_to_json();
|
/*cfg_to_json();*/
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,6 +208,10 @@ int main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
join(conn,&dis);
|
join(conn,&dis);
|
||||||
|
mavl_merge(conn->local_cfg,conn->remote_cfg);
|
||||||
|
|
||||||
|
|
||||||
|
configure(conn);
|
||||||
|
|
||||||
cw_discovery_free_results(&dis);
|
cw_discovery_free_results(&dis);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user