WTP can save json now.

FossilOrigin-Name: 9670c29689c90b8e4378e10b56682028dd690d58e1a69da0f584c4c770cd2110
This commit is contained in:
7u83@mail.ru
2015-04-20 19:28:22 +00:00
parent 32fa2ae608
commit 8314c3aa98
11 changed files with 108 additions and 25 deletions

View File

@ -109,7 +109,6 @@ LWAPPCISCOOBJS = \
CAPWAPOBJS= \
wtpinfo.o \
aciplist.o \
lwmsg_init.o \
wtpinfo_lwreadelem_wtp_descriptor.o \
@ -160,6 +159,7 @@ CAPWAPOBJS= \
avliter_seek.o \
# wtpinfo.o \

View File

@ -59,6 +59,36 @@ static inline int cw_action_in_cmp(const void *elem1, const void *elem2)
}
cw_action_fun_t cw_set_msg_end_callback(struct conn *conn,
int capwap_state,int msg_id, cw_action_fun_t callback)
{
cw_action_in_t as;
/* prepare struct for search operation */
as.capwap_state = capwap_state;
as.msg_id = msg_id;
as.vendor_id = 0;
as.elem_id = 0;
as.proto = 0;
cw_action_in_t *af;
af = cw_actionlist_in_get(conn->actions->in, &as);
if (!af)
return NULL;
cw_action_fun_t old = af->end;
af->end =callback;
return old;
}
cw_action_in_t *cw_actionlist_in_add(cw_actionlist_in_t t, struct cw_action_in * a)
{
return cw_actionlist_add(t, a, sizeof(struct cw_action_in));
@ -190,3 +220,8 @@ cw_action_in_t *cw_actionlist_in_set_msg_end_callback(cw_actionlist_in_t a,
ar->end=fun;
return ar;
}

View File

@ -29,6 +29,8 @@
#include "intavltree.h"
/* Generic functions and structs */
void * cw_actionlist_add(struct avltree *t, void *a, size_t s);
@ -51,9 +53,13 @@ struct cw_action_in{
uint8_t mand;
};
typedef int(*cw_action_fun_t)(struct conn *,struct cw_action_in *,uint8_t*,int ,struct sockaddr *);
typedef struct cw_action_in cw_action_in_t;
extern cw_action_fun_t cw_set_msg_end_callback(struct conn *conn,
int capwap_state,int msg_id, cw_action_fun_t callback);
typedef struct avltree * cw_actionlist_in_t;
@ -69,6 +75,9 @@ extern cw_action_in_t *cw_actionlist_in_set_msg_end_callback(cw_actionlist_in_t
int len,struct sockaddr *from));
cw_action_fun_t cw_set_msg_end_callback(struct conn *conn,
int capwap_state,int msg_id, cw_action_fun_t callback);
/* Definitions for outgoing messages */
struct cw_action_out{
uint32_t msg_id;

View File

@ -542,10 +542,10 @@ extern int cw_readelem_vendor_specific_payload(void *data, int msgtype, int elem
13 Configuration Failure (Unable to Apply Requested Configuration
- Service Not Provided)
14 Image Data Error (Invalid Checksum)
*/
#define CW_RESULT_IMAGE_DATA_INVALID_CHECKSUM 14 //Image Data Error (Invalid Checksum)
#define CW_RESULT_IMAGE_DATA_IVALID_LENGTH 15 //Image Data Error (Invalid Data Length)
#define CW_RESULT_IMAGE_DATA_ERROR 16 //Image Data Error (Other Error)

View File

@ -6,6 +6,7 @@ struct cw_str capwap_strings_result[] = {
{CW_RESULT_SUCCESS,"Success"}, /* 0 */
{CW_RESULT_MISSING_AC_LIST,"AC List Message Element MUST be Present"}, /* 1 */
{CW_RESULT_SUCCESS_NAT,"Success - NAT Detected"}, /* 2 */
{CW_RESULT_IMAGE_DATA_INVALID_CHECKSUM,"Image Data Error (Invalid Checksum)"}, /* 14 */
{CW_RESULT_IMAGE_DATA_ERROR,"Image Data Error (Unspecified)"}, /* 16 */
{CW_RESULT_MISSING_MAND_ELEM,"Missing Mandatory Message Element"}, /* 20 */

View File

@ -28,6 +28,10 @@
cw_action_in_t cipwap_actions_wtp_in[] = {
{CW_VENDOR_ID_CISCO, 0, CW_STATE_RUN, CW_MSG_CONFIGURATION_UPDATE_REQUEST, CW_CISCO_RAD_NAME,
cw_in_generic, 0, MBAG_BSTR16,CW_ITEM_WTP_NAME,0,512}
,
{0, 0, 0}

View File

@ -229,7 +229,7 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,struct
uint8_t *elems_ptr = cw_get_msg_elems_ptr(msg_ptr);
uint8_t *elem;
/* avltree to bag the found mandatory elements */
/* Create an avltree to catch the found mandatory elements */
conn->mand = intavltree_create();
/* iterate through message elements */

View File

@ -47,6 +47,12 @@ int cw_in_generic(struct conn *conn, struct cw_action_in *a, uint8_t * data, int
mbag_set_bstrn(itemstore, a->item_id, data, len);
return 1;
}
if (a->itemtype == MBAG_BSTR16) {
mbag_set_bstr16n(itemstore, a->item_id, data, len);
return 1;
}
/* if (a->itemtype == MBAG_DATA) {
mbag_set_data(itemstore, a->item_id, data, len);
return 1;