ac descriptor works
FossilOrigin-Name: 8e68ed51a2c8ee448474ab13ef8d0edbd8cfda5b5384684e2ed9ffa1fca4e799
This commit is contained in:
parent
a9bb2d523c
commit
257f1189b0
@ -3,9 +3,9 @@
|
|||||||
<Project Name="ac" Path="ac.project" Active="No"/>
|
<Project Name="ac" Path="ac.project" Active="No"/>
|
||||||
<Project Name="wtp" Path="wtp.project" Active="No"/>
|
<Project Name="wtp" Path="wtp.project" Active="No"/>
|
||||||
<Project Name="mod_cipwap" Path="mod_cipwap.project" Active="No"/>
|
<Project Name="mod_cipwap" Path="mod_cipwap.project" Active="No"/>
|
||||||
<Project Name="mod_capwap" Path="mod_capwap.project" Active="Yes"/>
|
<Project Name="mod_capwap" Path="mod_capwap.project" Active="No"/>
|
||||||
<Project Name="mod_cisco" Path="mod_cisco.project" Active="No"/>
|
<Project Name="mod_cisco" Path="mod_cisco.project" Active="No"/>
|
||||||
<Project Name="libcw" Path="libcw.project" Active="No"/>
|
<Project Name="libcw" Path="libcw.project" Active="Yes"/>
|
||||||
<Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="No"/>
|
<Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="No"/>
|
||||||
<Project Name="mod_fortinet" Path="mod_fortinet.project" Active="No"/>
|
<Project Name="mod_fortinet" Path="mod_fortinet.project" Active="No"/>
|
||||||
<BuildMatrix>
|
<BuildMatrix>
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
<File Name="src/cw/conn_get_response.c"/>
|
<File Name="src/cw/conn_get_response.c"/>
|
||||||
<File Name="src/cw/dtls_bio.c"/>
|
<File Name="src/cw/dtls_bio.c"/>
|
||||||
<File Name="src/cw/rand.h"/>
|
<File Name="src/cw/rand.h"/>
|
||||||
<File Name="src/cw/mbag_type_bstr.c"/>
|
|
||||||
<File Name="src/cw/cw_in_cisco_image_identifier.c"/>
|
<File Name="src/cw/cw_in_cisco_image_identifier.c"/>
|
||||||
<File Name="src/cw/radioinfo.h"/>
|
<File Name="src/cw/radioinfo.h"/>
|
||||||
<File Name="src/cw/capwap80211.h"/>
|
<File Name="src/cw/capwap80211.h"/>
|
||||||
@ -289,7 +288,6 @@
|
|||||||
<File Name="src/cw/cw_ktv_put.c"/>
|
<File Name="src/cw/cw_ktv_put.c"/>
|
||||||
<File Name="src/cw/cw_ktv_get.c"/>
|
<File Name="src/cw/cw_ktv_get.c"/>
|
||||||
<File Name="src/cw/cw_write_descriptor_subelem.c"/>
|
<File Name="src/cw/cw_write_descriptor_subelem.c"/>
|
||||||
<File Name="src/cw/cw_ktv_dump.c"/>
|
|
||||||
<File Name="src/cw/cw_ktv_get_word.c"/>
|
<File Name="src/cw/cw_ktv_get_word.c"/>
|
||||||
<File Name="src/cw/cw_ktv_get_byte.c"/>
|
<File Name="src/cw/cw_ktv_get_byte.c"/>
|
||||||
<File Name="src/cw/cw_ktv_std_types.c"/>
|
<File Name="src/cw/cw_ktv_std_types.c"/>
|
||||||
@ -300,6 +298,8 @@
|
|||||||
<File Name="src/cw/cw_clock_lap.c"/>
|
<File Name="src/cw/cw_clock_lap.c"/>
|
||||||
<File Name="src/cw/cw_type_ipaddress.c"/>
|
<File Name="src/cw/cw_type_ipaddress.c"/>
|
||||||
<File Name="src/cw/cw_ktv_idx_get.c"/>
|
<File Name="src/cw/cw_ktv_idx_get.c"/>
|
||||||
|
<File Name="src/cw/lw_put_bstr.c"/>
|
||||||
|
<File Name="src/cw/mavl_get_node_cmp..c"/>
|
||||||
</VirtualDirectory>
|
</VirtualDirectory>
|
||||||
</VirtualDirectory>
|
</VirtualDirectory>
|
||||||
<Description/>
|
<Description/>
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
<File Name="src/mod/capwap/capwap_out_wtp_board_data.c"/>
|
<File Name="src/mod/capwap/capwap_out_wtp_board_data.c"/>
|
||||||
<File Name="src/mod/capwap/capwap_out_wtp_descriptor.c"/>
|
<File Name="src/mod/capwap/capwap_out_wtp_descriptor.c"/>
|
||||||
<File Name="src/mod/capwap/capwap_out_capwap_control_ip_address.c"/>
|
<File Name="src/mod/capwap/capwap_out_capwap_control_ip_address.c"/>
|
||||||
|
<File Name="src/mod/capwap/capwap_in_capwap_control_ip_address.c"/>
|
||||||
</VirtualDirectory>
|
</VirtualDirectory>
|
||||||
</VirtualDirectory>
|
</VirtualDirectory>
|
||||||
</VirtualDirectory>
|
</VirtualDirectory>
|
||||||
|
@ -234,6 +234,12 @@ int main (int argc, char *argv[])
|
|||||||
|
|
||||||
cw_dbg_ktv_dump(global_cfg,DBG_INFO,NULL,"CFG:",NULL);
|
cw_dbg_ktv_dump(global_cfg,DBG_INFO,NULL,"CFG:",NULL);
|
||||||
|
|
||||||
|
/* int idx;
|
||||||
|
idx = cw_ktv_idx_get(global_cfg,"capwap-control-ip-address/address",0,CW_TYPE_IPADDRESS);
|
||||||
|
printf("IDX: %d\n");
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
*/
|
||||||
cw_log_name = "AC-Tube";
|
cw_log_name = "AC-Tube";
|
||||||
|
|
||||||
if (!read_config ("ac.conf"))
|
if (!read_config ("ac.conf"))
|
||||||
|
@ -66,7 +66,15 @@
|
|||||||
#define cw_get_word lw_get_word
|
#define cw_get_word lw_get_word
|
||||||
#define cw_get_dword lw_get_dword
|
#define cw_get_dword lw_get_dword
|
||||||
|
|
||||||
|
|
||||||
|
#define cw_set_byte lw_set_byte
|
||||||
|
#define cw_set_word lw_set_word
|
||||||
|
#define cw_set_dword lw_set_dword
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
#define cw_get_str(data, maxlen) (strndup((char*)(data),maxlen))
|
#define cw_get_str(data, maxlen) (strndup((char*)(data),maxlen))
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Macro to isolate bits from a dword
|
* Macro to isolate bits from a dword
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "dbg.h"
|
#include "dbg.h"
|
||||||
|
|
||||||
const char * cw_ktv_add_from_str(mavl_t kvtstore, const char *key, const struct cw_Type *type,
|
const char * cw_ktv_add_from_str(mavl_t kvtstore, const char *key,
|
||||||
|
const struct cw_Type *type,
|
||||||
const char * str)
|
const char * str)
|
||||||
{
|
{
|
||||||
cw_KTV_t mdata, *mresult;
|
cw_KTV_t mdata, *mresult;
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
#include "ktv.h"
|
|
||||||
#include "dbg.h"
|
|
||||||
|
|
@ -1,8 +1,73 @@
|
|||||||
#include "ktv.h"
|
#include "ktv.h"
|
||||||
|
|
||||||
cw_KTV_t * cw_ktv_idx_get(mavl_t ktv, const char *key, int idx, const cw_Type_t * type)
|
void * ktvn(struct mavl *t ,const void *search)
|
||||||
|
{
|
||||||
|
|
||||||
|
struct mavlnode *n,*lastl,*lastb;
|
||||||
|
lastb = NULL; lastl=NULL;
|
||||||
|
n = t->root;
|
||||||
|
while(n){
|
||||||
|
int rc;
|
||||||
|
const cw_KTV_t *c1,*c2;
|
||||||
|
c1=search;
|
||||||
|
c2=mavlnode_dataptr(n);
|
||||||
|
|
||||||
|
|
||||||
|
rc = t->cmp(search,mavlnode_dataptr(n));
|
||||||
|
|
||||||
|
/*printf("Compare: %s %s = %d\n",c1->key,c2->key, rc);*/
|
||||||
|
|
||||||
|
if (rc==0){
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rc<0){
|
||||||
|
lastl = n;
|
||||||
|
if (n->left==NULL){
|
||||||
|
return mavlnode_dataptr(lastb);
|
||||||
|
|
||||||
|
}
|
||||||
|
n=n->left;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
lastb=n;
|
||||||
|
if(n->right==NULL){
|
||||||
|
return mavlnode_dataptr(lastb);
|
||||||
|
|
||||||
|
}
|
||||||
|
n=n->right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int cw_ktv_idx_get(mavl_t ktv, const char *key, int idx, const cw_Type_t * type)
|
||||||
{
|
{
|
||||||
char ikey[CW_KTV_MAX_KEY_LEN];
|
char ikey[CW_KTV_MAX_KEY_LEN];
|
||||||
sprintf(ikey,"%s.%d",key,idx);
|
cw_KTV_t search, * result;
|
||||||
return cw_ktv_get(ktv,ikey,type);
|
char *d;
|
||||||
|
|
||||||
|
sprintf(ikey,"%s.%d",key,65536);
|
||||||
|
|
||||||
|
search.key=ikey;
|
||||||
|
result = ktvn(ktv,&search);
|
||||||
|
|
||||||
|
if (result == NULL){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
d = strchr(result->key,'.');
|
||||||
|
if (d==NULL){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strncmp(result->key,ikey,d-result->key)!=0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return atoi(d+1);
|
||||||
}
|
}
|
||||||
|
@ -2,5 +2,30 @@
|
|||||||
|
|
||||||
int cw_ktv_mavlcmp(const void *v1, const void *v2)
|
int cw_ktv_mavlcmp(const void *v1, const void *v2)
|
||||||
{
|
{
|
||||||
return strcmp(((cw_KTV_t *) v1)->key, ((cw_KTV_t *) v2)->key);
|
char *d1,*d2;
|
||||||
|
int l1,l2,rc,i1,i2;
|
||||||
|
|
||||||
|
|
||||||
|
d1 = strchr(((cw_KTV_t *) v1)->key,'.');
|
||||||
|
d2 = strchr(((cw_KTV_t *) v2)->key,'.');
|
||||||
|
|
||||||
|
if (d1==NULL || d2==NULL)
|
||||||
|
return strcmp(((cw_KTV_t *) v1)->key, ((cw_KTV_t *) v2)->key);
|
||||||
|
|
||||||
|
l1=d1-((cw_KTV_t *) v1)->key;
|
||||||
|
l2=d2-((cw_KTV_t *) v2)->key;
|
||||||
|
|
||||||
|
if (l1!=l2){
|
||||||
|
return strcmp(((cw_KTV_t *) v1)->key, ((cw_KTV_t *) v2)->key);
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = strncmp(((cw_KTV_t *) v1)->key,((cw_KTV_t *) v2)->key,l1);
|
||||||
|
if (rc!=0){
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
i1 = atoi(d1+1);
|
||||||
|
i2 = atoi(d2+1);
|
||||||
|
|
||||||
|
return i1-i2;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ int cw_out_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams
|
|||||||
{
|
{
|
||||||
char detail[128];
|
char detail[128];
|
||||||
struct cw_KTV * elem, search;
|
struct cw_KTV * elem, search;
|
||||||
int start, len;
|
int start, len, l;
|
||||||
/* Get the element to put */
|
/* Get the element to put */
|
||||||
|
|
||||||
search.key=(char*)handler->key;
|
search.key=(char*)handler->key;
|
||||||
@ -50,16 +50,18 @@ int cw_out_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams
|
|||||||
handler->type->to_str(elem,detail,120);
|
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;
|
||||||
|
|
||||||
/*(cw_put_mbag_item(dst + start, item);*/
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
return len + cw_put_elem_hdr(dst, handler->id, len);
|
|
||||||
|
|
||||||
|
l = len + cw_put_elem_hdr(dst, handler->id, len);
|
||||||
|
|
||||||
|
cw_dbg_elem(DBG_ELEM_OUT,params->conn,params->msgdata->type,handler,dst,l);
|
||||||
|
|
||||||
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "cw.h"
|
#include "cw.h"
|
||||||
#include "dbg.h"
|
#include "dbg.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Process a CAPWAP message element
|
* @brief Process a CAPWAP message element
|
||||||
@ -66,6 +67,10 @@ int cw_process_element(struct cw_ElemHandlerParams *params, int proto, int vendo
|
|||||||
cw_dbg_elem(DBG_ELEM_IN, params->conn, params->msgdata->type, handler,
|
cw_dbg_elem(DBG_ELEM_IN, params->conn, params->msgdata->type, handler,
|
||||||
data,len);
|
data,len);
|
||||||
|
|
||||||
|
if (handler->get == NULL){
|
||||||
|
cw_log(LOG_ERR,"No get method defined for %d %s",handler->id,handler->name);
|
||||||
|
return CAPWAP_RESULT_UNRECOGNIZED_MESSAGE_ELEMENT;
|
||||||
|
}
|
||||||
rc = handler->get(handler, params, data, len);
|
rc = handler->get(handler, params, data, len);
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,12 +94,12 @@ int cw_put_msg(struct conn *conn, uint8_t * rawout)
|
|||||||
|
|
||||||
l = handler->put(handler,¶ms,dst+len);
|
l = handler->put(handler,¶ms,dst+len);
|
||||||
|
|
||||||
if(l>0)
|
/* if(l>0)
|
||||||
cw_dbg_elem(DBG_ELEM_OUT,conn,type,handler,dst+len,l);
|
cw_dbg_elem(DBG_ELEM_OUT,conn,type,handler,dst+len,l);
|
||||||
if (strlen(details)){
|
if (strlen(details)){
|
||||||
cw_dbg(DBG_ELEM_DETAIL," %s",params.debug_details);
|
cw_dbg(DBG_ELEM_DETAIL," %s",params.debug_details);
|
||||||
}
|
}
|
||||||
len += l;
|
*/ len += l;
|
||||||
}
|
}
|
||||||
|
|
||||||
cw_set_msg_elems_len(msgptr, len);
|
cw_set_msg_elems_len(msgptr, len);
|
||||||
@ -111,7 +111,7 @@ int cw_put_msg(struct conn *conn, uint8_t * rawout)
|
|||||||
cw_set_msg_seqnum(msgptr,s);
|
cw_set_msg_seqnum(msgptr,s);
|
||||||
}
|
}
|
||||||
|
|
||||||
return len;
|
return CAPWAP_RESULT_SUCCESS;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,24 @@
|
|||||||
#include "cw.h"
|
#include "cw.h"
|
||||||
|
|
||||||
#include "dbg.h"
|
#include "dbg.h"
|
||||||
|
#include "ktv.h"
|
||||||
|
|
||||||
/*
|
static struct cw_DescriptorSubelemDef allowed_default[] = {
|
||||||
int cw_read_ac_descriptor(mbag_t store, uint8_t *data, int len,
|
{0,CW_SUBELEM_AC_HARDWARE_VERSION, "ac_hardware_versision", 1024,1},
|
||||||
|
{0,CW_SUBELEM_AC_SOFTWARE_VERSION, "ac_software_version", 1024,1},
|
||||||
|
{0,0, NULL,0, 0}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int cw_read_ac_descriptor(mavl_t store, uint8_t *data, int len,
|
||||||
struct cw_DescriptorSubelemDef *allowed)
|
struct cw_DescriptorSubelemDef *allowed)
|
||||||
{
|
{
|
||||||
struct cw_ac_status *status = malloc(sizeof(struct cw_ac_status));
|
char key[CW_KTV_MAX_KEY_LEN];
|
||||||
if (!status)
|
cw_KTV_t * stations, *limit;
|
||||||
return 0;
|
|
||||||
|
|
||||||
status->stations = cw_get_word(data);
|
stations = cw_ktv_add(store,"ac-descriptor/stations",CW_TYPE_WORD,data,4);
|
||||||
|
|
||||||
|
/* status->stations = cw_get_word(data);
|
||||||
status->limit = cw_get_word(data + 2);
|
status->limit = cw_get_word(data + 2);
|
||||||
status->active_wtps = cw_get_word(data + 4);
|
status->active_wtps = cw_get_word(data + 4);
|
||||||
status->max_wtps = cw_get_word(data + 6);
|
status->max_wtps = cw_get_word(data + 6);
|
||||||
@ -22,14 +30,9 @@ int cw_read_ac_descriptor(mbag_t store, uint8_t *data, int len,
|
|||||||
"AC Descriptor: WTPs:%d/%d, Stations:%d/%d, Security:%d, Rmac:%d, DTLS-Policy:%d",
|
"AC Descriptor: WTPs:%d/%d, Stations:%d/%d, Security:%d, Rmac:%d, DTLS-Policy:%d",
|
||||||
status->active_wtps, status->max_wtps, status->stations, status->limit,
|
status->active_wtps, status->max_wtps, status->stations, status->limit,
|
||||||
status->security, status->rmac_field, status->dtls_policy);
|
status->security, status->rmac_field, status->dtls_policy);
|
||||||
|
*/
|
||||||
|
/* mbag_set_ptr(store, CW_ITEM_AC_STATUS, status);*/
|
||||||
|
|
||||||
mbag_set_ptr(store, CW_ITEM_AC_STATUS, status);
|
|
||||||
|
|
||||||
static struct cw_DescriptorSubelemDef allowed_default[] = {
|
|
||||||
{0,CW_SUBELEM_AC_HARDWARE_VERSION, "ac_hardware_versision", 1024,1},
|
|
||||||
{0,CW_SUBELEM_AC_SOFTWARE_VERSION, "ac_software_version", 1024,1},
|
|
||||||
{0,0, NULL,0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!allowed)
|
if (!allowed)
|
||||||
allowed=allowed_default;
|
allowed=allowed_default;
|
||||||
@ -38,4 +41,4 @@ int cw_read_ac_descriptor(mbag_t store, uint8_t *data, int len,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
|
||||||
|
@ -35,9 +35,9 @@ static int put(const cw_KTV_t *data, uint8_t * dst)
|
|||||||
|
|
||||||
static int to_str(const cw_KTV_t *data, char *dst, int max_len)
|
static int to_str(const cw_KTV_t *data, char *dst, int max_len)
|
||||||
{
|
{
|
||||||
if (max_len<3){
|
/*if (max_len<3){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}*/
|
||||||
return sprintf(dst, "%d", data->val.byte);
|
return sprintf(dst, "%d", data->val.byte);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ static struct cw_KTV *from_str ( struct cw_KTV * data, const char *src )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int len ( struct cw_KTV * data ){
|
static int len ( struct cw_KTV * data ){
|
||||||
return bstr16_len(data->val.ptr);
|
return bstr_len(data->val.ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ cw_KTV_t * cw_ktv_get(mavl_t ktv, const char *key, const cw_Type_t * type);
|
|||||||
uint8_t cw_ktv_get_byte(mavl_t ktv,const char *key, uint8_t def);
|
uint8_t cw_ktv_get_byte(mavl_t ktv,const char *key, uint8_t def);
|
||||||
uint16_t cw_ktv_get_word(mavl_t ktv,const char *key, uint16_t def);
|
uint16_t cw_ktv_get_word(mavl_t ktv,const char *key, uint16_t def);
|
||||||
|
|
||||||
cw_KTV_t * cw_ktv_idx_get(mavl_t ktv, const char *key, int idx, const cw_Type_t * type);
|
int cw_ktv_idx_get(mavl_t ktv, const char *key, int idx, const cw_Type_t * type);
|
||||||
|
|
||||||
|
|
||||||
extern const cw_Type_t * cw_ktv_std_types[];
|
extern const cw_Type_t * cw_ktv_std_types[];
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
/**
|
/**
|
||||||
* Same as #lw_set_word, but no return value
|
* Same as #lw_set_word, but no return value
|
||||||
*/
|
*/
|
||||||
#define lw_set_word(dst,b) \
|
#define lw_set_word(dst,w) \
|
||||||
(*((uint16_t*)(dst)) = htons(w))
|
(*((uint16_t*)(dst)) = htons(w))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7,16 +7,16 @@ const char * lw_elem_id_to_str(int elem_id)
|
|||||||
{
|
{
|
||||||
|
|
||||||
switch (elem_id){
|
switch (elem_id){
|
||||||
case LW_ELEM_AC_ADDRESS:
|
case LWAPP_ELEM_AC_ADDRESS:
|
||||||
return "AC Address";
|
return "AC Address";
|
||||||
|
|
||||||
case LW_ELEM_WTP_DESCRIPTOR:
|
case LWAPP_ELEM_WTP_DESCRIPTOR:
|
||||||
return "WTP Descriptor";
|
return "WTP Descriptor";
|
||||||
|
|
||||||
case LW_ELEM_WTP_NAME:
|
case LWAPP_ELEM_WTP_NAME:
|
||||||
return "WTP Name";
|
return "WTP Name";
|
||||||
|
|
||||||
case LW_ELEM_AC_DESCRIPTOR:
|
case LWAPP_ELEM_AC_DESCRIPTOR:
|
||||||
return "AC Descriptor";
|
return "AC Descriptor";
|
||||||
|
|
||||||
case LW_ELEM_AC_NAME:
|
case LW_ELEM_AC_NAME:
|
||||||
|
@ -14,16 +14,6 @@ int lw_put_data(uint8_t*dst,const uint8_t*data,uint16_t len)
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Put a #bstr_t to an output buffer
|
|
||||||
* @param dst Destination
|
|
||||||
* @param b bstr to put
|
|
||||||
* @return The number of bytes put
|
|
||||||
*/
|
|
||||||
int lw_put_bstr(uint8_t * dst, const bstr_t b){
|
|
||||||
lw_put_data(dst,bstr_data(b),bstr_len(b));
|
|
||||||
return bstr_len(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put a #bstr16_t to an output buffer
|
* Put a #bstr16_t to an output buffer
|
||||||
|
12
src/cw/lw_put_bstr.c
Normal file
12
src/cw/lw_put_bstr.c
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include "lw.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put a #bstr_t to an output buffer
|
||||||
|
* @param dst Destination
|
||||||
|
* @param b bstr to put
|
||||||
|
* @return The number of bytes put
|
||||||
|
*/
|
||||||
|
int lw_put_bstr(uint8_t * dst, const bstr_t b){
|
||||||
|
lw_put_data(dst,bstr_data(b),bstr_len(b));
|
||||||
|
return bstr_len(b);
|
||||||
|
}
|
@ -9,7 +9,7 @@ int lw_put_image_data(uint8_t *dst,FILE *infile)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bytes = fread(dst+3,1,LW_BLOCKSIZE_IMAGE_DATA,infile);
|
int bytes = fread(dst+3,1,LWAPP_BLOCKSIZE_IMAGE_DATA,infile);
|
||||||
|
|
||||||
if ( ferror(infile)) {
|
if ( ferror(infile)) {
|
||||||
lw_put_byte(dst+0,5);
|
lw_put_byte(dst+0,5);
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
*/
|
*/
|
||||||
int lw_readelem_wtp_name(uint8_t ** dst, int type, uint8_t * msgelem, int len)
|
int lw_readelem_wtp_name(uint8_t ** dst, int type, uint8_t * msgelem, int len)
|
||||||
{
|
{
|
||||||
if (type != LW_ELEM_WTP_NAME)
|
if (type != LWAPP_ELEM_WTP_NAME)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
#define LWAPP_DATA_PORT_STR "12223"
|
#define LWAPP_DATA_PORT_STR "12223"
|
||||||
|
|
||||||
/** Block Size for Image Data */
|
/** Block Size for Image Data */
|
||||||
#define LW_BLOCKSIZE_IMAGE_DATA 1024
|
#define LWAPP_BLOCKSIZE_IMAGE_DATA 1024
|
||||||
|
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
@ -91,11 +91,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#define LW_MSG_DISCOVERY_REQUEST 1
|
#define LWAPP_MSG_DISCOVERY_REQUEST 1
|
||||||
#define LW_MSG_DISCOVERY_RESPONSE 2
|
#define LWAPP_MSG_DISCOVERY_RESPONSE 2
|
||||||
|
|
||||||
#define LW_MSG_JOIN_REQUEST 3
|
#define LWAPP_MSG_JOIN_REQUEST 3
|
||||||
#define LW_MSG_JOIN_RESPONSE 4
|
#define LWAPP_MSG_JOIN_RESPONSE 4
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Join ACK 5
|
Join ACK 5
|
||||||
@ -125,11 +125,11 @@
|
|||||||
|
|
||||||
/* LWAPP message elements */
|
/* LWAPP message elements */
|
||||||
|
|
||||||
#define LW_ELEM_AC_ADDRESS 2
|
#define LWAPP_ELEM_AC_ADDRESS 2
|
||||||
#define LW_ELEM_WTP_DESCRIPTOR 3
|
#define LWAPP_ELEM_WTP_DESCRIPTOR 3
|
||||||
#define LW_ELEM_WTP_NAME 5
|
#define LWAPP_ELEM_WTP_NAME 5
|
||||||
#define LW_ELEM_AC_DESCRIPTOR 6
|
#define LWAPP_ELEM_AC_DESCRIPTOR 6
|
||||||
#define LW_ELEM_ADD_WLAN 7
|
#define LWAPP_ELEM_ADD_WLAN 7
|
||||||
|
|
||||||
#define LW_ELEM_MAC_OPERATION 11
|
#define LW_ELEM_MAC_OPERATION 11
|
||||||
#define LW_ELEM_TX_POWER 12
|
#define LW_ELEM_TX_POWER 12
|
||||||
|
@ -115,7 +115,7 @@ typedef struct mavl * mavl_t;
|
|||||||
/**
|
/**
|
||||||
* @param node node
|
* @param node node
|
||||||
*/
|
*/
|
||||||
#define mavlnode_dataptr(node) (((uint8_t*)(node))+sizeof(struct mavlnode))
|
#define mavlnode_dataptr(node) ((void*)(((uint8_t*)(node))+sizeof(struct mavlnode)))
|
||||||
|
|
||||||
struct mavl *mavl_create ( int ( *cmp ) ( const void *, const void * ),
|
struct mavl *mavl_create ( int ( *cmp ) ( const void *, const void * ),
|
||||||
void ( *del ) ( void * ), size_t data_size );
|
void ( *del ) ( void * ), size_t data_size );
|
||||||
@ -129,8 +129,9 @@ void mavl_destroy ( struct mavl *t );
|
|||||||
void mavl_del_all ( struct mavl *t );
|
void mavl_del_all ( struct mavl *t );
|
||||||
void mavl_merge ( mavl_t m, mavl_t t );
|
void mavl_merge ( mavl_t m, mavl_t t );
|
||||||
void mavlnode_destroy ( struct mavl *t, struct mavlnode *n );
|
void mavlnode_destroy ( struct mavl *t, struct mavlnode *n );
|
||||||
struct mavlnode *mavl_get_node ( struct mavl *t, void *data );
|
struct mavlnode *mavlnode_get ( struct mavl *t, void *data );
|
||||||
|
struct mavlnode * mavl_get_node_cmp(struct mavl *t ,void *data,
|
||||||
|
int ( *cmp ) ( const void *, const void * ));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
* @brief Implementation of mavl_get
|
* @brief Implementation of mavl_get
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "mavl.h"
|
#include "mavl.h"
|
||||||
|
|
||||||
|
@ -17,12 +17,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "mavl.h"
|
#include "mavl.h"
|
||||||
|
|
||||||
|
|
||||||
struct mavlnode * mavl_get_node(struct mavl *t ,void *data)
|
struct mavlnode * mavlnode_get(struct mavl *t ,void *data)
|
||||||
{
|
{
|
||||||
struct mavlnode *n = t->root;
|
struct mavlnode *n = t->root;
|
||||||
while(n){
|
while(n){
|
||||||
@ -36,4 +34,3 @@ struct mavlnode * mavl_get_node(struct mavl *t ,void *data)
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
18
src/cw/mavl_get_node_cmp..c
Normal file
18
src/cw/mavl_get_node_cmp..c
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
#include "mavl.h"
|
||||||
|
|
||||||
|
struct mavlnode * mavl_get_node_cmp(struct mavl *t ,void *data,
|
||||||
|
int ( *cmp ) ( const void *, const void * ))
|
||||||
|
{
|
||||||
|
struct mavlnode *n = t->root;
|
||||||
|
while(n){
|
||||||
|
int rc=cmp(data,mavlnode_dataptr(n));
|
||||||
|
if (rc==0)
|
||||||
|
return n;
|
||||||
|
if (rc<0)
|
||||||
|
n=n->left;
|
||||||
|
else
|
||||||
|
n=n->right;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
static void mavlnode_move(mavl_t m,mavl_t t, struct mavlnode *n)
|
static void mavlnode_move(mavl_t m,mavl_t t, struct mavlnode *n)
|
||||||
{
|
{
|
||||||
struct mavlnode * mn = mavl_get_node(m,mavlnode_dataptr(n));
|
struct mavlnode * mn = mavlnode_get(m,mavlnode_dataptr(n));
|
||||||
if (mn) {
|
if (mn) {
|
||||||
if (m->del) {
|
if (m->del) {
|
||||||
m->del(mavlnode_dataptr(mn));
|
m->del(mavlnode_dataptr(mn));
|
||||||
|
@ -23,12 +23,12 @@ $(OBJDIR)/%.o:%.c
|
|||||||
$(SNAME) : $(OBJS) $(MODOBJS)
|
$(SNAME) : $(OBJS) $(MODOBJS)
|
||||||
@mkdir -p $(LIBARCHDIR)
|
@mkdir -p $(LIBARCHDIR)
|
||||||
@echo " $(AR) $(SNAME)"
|
@echo " $(AR) $(SNAME)"
|
||||||
$(AR) rcs $(SNAME) $(OBJS) $(MODOBJS)
|
@$(AR) rcs $(SNAME) $(OBJS) $(MODOBJS)
|
||||||
|
|
||||||
$(DNAME) : $(OBJS) $(MODOBJS)
|
$(DNAME) : $(OBJS) $(MODOBJS)
|
||||||
@mkdir -p $(LIBARCHDIR)
|
@mkdir -p $(LIBARCHDIR)
|
||||||
@echo " $(CC) $(DNAME)"
|
@echo " $(CC) $(DNAME)"
|
||||||
$(LD) -L$(LIBARCHDIR) $(LDFLAGS) -shared -o $(DNAME) $(OBJS) $(MODOBJS) $(SLIBS) $(LIBS)
|
@$(LD) -L$(LIBARCHDIR) $(LDFLAGS) -shared -o $(DNAME) $(OBJS) $(MODOBJS) $(SLIBS) $(LIBS)
|
||||||
|
|
||||||
$(MODNAME) : $(DNAME)
|
$(MODNAME) : $(DNAME)
|
||||||
cp $(DNAME) $(MODNAME)
|
cp $(DNAME) $(MODNAME)
|
||||||
|
@ -15,7 +15,8 @@ OBJS=\
|
|||||||
capwap_in_session_id.o \
|
capwap_in_session_id.o \
|
||||||
capwap_in_vendor_specific_payload.o \
|
capwap_in_vendor_specific_payload.o \
|
||||||
capwap_in_mtu_discovery_padding.o \
|
capwap_in_mtu_discovery_padding.o \
|
||||||
capwap_out_capwap_control_ip_address.o
|
capwap_out_capwap_control_ip_address.o \
|
||||||
|
capwap_in_capwap_control_ip_address.o
|
||||||
|
|
||||||
|
|
||||||
LIBDIR := ../../../lib
|
LIBDIR := ../../../lib
|
||||||
|
@ -31,47 +31,47 @@
|
|||||||
static struct cw_ElemHandler handlers[] = {
|
static struct cw_ElemHandler handlers[] = {
|
||||||
|
|
||||||
{
|
{
|
||||||
"Discovery Type", /* name */
|
"Discovery Type", /* name */
|
||||||
CAPWAP_ELEM_DISCOVERY_TYPE, /* Element ID */
|
CAPWAP_ELEM_DISCOVERY_TYPE, /* 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_BYTE, /* type */
|
||||||
CW_KEY_DISCOVERY_TYPE, /* Key */
|
CW_KEY_DISCOVERY_TYPE, /* Key */
|
||||||
cw_in_generic, /* get */
|
cw_in_generic, /* get */
|
||||||
cw_out_generic /* put */
|
cw_out_generic /* put */
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
"WTP Mac Type", /* name */
|
"WTP Mac Type", /* name */
|
||||||
CAPWAP_ELEM_WTP_MAC_TYPE, /* Element ID */
|
CAPWAP_ELEM_WTP_MAC_TYPE, /* 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_BYTE, /* type */
|
||||||
CW_KEY_WTP_MAC_TYPE, /* Key */
|
CW_KEY_WTP_MAC_TYPE, /* Key */
|
||||||
cw_in_generic, /* get */
|
cw_in_generic, /* get */
|
||||||
cw_out_generic /* put */
|
cw_out_generic /* put */
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
"WTP Board Data", /* name */
|
"WTP Board Data", /* name */
|
||||||
CAPWAP_ELEM_WTP_BOARD_DATA, /* Element ID */
|
CAPWAP_ELEM_WTP_BOARD_DATA, /* Element ID */
|
||||||
0,0, /* Vendor / Proto */
|
0,0, /* Vendor / Proto */
|
||||||
14,1024, /* min/max length */
|
14,1024, /* min/max length */
|
||||||
NULL, /* type */
|
NULL, /* type */
|
||||||
CW_KEY_WTP_BOARD_DATA, /* Key */
|
CW_KEY_WTP_BOARD_DATA, /* Key */
|
||||||
capwap_in_wtp_board_data, /* get */
|
capwap_in_wtp_board_data, /* get */
|
||||||
capwap_out_wtp_board_data /* put */
|
capwap_out_wtp_board_data /* put */
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
"WTP Descriptor", /* name */
|
"WTP Descriptor", /* name */
|
||||||
CAPWAP_ELEM_WTP_DESCRIPTOR, /* Element ID */
|
CAPWAP_ELEM_WTP_DESCRIPTOR, /* Element ID */
|
||||||
0,0, /* Vendor / Proto */
|
0,0, /* Vendor / Proto */
|
||||||
33,1024, /* min/max length */
|
33,1024, /* min/max length */
|
||||||
NULL, /* type */
|
NULL, /* type */
|
||||||
CW_KEY_WTP_DESCRIPTOR, /* Key */
|
CW_KEY_WTP_DESCRIPTOR, /* Key */
|
||||||
capwap_in_wtp_descriptor, /* get */
|
capwap_in_wtp_descriptor, /* get */
|
||||||
capwap_out_wtp_descriptor, /* put */
|
capwap_out_wtp_descriptor, /* put */
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
@ -136,10 +136,10 @@ static struct cw_ElemHandler handlers[] = {
|
|||||||
"CAPWAP Control IPv4 Address", /* name */
|
"CAPWAP Control IPv4 Address", /* name */
|
||||||
CW_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS, /* Element ID */
|
CW_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS, /* Element ID */
|
||||||
0,0, /* Vendor / Proto */
|
0,0, /* Vendor / Proto */
|
||||||
0,0, /* min/max length */
|
6,6, /* min/max length */
|
||||||
CW_TYPE_BSTR16, /* type */
|
CW_TYPE_BSTR16, /* type */
|
||||||
"capwap-control-ip-address", /* Key */
|
"capwap-control-ip-address", /* Key */
|
||||||
NULL, /* get */
|
capwap_in_capwap_control_ip_address, /* get */
|
||||||
capwap_out_capwap_control_ip_address /* put */
|
capwap_out_capwap_control_ip_address /* put */
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -147,10 +147,10 @@ static struct cw_ElemHandler handlers[] = {
|
|||||||
"CAPWAP Control IPv6 Address", /* name */
|
"CAPWAP Control IPv6 Address", /* name */
|
||||||
CW_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS, /* Element ID */
|
CW_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS, /* Element ID */
|
||||||
0,0, /* Vendor / Proto */
|
0,0, /* Vendor / Proto */
|
||||||
0,0, /* min/max length */
|
18,18, /* min/max length */
|
||||||
CW_TYPE_BSTR16, /* type */
|
CW_TYPE_BSTR16, /* type */
|
||||||
"capwap-control-ip-address", /* Key */
|
"capwap-control-ip-address", /* Key */
|
||||||
NULL, /* get */
|
capwap_in_capwap_control_ip_address, /* get */
|
||||||
capwap_out_capwap_control_ip_address /* put */
|
capwap_out_capwap_control_ip_address /* put */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,46 +21,28 @@
|
|||||||
* @brief Implements cw_in_capwap_control_ip_address
|
* @brief Implements cw_in_capwap_control_ip_address
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include "mod_capwap.h"
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include <errno.h>
|
int capwap_in_capwap_control_ip_address(struct cw_ElemHandler *eh,
|
||||||
|
struct cw_ElemHandlerParams *params,
|
||||||
|
uint8_t * data, int len)
|
||||||
|
|
||||||
#include "log.h"
|
|
||||||
|
|
||||||
#include "cw.h"
|
|
||||||
|
|
||||||
#include "aciplist.h"
|
|
||||||
#include "sock.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int cw_in_capwap_control_ip_address(struct conn *conn, struct cw_action_in *a,
|
|
||||||
uint8_t * data, int len,struct sockaddr *from)
|
|
||||||
{
|
{
|
||||||
/* cw_acip_t * acip;
|
char key[CW_KTV_MAX_KEY_LEN];
|
||||||
cw_aciplist_t list =
|
int idx;
|
||||||
mbag_get_mavl_c(conn->incomming,a->item_id,cw_aciplist_create);
|
|
||||||
|
|
||||||
if (!list) {
|
sprintf(key,"%s/address",eh->key);
|
||||||
cw_log(LOG_ERR, "Error: Can't allocate CAWPAP IP Adress List");
|
idx = cw_ktv_idx_get(params->conn->remote_cfg,key,0,CW_TYPE_IPADDRESS);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
printf("SKEY is %s , idx: %d\n",key,idx);
|
||||||
|
|
||||||
acip = malloc(sizeof(cw_acip_t));
|
sprintf(key,"%s/address.%d",eh->key,idx+1);
|
||||||
if (!acip) {
|
cw_ktv_add(params->conn->remote_cfg,key,CW_TYPE_IPADDRESS,data,len-2);
|
||||||
cw_log(LOG_ERR,"Can't allocate memory for acv4ip: %s",strerror(errno));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
sprintf(key,"%s/wtps.%d",eh->key,idx+1);
|
||||||
|
cw_ktv_add(params->conn->remote_cfg,key,CW_TYPE_WORD,data+len-2,2);
|
||||||
|
|
||||||
if (a->elem_id == CW_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS) {
|
/* if (handler-id == CW_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS) {
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
memcpy(&addr.sin_addr,data,4);
|
memcpy(&addr.sin_addr,data,4);
|
||||||
addr.sin_family=AF_INET;
|
addr.sin_family=AF_INET;
|
||||||
@ -78,11 +60,11 @@ int cw_in_capwap_control_ip_address(struct conn *conn, struct cw_action_in *a,
|
|||||||
memcpy(&acip->ip,&addr,sizeof(addr));
|
memcpy(&acip->ip,&addr,sizeof(addr));
|
||||||
acip->index = cw_get_word(data+16);
|
acip->index = cw_get_word(data+16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cw_aciplist_replace(list,acip);
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
@ -1,3 +1,6 @@
|
|||||||
|
|
||||||
|
#include "cw/cw.h"
|
||||||
|
#include "cw/dbg.h"
|
||||||
#include "mod_capwap.h"
|
#include "mod_capwap.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -47,40 +50,56 @@ static int put_ip(uint8_t *dst void *priv, cw_acip_t * acip void *data)
|
|||||||
int capwap_out_capwap_control_ip_address(struct cw_ElemHandler * eh,
|
int capwap_out_capwap_control_ip_address(struct cw_ElemHandler * eh,
|
||||||
struct cw_ElemHandlerParams * params, uint8_t * dst)
|
struct cw_ElemHandlerParams * params, uint8_t * dst)
|
||||||
{
|
{
|
||||||
|
char key[CW_KTV_MAX_KEY_LEN];
|
||||||
int i;
|
int i;
|
||||||
int wtps;
|
int wtps;
|
||||||
|
|
||||||
|
|
||||||
cw_KTV_t * address;
|
cw_KTV_t * address;
|
||||||
|
uint8_t *d;
|
||||||
|
|
||||||
char key[CW_KTV_MAX_KEY_LEN];
|
d = dst;
|
||||||
|
|
||||||
i=0;
|
i=0;
|
||||||
|
do {
|
||||||
|
uint8_t * msg;
|
||||||
|
int l;
|
||||||
|
|
||||||
sprintf(key,"%s/address.%d",eh->key,i);
|
|
||||||
address = cw_ktv_get(params->conn->local_cfg,key,CW_TYPE_IPADDRESS);
|
|
||||||
|
|
||||||
sprintf(key,"%s/wtps.%d",eh->key,i);
|
|
||||||
wtps = cw_ktv_get_word(params->conn->local_cfg,key,0);
|
|
||||||
|
|
||||||
while (address != NULL) {
|
|
||||||
char str[100];
|
|
||||||
printf("Yea!");
|
|
||||||
address->type->to_str(address,str,10);
|
|
||||||
printf("Hier isses: %s, %d\n",str,wtps);
|
|
||||||
|
|
||||||
i++;
|
|
||||||
sprintf(key,"%s/address.%d",eh->key,i);
|
sprintf(key,"%s/address.%d",eh->key,i);
|
||||||
address = cw_ktv_get(params->conn->local_cfg,key,CW_TYPE_IPADDRESS);
|
address = cw_ktv_get(params->conn->local_cfg,key,CW_TYPE_IPADDRESS);
|
||||||
sprintf(key,"%s/wtps.%d",eh->key,i);
|
sprintf(key,"%s/wtps.%d",eh->key,i);
|
||||||
wtps = cw_ktv_get_word(params->conn->local_cfg,key,0);
|
wtps = cw_ktv_get_word(params->conn->local_cfg,key,0);
|
||||||
}
|
i++;
|
||||||
|
if (address==NULL){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
msg = d;
|
||||||
|
|
||||||
|
l = address->type->len(address);
|
||||||
|
|
||||||
|
switch(eh->id){
|
||||||
|
case CW_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS:
|
||||||
|
if (l!=4){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CW_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS:
|
||||||
|
if (l!=16){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
l = address->type->put(address,d+4);
|
||||||
|
l+=cw_put_word(dst+4+l,wtps);
|
||||||
|
l+=cw_put_elem_hdr(d,eh->id,l);
|
||||||
|
cw_dbg_elem(DBG_ELEM_OUT,params->conn,params->msgdata->type,eh,d+4,l-4);
|
||||||
|
|
||||||
|
d+=l;
|
||||||
|
}while(address != NULL);
|
||||||
|
|
||||||
|
|
||||||
|
return d-dst;
|
||||||
|
|
||||||
|
|
||||||
return 10;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -28,7 +28,7 @@ int capwap_out_wtp_descriptor(struct cw_ElemHandler * eh,
|
|||||||
struct cw_ElemHandlerParams * params, uint8_t * dst)
|
struct cw_ElemHandlerParams * params, uint8_t * dst)
|
||||||
{
|
{
|
||||||
char key[CW_KTV_MAX_KEY_LEN];
|
char key[CW_KTV_MAX_KEY_LEN];
|
||||||
int len;
|
int len,l;
|
||||||
/* // XXX Dummy WTP Descriptor Header */
|
/* // XXX Dummy WTP Descriptor Header */
|
||||||
uint8_t *d;
|
uint8_t *d;
|
||||||
cw_KTV_t * val;
|
cw_KTV_t * val;
|
||||||
@ -75,5 +75,8 @@ int capwap_out_wtp_descriptor(struct cw_ElemHandler * eh,
|
|||||||
CW_SUBELEM_WTP_BOOTLOADER_VERSION, key);
|
CW_SUBELEM_WTP_BOOTLOADER_VERSION, key);
|
||||||
|
|
||||||
len = d-dst-4;
|
len = d-dst-4;
|
||||||
return len + cw_put_elem_hdr(dst,eh->id,len);
|
l = len + cw_put_elem_hdr(dst,eh->id,len);
|
||||||
|
|
||||||
|
cw_dbg_elem(DBG_ELEM_OUT,params->conn,params->msgdata->type,eh,dst,l);
|
||||||
|
return l;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,9 @@ int capwap_out_ac_descriptor(struct cw_ElemHandler * eh,
|
|||||||
int capwap_out_capwap_control_ip_address(struct cw_ElemHandler * eh,
|
int capwap_out_capwap_control_ip_address(struct cw_ElemHandler * eh,
|
||||||
struct cw_ElemHandlerParams * params, uint8_t * dst);
|
struct cw_ElemHandlerParams * params, uint8_t * dst);
|
||||||
|
|
||||||
|
int capwap_in_capwap_control_ip_address(struct cw_ElemHandler *eh,
|
||||||
|
struct cw_ElemHandlerParams *params,
|
||||||
|
uint8_t * data, int len);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,8 +81,9 @@ static struct cw_ElemHandler handlers[] = {
|
|||||||
static int discovery_request_states[] = {CAPWAP_STATE_DISCOVERY,0};
|
static int discovery_request_states[] = {CAPWAP_STATE_DISCOVERY,0};
|
||||||
static struct cw_ElemDef discovery_request_elements[] ={
|
static struct cw_ElemDef discovery_request_elements[] ={
|
||||||
{0,0, CAPWAP_ELEM_WTP_DESCRIPTOR, 1, 0},
|
{0,0, CAPWAP_ELEM_WTP_DESCRIPTOR, 1, 0},
|
||||||
|
{0,0, CAPWAP_ELEM_WTP_BOARD_DATA, 0, 0},
|
||||||
{0,CW_VENDOR_ID_CISCO, CW_CISCO_RAD_NAME, 1, 0},
|
{0,CW_VENDOR_ID_CISCO, CW_CISCO_RAD_NAME, 1, 0},
|
||||||
{0,CW_VENDOR_ID_CISCO, CW_CISCO_BOARD_DATA_OPTIONS, 1, 0},
|
{0,CW_VENDOR_ID_CISCO, CW_CISCO_BOARD_DATA_OPTIONS, 0, 0},
|
||||||
{0,0,0,00}
|
{0,0,0,00}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
|
|
||||||
#include "cw/capwap.h"
|
#include "cw/capwap.h"
|
||||||
#include "cw/conn.h"
|
#include "cw/conn.h"
|
||||||
#include "cw/sock.h"
|
#include "cw/sock.h"
|
||||||
@ -24,12 +25,7 @@ static int run_discovery(struct conn *conn)
|
|||||||
conn->capwap_state = CAPWAP_STATE_DISCOVERY;
|
conn->capwap_state = CAPWAP_STATE_DISCOVERY;
|
||||||
|
|
||||||
|
|
||||||
cw_ktv_add(conn->local_cfg, "discovery_type", CW_TYPE_BYTE, &dtype,1);
|
/*cw_ktv_add(conn->local_cfg, "discovery-type", CW_TYPE_BYTE, &dtype,17);*/
|
||||||
/* mbag_set_byte(conn->outgoing, CW_ITEM_DISCOVERY_TYPE,
|
|
||||||
CAPWAP_DISCOVERY_TYPE_UNKNOWN);
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cw_init_request(conn, CAPWAP_MSG_DISCOVERY_REQUEST);
|
cw_init_request(conn, CAPWAP_MSG_DISCOVERY_REQUEST);
|
||||||
@ -39,11 +35,11 @@ static int run_discovery(struct conn *conn)
|
|||||||
|
|
||||||
timer = cw_timer_start(0);
|
timer = cw_timer_start(0);
|
||||||
|
|
||||||
/*
|
|
||||||
while (!cw_timer_timeout(timer)
|
while (!cw_timer_timeout(timer)
|
||||||
&& conn->capwap_state == CAPWAP_STATE_DISCOVERY) {
|
&& conn->capwap_state == CAPWAP_STATE_DISCOVERY) {
|
||||||
int rc;
|
int rc;
|
||||||
mavl_del_all(conn->incomming);
|
/*mavl_del_all(conn->incomming);*/
|
||||||
|
|
||||||
rc = cw_read_from(conn);
|
rc = cw_read_from(conn);
|
||||||
|
|
||||||
@ -55,7 +51,7 @@ static int run_discovery(struct conn *conn)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
mbag_t discs;
|
mbag_t discs;
|
||||||
|
@ -50,6 +50,7 @@ static int parse_args (int argc, char *argv[], struct bootcfg * bootcfg)
|
|||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
bootcfg->cfgfilename = optarg;
|
bootcfg->cfgfilename = optarg;
|
||||||
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
default:
|
default:
|
||||||
@ -101,10 +102,12 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
/* read the initial config file */
|
/* read the initial config file */
|
||||||
file = fopen(bootcfg.cfgfilename,"r");
|
file = fopen(bootcfg.cfgfilename,"r");
|
||||||
|
|
||||||
if (file == NULL){
|
if (file == NULL){
|
||||||
cw_log(LOG_ERR,"Cant open file '%s':%s", strerror(errno));
|
cw_log(LOG_ERR,"Can't open file '%s':%s",bootcfg.cfgfilename, strerror(errno));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
cw_ktv_read_file(file,global_cfg,types_tree);
|
cw_ktv_read_file(file,global_cfg,types_tree);
|
||||||
|
|
||||||
|
|
||||||
@ -133,8 +136,8 @@ int main (int argc, char **argv)
|
|||||||
conn->dtls_mtu = 12000;
|
conn->dtls_mtu = 12000;
|
||||||
conn->msgset=msgset;
|
conn->msgset=msgset;
|
||||||
conn->local_cfg = global_cfg;
|
conn->local_cfg = global_cfg;
|
||||||
|
conn->remote_cfg = cw_ktv_create();
|
||||||
|
conn->receiver = CW_RECEIVER_WTP;
|
||||||
|
|
||||||
cw_run_discovery(conn, "255.255.255.255",NULL);
|
cw_run_discovery(conn, "255.255.255.255",NULL);
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
<File Name="src/wtp/join.c"/>
|
<File Name="src/wtp/join.c"/>
|
||||||
<File Name="src/wtp/sulking.c"/>
|
<File Name="src/wtp/sulking.c"/>
|
||||||
<File Name="src/wtp/wtpdrv.h"/>
|
<File Name="src/wtp/wtpdrv.h"/>
|
||||||
|
<File Name="src/wtp/discovery.c"/>
|
||||||
</VirtualDirectory>
|
</VirtualDirectory>
|
||||||
</VirtualDirectory>
|
</VirtualDirectory>
|
||||||
<Description/>
|
<Description/>
|
||||||
|
Loading…
Reference in New Issue
Block a user