Work on mods.
FossilOrigin-Name: dd9a471a2121d864295d81ab5c115a4995914e73f49481a80e2981b117860e0a
This commit is contained in:
parent
55a18b64cf
commit
b9c5bdb2a8
@ -519,7 +519,13 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr)
|
|||||||
|
|
||||||
cw_dbg(DBG_INFO,"Creating wtpman on socket %d, %s:%d",sockfd,sock_addr2str(&dbgaddr),sock_getport(&dbgaddr));
|
cw_dbg(DBG_INFO,"Creating wtpman on socket %d, %s:%d",sockfd,sock_addr2str(&dbgaddr),sock_getport(&dbgaddr));
|
||||||
|
|
||||||
|
extern int conn_process_packet2(struct conn *conn, uint8_t * packet, int len,
|
||||||
|
struct sockaddr *from);
|
||||||
|
|
||||||
wtpman->conn = conn_create(sockfd, srcaddr, 100);
|
wtpman->conn = conn_create(sockfd, srcaddr, 100);
|
||||||
|
|
||||||
|
// wtpman->conn->process_packet = conn_process_packet2;
|
||||||
|
|
||||||
if (!wtpman->conn) {
|
if (!wtpman->conn) {
|
||||||
wtpman_destroy(wtpman);
|
wtpman_destroy(wtpman);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -189,6 +189,7 @@ DTLSOBJS+=dtls_bio.o
|
|||||||
|
|
||||||
CONNOBJS= conn_create.o \
|
CONNOBJS= conn_create.o \
|
||||||
conn_process_packet.o \
|
conn_process_packet.o \
|
||||||
|
conn_process_packet2.o \
|
||||||
conn_q_add_packet.o \
|
conn_q_add_packet.o \
|
||||||
conn_q_get_packet.o \
|
conn_q_get_packet.o \
|
||||||
conn_q_recv_packet.o \
|
conn_q_recv_packet.o \
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
#include "conn.h"
|
#include "conn.h"
|
||||||
#include "sock.h"
|
#include "sock.h"
|
||||||
|
|
||||||
|
#include "stravltree.h"
|
||||||
|
|
||||||
|
|
||||||
int conn_send_msg(struct conn *conn, uint8_t * rawmsg);
|
int conn_send_msg(struct conn *conn, uint8_t * rawmsg);
|
||||||
|
|
||||||
@ -246,7 +248,7 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
|||||||
uint8_t *elem;
|
uint8_t *elem;
|
||||||
|
|
||||||
/* Create an avltree to catch the found mandatory elements */
|
/* Create an avltree to catch the found mandatory elements */
|
||||||
conn->mand = intavltree_create();
|
conn->mand = stravltree_create();
|
||||||
|
|
||||||
/* iterate through message elements */
|
/* iterate through message elements */
|
||||||
cw_foreach_elem(elem, elems_ptr, elems_len) {
|
cw_foreach_elem(elem, elems_ptr, elems_len) {
|
||||||
@ -278,7 +280,7 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
|||||||
if (af->mand && afrc) {
|
if (af->mand && afrc) {
|
||||||
/* add found mandatory message element
|
/* add found mandatory message element
|
||||||
to mand list */
|
to mand list */
|
||||||
intavltree_add(conn->mand, (int) af->item_id);
|
stravltree_add(conn->mand, af->item_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -312,7 +314,7 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
intavltree_destroy(conn->mand);
|
stravltree_destroy(conn->mand);
|
||||||
|
|
||||||
return result_code;
|
return result_code;
|
||||||
|
|
||||||
|
@ -393,7 +393,7 @@ int process_message(struct conn *conn, uint8_t * rawmsg, int rawlen,
|
|||||||
* @param packet pointer to packet data
|
* @param packet pointer to packet data
|
||||||
* @param len lenght of packet data
|
* @param len lenght of packet data
|
||||||
*/
|
*/
|
||||||
int conn_process_packet(struct conn *conn, uint8_t * packet, int len,
|
int conn_process_packet2(struct conn *conn, uint8_t * packet, int len,
|
||||||
struct sockaddr *from)
|
struct sockaddr *from)
|
||||||
{
|
{
|
||||||
/* show this packet in debug output */
|
/* show this packet in debug output */
|
||||||
|
@ -74,8 +74,8 @@ int cw_check_missing_mand(cw_action_in_t ** out, struct conn * conn, cw_action_i
|
|||||||
if (!ai->mand)
|
if (!ai->mand)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int i = (intptr_t)ai->item_id;
|
// int i = (intptr_t)ai->item_id;
|
||||||
void * rc = mavl_get(conn->mand,&i);
|
void * rc = mavl_get(conn->mand,(void*)ai->item_id);
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
out[n++]=ai;
|
out[n++]=ai;
|
||||||
}
|
}
|
||||||
|
@ -33,44 +33,6 @@ int static do_save(mbag_t itemstore, struct conn *conn, struct cw_action_in *a,
|
|||||||
uint8_t * data, int len, struct sockaddr *from)
|
uint8_t * data, int len, struct sockaddr *from)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (a->itemtype == MBAG_BYTE) {
|
|
||||||
mbag_set_byte(itemstore, a->item_id, *data);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (a->itemtype == MBAG_WORD) {
|
|
||||||
mbag_set_word(itemstore, a->item_id, cw_get_word(data));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (a->itemtype == MBAG_DWORD) {
|
|
||||||
mbag_set_dword(itemstore, a->item_id, cw_get_dword(data));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (a->itemtype == MBAG_STR) {
|
|
||||||
mbag_set_strn(itemstore, a->item_id, (char *) data, len);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (a->itemtype == MBAG_BSTR) {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (a->itemtype == MBAG_VENDORSTR) {
|
|
||||||
mbag_set_vendorstr(itemstore, a->item_id,
|
|
||||||
cw_get_dword(data), data + 4, len - 4);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const cw_itemdef_t * idef = cw_itemdef_get(conn->actions->items,a->item_id,CW_ITEM_NONE);
|
const cw_itemdef_t * idef = cw_itemdef_get(conn->actions->items,a->item_id,CW_ITEM_NONE);
|
||||||
|
|
||||||
if (!idef) {
|
if (!idef) {
|
||||||
@ -79,13 +41,54 @@ int static do_save(mbag_t itemstore, struct conn *conn, struct cw_action_in *a,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (idef->type == MBAG_BYTE) {
|
||||||
|
mbag_set_byte(itemstore, a->item_id, *data);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (idef->type == MBAG_WORD) {
|
||||||
|
mbag_set_word(itemstore, a->item_id, cw_get_word(data));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (idef->type == MBAG_DWORD) {
|
||||||
|
mbag_set_dword(itemstore, a->item_id, cw_get_dword(data));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (idef->type == MBAG_STR) {
|
||||||
|
mbag_set_strn(itemstore, a->item_id, (char *) data, len);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (idef->type == MBAG_BSTR) {
|
||||||
|
mbag_set_bstrn(itemstore, a->item_id, data, len);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (idef->type == MBAG_BSTR16) {
|
||||||
|
mbag_set_bstr16n(itemstore, a->item_id, data, len);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if (idef->type == MBAG_DATA) {
|
||||||
|
mbag_set_data(itemstore, a->item_id, data, len);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
if (idef->type == MBAG_VENDORSTR) {
|
||||||
|
mbag_set_vendorstr(itemstore, a->item_id,
|
||||||
|
cw_get_dword(data), data + 4, len - 4);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// printf("Idef: %s\n",idef->type->name);
|
// printf("Idef: %s\n",idef->type->name);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cw_log(LOG_ERR,
|
cw_log(LOG_ERR,
|
||||||
"Can't handle item type %d in definition for incomming msg %d (%s) - %d, cw_in_generic.",
|
"Can't handle item type %d in definition for incomming msg %d (%s) - %d, cw_in_generic.",
|
||||||
a->itemtype, a->msg_id, cw_strmsg(a->msg_id), a->elem_id);
|
idef->type, a->msg_id, cw_strmsg(a->msg_id), a->elem_id);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,9 @@ include ../../../Config.mak
|
|||||||
|
|
||||||
OBJS=\
|
OBJS=\
|
||||||
mod_capwap_ac.o \
|
mod_capwap_ac.o \
|
||||||
capwap_actions_ac.o
|
capwap_actions_ac.o \
|
||||||
|
capwap_in_wtp_descriptor.o \
|
||||||
|
capwap_in_wtp_board_data.o
|
||||||
|
|
||||||
OBJS:=$(patsubst %.o,$(ARCH)/%.o,$(OBJS))
|
OBJS:=$(patsubst %.o,$(ARCH)/%.o,$(OBJS))
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include "capwap/strheap.h"
|
#include "capwap/strheap.h"
|
||||||
#include "capwap/radio.h"
|
#include "capwap/radio.h"
|
||||||
|
|
||||||
|
#include "mod_capwap.h"
|
||||||
|
|
||||||
cw_action_in_t _capwap_actions_ac_in[] = {
|
cw_action_in_t _capwap_actions_ac_in[] = {
|
||||||
|
|
||||||
@ -51,6 +51,70 @@ cw_action_in_t _capwap_actions_ac_in[] = {
|
|||||||
}
|
}
|
||||||
,
|
,
|
||||||
|
|
||||||
|
/* Element WTP Frame Tunnel Mode */
|
||||||
|
{
|
||||||
|
.capwap_state = CW_STATE_DISCOVERY,
|
||||||
|
.msg_id = CW_MSG_DISCOVERY_REQUEST,
|
||||||
|
.elem_id = CW_ELEM_WTP_FRAME_TUNNEL_MODE,
|
||||||
|
.start = cw_in_generic2,
|
||||||
|
.item_id = "wtp_frame_tunnel_mode",
|
||||||
|
.mand = 1,
|
||||||
|
.min_len = 1,
|
||||||
|
.max_len = 1
|
||||||
|
}
|
||||||
|
,
|
||||||
|
|
||||||
|
/* Element WTP Mac Type */
|
||||||
|
{
|
||||||
|
.capwap_state = CW_STATE_DISCOVERY,
|
||||||
|
.msg_id = CW_MSG_DISCOVERY_REQUEST,
|
||||||
|
.elem_id = CW_ELEM_WTP_MAC_TYPE,
|
||||||
|
.start = cw_in_generic2,
|
||||||
|
.item_id = "wtp_mac_type",
|
||||||
|
.mand = 1,
|
||||||
|
.min_len = 1,
|
||||||
|
.max_len = 1
|
||||||
|
}
|
||||||
|
,
|
||||||
|
|
||||||
|
|
||||||
|
/* Element WTP Descriptor */
|
||||||
|
{
|
||||||
|
.capwap_state = CW_STATE_DISCOVERY,
|
||||||
|
.msg_id = CW_MSG_DISCOVERY_REQUEST,
|
||||||
|
.elem_id = CW_ELEM_WTP_DESCRIPTOR,
|
||||||
|
.start = capwap_in_wtp_descriptor,
|
||||||
|
.item_id = "wtp_descriptor",
|
||||||
|
.mand = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
,
|
||||||
|
|
||||||
|
/* Element WTP Board Data */
|
||||||
|
{
|
||||||
|
.capwap_state = CW_STATE_DISCOVERY,
|
||||||
|
.msg_id = CW_MSG_DISCOVERY_REQUEST,
|
||||||
|
.elem_id = CW_ELEM_WTP_BOARD_DATA,
|
||||||
|
.start = capwap_in_wtp_board_data,
|
||||||
|
.item_id = "wtp_board_data",
|
||||||
|
.mand = 1,
|
||||||
|
}
|
||||||
|
// ,
|
||||||
|
|
||||||
|
/* Element WTP Board Data */
|
||||||
|
// {0, 0, CW_STATE_CONFIGURE, CW_MSG_DISCOVERY_REQUEST, CW_ACTION_IN_WTP_BOARD_DATA,
|
||||||
|
// 1}
|
||||||
|
,
|
||||||
|
|
||||||
|
|
||||||
|
/* Vendor Specific Payload */
|
||||||
|
{
|
||||||
|
.capwap_state = CW_STATE_DISCOVERY,
|
||||||
|
.msg_id = CW_MSG_DISCOVERY_REQUEST,
|
||||||
|
.elem_id = CW_ELEM_VENDOR_SPECIFIC_PAYLOAD,
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
/* Element WTP Name */
|
/* Element WTP Name */
|
||||||
{
|
{
|
||||||
.capwap_state = CW_STATE_DISCOVERY,
|
.capwap_state = CW_STATE_DISCOVERY,
|
||||||
@ -58,7 +122,7 @@ cw_action_in_t _capwap_actions_ac_in[] = {
|
|||||||
.elem_id = CW_ELEM_WTP_NAME,
|
.elem_id = CW_ELEM_WTP_NAME,
|
||||||
.start = cw_in_generic2,
|
.start = cw_in_generic2,
|
||||||
.item_id = "wtp_name",
|
.item_id = "wtp_name",
|
||||||
.mand = 1,
|
.mand = 0,
|
||||||
.min_len = 1,
|
.min_len = 1,
|
||||||
.max_len = 1024
|
.max_len = 1024
|
||||||
}
|
}
|
||||||
@ -76,6 +140,7 @@ static struct cw_itemdef _capwap_itemdefs[] = {
|
|||||||
{"wtp_name",CW_ITEM_NONE,MBAG_STR},
|
{"wtp_name",CW_ITEM_NONE,MBAG_STR},
|
||||||
{"wtp_mac_type",CW_ITEM_NONE,MBAG_BYTE},
|
{"wtp_mac_type",CW_ITEM_NONE,MBAG_BYTE},
|
||||||
{"discovery_type",CW_ITEM_NONE,MBAG_BYTE},
|
{"discovery_type",CW_ITEM_NONE,MBAG_BYTE},
|
||||||
|
{"wtp_frame_tunnel_mode",CW_ITEM_NONE,MBAG_BYTE},
|
||||||
{CW_ITEM_NONE}
|
{CW_ITEM_NONE}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -3,4 +3,12 @@
|
|||||||
|
|
||||||
struct mod_ac * mod_capwap_ac();
|
struct mod_ac * mod_capwap_ac();
|
||||||
|
|
||||||
|
|
||||||
|
extern int capwap_in_wtp_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||||
|
int len, struct sockaddr *from);
|
||||||
|
|
||||||
|
int capwap_in_wtp_board_data(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||||
|
int len, struct sockaddr *from);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -131,7 +131,8 @@ mavl_destroy(b);
|
|||||||
conn->local = mbag_create();
|
conn->local = mbag_create();
|
||||||
conn->base_rmac=get_base_rmac();
|
conn->base_rmac=get_base_rmac();
|
||||||
|
|
||||||
conn->capwap_mode = CW_MODE_CISCO;
|
conn->capwap_mode = CW_MODE_CAPWAP;
|
||||||
|
//conn->capwap_mode = CW_MODE_CISCO;
|
||||||
|
|
||||||
the_conn->strict_capwap=0;
|
the_conn->strict_capwap=0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user