diff --git a/mod_cisco.project b/mod_cisco.project index eb8d2f99..d1c43e00 100644 --- a/mod_cisco.project +++ b/mod_cisco.project @@ -35,6 +35,7 @@ + diff --git a/src/cw/conn_process_packet.c b/src/cw/conn_process_packet.c index af81c6d4..7045fd22 100644 --- a/src/cw/conn_process_packet.c +++ b/src/cw/conn_process_packet.c @@ -275,19 +275,11 @@ printf("We have loaded the message set\n"); struct cw_MsgData search; search.type = cw_get_msg_id(msg_ptr); struct cw_MsgData * message; + /* Search for message combination */ message = mavl_get(conn->msgset->messages,&search); -printf("Got Message %d (%s)\n", message->type, message->name); -exit(0); -/* - as.capwap_state = conn->capwap_state; - as.msg_id = cw_get_msg_id(msg_ptr); - as.vendor_id = 0; - as.elem_id = 0; - as.proto = 0; -*/ - /* Search for state/message combination */ + // afm = cw_actionlist_in_get(conn->actions->in, &as); if (!afm) { diff --git a/src/mod/capwap/capwap_actions_ac.c b/src/mod/capwap/capwap_actions_ac.c index 50886051..233f071b 100644 --- a/src/mod/capwap/capwap_actions_ac.c +++ b/src/mod/capwap/capwap_actions_ac.c @@ -132,7 +132,7 @@ static cw_msgdef_t messages[] = { -struct cw_MsgSet * capwap_register_msg_set(struct cw_MsgSet * set, int mode){ +struct cw_MsgSet * cisco_register_msg_set(struct cw_MsgSet * set, int mode){ if (mode != CW_MOD_MODE_CAPWAP) return NULL; cw_msgset_add(set,messages); diff --git a/src/mod/cisco/cisco.h b/src/mod/cisco/cisco.h index 8b507e98..26dfefd5 100644 --- a/src/mod/cisco/cisco.h +++ b/src/mod/cisco/cisco.h @@ -51,5 +51,5 @@ int cisco_out_wtp_operational_state(struct conn *conn, struct cw_action_out *a, int cisco_out_radio_operational_state(struct conn *conn, struct cw_action_out *a, uint8_t * dst); int cisco_in_radio_operational_state(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len, struct sockaddr *from); - +struct cw_MsgSet * cisco_register_msg_set(struct cw_MsgSet * set, int mode); #endif diff --git a/src/mod/cisco/cisco_actions_ac.c b/src/mod/cisco/cisco_actions_ac.c index 72125bbc..858d2f31 100644 --- a/src/mod/cisco/cisco_actions_ac.c +++ b/src/mod/cisco/cisco_actions_ac.c @@ -41,6 +41,62 @@ #include "include/cipwap_items.h" + +static cw_elem_handler_t _DISCOVERY_TYPE = { + .id = CAPWAP_ELEM_DISCOVERY_TYPE, + .name = "WTP Frame Tunnel Mode", +// .start = cw_in_generic2, +// .item_id = CW_ITEM_WTP_FRAME_TUNNEL_MODE, + .min_len = 1, + .max_len = 1 +}; + + +static cw_msgdef_t messages[] = { + + /* Discovery Request Message*/ + { + .name = "Discovery Request Cisco", + .type = CAPWAP_MSG_DISCOVERY_REQUEST, + .states = (int[]){CAPWAP_STATE_DISCOVERY,0}, + .elements = (cw_msgelemprops_t []){ + {&_DISCOVERY_TYPE,1}, + {0,0}, + } + }, + /* Discovery Request Response */ + { + .name = "Discovery Response", + .type = CAPWAP_MSG_DISCOVERY_RESPONSE, + .states = (int[]){CAPWAP_STATE_DISCOVERY,0}, + .elements = (cw_msgelemprops_t[]){ + {0,0}, + } + }, + {0,0,0,0} + + + +}; + + + + + + + + + + + + + + + + + + + static cw_action_in_t actions_in[] = { @@ -493,6 +549,15 @@ static cw_action_out_t actions_out[]={ }; + +struct cw_MsgSet * cisco_register_msg_set(struct cw_MsgSet * set, int mode){ + if (mode != CW_MOD_MODE_CAPWAP) + return NULL; + cw_msgset_add(set,messages); + return set; +} + + static cw_action_in_t actions80211_in[] = { /* -------------------------------------------------------- * Discovery Resquest diff --git a/src/mod/cisco/mod_cisco.h b/src/mod/cisco/mod_cisco.h index ebc90140..c1f8ee36 100644 --- a/src/mod/cisco/mod_cisco.h +++ b/src/mod/cisco/mod_cisco.h @@ -4,5 +4,6 @@ struct cw_Mod * mod_cisco_ac(); struct cw_Mod * mod_cisco_wtp(); +struct cw_MsgSet * cisco_register_msg_set(struct cw_MsgSet * set, int mode); #endif diff --git a/src/mod/cisco/mod_cisco_ac.c b/src/mod/cisco/mod_cisco_ac.c index 3adf3a96..3eab725a 100644 --- a/src/mod/cisco/mod_cisco_ac.c +++ b/src/mod/cisco/mod_cisco_ac.c @@ -21,21 +21,21 @@ extern int cisco_register_actions_ac(struct cw_actiondef *def); mbag_t cisco_config = NULL; -static int register_actions(struct cw_actiondef *actions, int mode) +static struct cw_MsgSet * register_messages(struct cw_MsgSet *set, int mode) { switch (mode) { case CW_MOD_MODE_CAPWAP: { - struct cw_Mod *cmod = NULL; //modload_ac("cipwap"); + struct cw_Mod *cmod = cw_mod_load("capwap");// NULL; //modload_ac("cipwap"); if (!cmod) { cw_log(LOG_ERR, - "Can't initialize mod_cisco, failed to load base mod mod_cipwap"); + "Can't initialize mod_cisco, failed to load base module mod_cipwap"); return 1; } - cmod->register_actions(actions, CW_MOD_MODE_CAPWAP); - int rc = cisco_register_actions_ac(actions); - cw_dbg(DBG_INFO, "Initialized mod_cisco with %d actions", rc); + cmod->register_messages(set, CW_MOD_MODE_CAPWAP); + cisco_register_msg_set(set,CW_MOD_MODE_CAPWAP); + cw_dbg(DBG_INFO, "Initialized mod_cisco with %d messafe", 7); return 0; } case MOD_MODE_BINDINGS: @@ -46,9 +46,9 @@ static int register_actions(struct cw_actiondef *actions, int mode) "Can't initialize mod_cisco, failed to load base mod mod_capwap80211"); return 1; } - cmod->register_actions(actions, MOD_MODE_BINDINGS); - int rc = cisco_register_actions80211_ac(actions); - cw_dbg(DBG_INFO, "Initialized mod_cisco 80211 with %d actions", rc); + cmod->register_messages(set, MOD_MODE_BINDINGS); + int rc = cisco_register_actions80211_ac(set); + cw_dbg(DBG_INFO, "Initialized mod_cisco 80211 with %d actions", 12); return 0; } @@ -172,7 +172,7 @@ static struct cw_Mod capwap_ac = { .init = init, .detect = detect, // .register_actions = register_actions, - + .register_messages = register_messages }; struct cw_Mod *mod_cisco_ac()