Work on updating aps via sql
FossilOrigin-Name: 4b4d4dfa95b0aa4185bb4485f92d5ff3bbc7e4f99fffce654984b92ce55766d2
This commit is contained in:
@ -297,7 +297,8 @@ MBAGOBJS = \
|
||||
mbag_set_from_buf.o\
|
||||
mbag_type_str.o \
|
||||
mbag_type_ptr.o \
|
||||
mbag_type_data.o
|
||||
mbag_type_data.o \
|
||||
mbag_get_upd.o
|
||||
|
||||
|
||||
|
||||
|
@ -130,7 +130,7 @@ static inline int bstr16_ncpy(uint8_t *dst,uint8_t*src,uint16_t len)
|
||||
*/
|
||||
|
||||
|
||||
static inline uint8_t * bstr16_create(uint8_t *data, uint16_t len)
|
||||
static inline uint8_t * bstr16_create(const uint8_t *data, uint16_t len)
|
||||
{
|
||||
uint8_t * str = malloc(2+len*sizeof(uint8_t));
|
||||
if (!str)
|
||||
|
@ -54,7 +54,7 @@ struct cw_itemdef capwap80211_radioitemdefs[] = {
|
||||
{CW_RADIOITEM80211_SHORT_PREAMBLE,CW_ITEM_NONE,MBAG_BYTE},
|
||||
{CW_RADIOITEM80211_NUM_BSS_IDS,CW_ITEM_NONE,MBAG_BYTE},
|
||||
{CW_RADIOITEM80211_DTIM_PERIOD,CW_ITEM_NONE,MBAG_BYTE},
|
||||
{CW_RADIOITEM80211_BSSID,CW_ITEM_NONE,MBAG_BYTE},
|
||||
{CW_RADIOITEM80211_BSSID,CW_ITEM_NONE,MBAG_DATA},
|
||||
{CW_RADIOITEM80211_BEACON_PERIOD,CW_ITEM_NONE,MBAG_WORD},
|
||||
{CW_RADIOITEM80211_COUNTRY_STRING,CW_ITEM_NONE,MBAG_BSTR16},
|
||||
|
||||
|
@ -62,7 +62,9 @@ struct mbag_typedef{
|
||||
struct mbag_item * (*get)(const uint8_t*src, int len);
|
||||
|
||||
/** A method to put this object to a buffer */
|
||||
int (*put)(void *,uint8_t*dst);
|
||||
int (*put)(struct mbag_item *i,uint8_t*dst);
|
||||
|
||||
int (*def)(void *, void *);
|
||||
|
||||
};
|
||||
|
||||
|
@ -32,6 +32,28 @@ static struct mbag_item * from_str(const char *src)
|
||||
return i;
|
||||
}
|
||||
|
||||
int put(struct mbag_item *i, uint8_t *dst)
|
||||
{
|
||||
int l = bstr16_len(i->data);
|
||||
memcpy(dst,bstr16_data(i->data),l);
|
||||
return l;
|
||||
}
|
||||
|
||||
static struct mbag_item * get(const uint8_t *src, int len)
|
||||
{
|
||||
mbag_item_t * i = mbag_item_new(MBAG_BSTR16);
|
||||
if (!i)
|
||||
return NULL;
|
||||
i->data=bstr16_create(src,len);
|
||||
return i;
|
||||
|
||||
}
|
||||
|
||||
const struct mbag_typedef mbag_type_bstr16 = {
|
||||
"Bstr16",free,to_str,from_str
|
||||
.name = "Bstr16",
|
||||
.del = free,
|
||||
.to_str = to_str,
|
||||
.from_str = from_str,
|
||||
.get = get,
|
||||
.put = put
|
||||
};
|
||||
|
@ -54,7 +54,12 @@ static struct mbag_item * get(const uint8_t *src,int len)
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
static int put(struct mbag_item *i,uint8_t *dst)
|
||||
{
|
||||
int l = *((uint8_t*)i->data);
|
||||
memcpy(dst,i->data+1,l);
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
const struct mbag_typedef mbag_type_data = {
|
||||
@ -62,6 +67,7 @@ const struct mbag_typedef mbag_type_data = {
|
||||
.del = free,
|
||||
.from_str = from_str,
|
||||
.to_str = to_str,
|
||||
.get = get
|
||||
.get = get,
|
||||
.put = put
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user