WTP Reboot Statistics
FossilOrigin-Name: 9317f838e1c76e55e5a1dfc684c014d10455b5006f152987ea2197b7d62c385b
This commit is contained in:
		| @ -148,6 +148,7 @@ CAPWAPOBJS= \ | |||||||
| 	cw_out_generic.o \ | 	cw_out_generic.o \ | ||||||
| 	cw_out_wtp_descriptor.o \ | 	cw_out_wtp_descriptor.o \ | ||||||
| 	cw_out_wtp_reboot_statistics.o \ | 	cw_out_wtp_reboot_statistics.o \ | ||||||
|  | 	cw_in_wtp_reboot_statistics.o\ | ||||||
| 	cw_in_cisco_image_identifier.o\ | 	cw_in_cisco_image_identifier.o\ | ||||||
| 	cw_out_radio_operational_state.o\ | 	cw_out_radio_operational_state.o\ | ||||||
| 	cw_in_ac_descriptor.o\ | 	cw_in_ac_descriptor.o\ | ||||||
|  | |||||||
							
								
								
									
										20
									
								
								src/cw/cw.h
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								src/cw/cw.h
									
									
									
									
									
								
							| @ -398,6 +398,13 @@ extern int cw_in_mtu_discovery_padding(struct conn *conn, struct cw_action_in *a | |||||||
|  * @defgroup CWELEMIN Input Handlers for Message Elements |  * @defgroup CWELEMIN Input Handlers for Message Elements | ||||||
|  * @{ |  * @{ | ||||||
|  */ |  */ | ||||||
|  | extern int cw_in_wtp_reboot_statistics(struct conn *conn, struct cw_action_in *a, uint8_t * data, | ||||||
|  | 			 int len, struct sockaddr *from); | ||||||
|  |  | ||||||
|  |  | ||||||
|  | extern int cw_in_wtp_board_data(struct conn *conn, struct cw_action_in *a, uint8_t * data, | ||||||
|  | 			 int len, struct sockaddr *from); | ||||||
|  |  | ||||||
| extern int cw_in_vendor_specific_payload(struct conn *conn, struct cw_action_in *a, | extern int cw_in_vendor_specific_payload(struct conn *conn, struct cw_action_in *a, | ||||||
| 					 uint8_t * data, int len, struct sockaddr *from); | 					 uint8_t * data, int len, struct sockaddr *from); | ||||||
|  |  | ||||||
| @ -406,13 +413,15 @@ extern int cw_in_capwap_control_ip_address(struct conn *conn, struct cw_action_i | |||||||
| 					   struct sockaddr *from); | 					   struct sockaddr *from); | ||||||
|  |  | ||||||
| extern int cw_in_capwap_local_ipv4_address(struct conn *conn, struct cw_action_in *a, | extern int cw_in_capwap_local_ipv4_address(struct conn *conn, struct cw_action_in *a, | ||||||
| 				 uint8_t * data, int len,struct sockaddr *from); | 					   uint8_t * data, int len, | ||||||
|  | 					   struct sockaddr *from); | ||||||
|  |  | ||||||
| extern int cw_in_capwap_local_ipv6_address(struct conn *conn, struct cw_action_in *a, | extern int cw_in_capwap_local_ipv6_address(struct conn *conn, struct cw_action_in *a, | ||||||
| 				 uint8_t * data, int len,struct sockaddr *from); | 					   uint8_t * data, int len, | ||||||
|  | 					   struct sockaddr *from); | ||||||
|  |  | ||||||
| extern int cw_in_radio_operational_state(struct conn *conn, struct cw_action_in *a, uint8_t * data, | extern int cw_in_radio_operational_state(struct conn *conn, struct cw_action_in *a, | ||||||
| 			int len, struct sockaddr *from); | 					 uint8_t * data, int len, struct sockaddr *from); | ||||||
|  |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @ -426,6 +435,9 @@ extern int cw_in_radio_operational_state(struct conn *conn, struct cw_action_in | |||||||
|  */ |  */ | ||||||
| extern int cw_out_capwap_local_ip_address(struct conn *conn, struct cw_action_out *action, | extern int cw_out_capwap_local_ip_address(struct conn *conn, struct cw_action_out *action, | ||||||
| 					  uint8_t * dst); | 					  uint8_t * dst); | ||||||
|  | extern int cw_out_wtp_reboot_statistics(struct conn *conn, struct cw_action_out *a, | ||||||
|  | 					uint8_t * dst); | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * @} |  * @} | ||||||
|  */ |  */ | ||||||
|  | |||||||
| @ -64,7 +64,7 @@ static int read_subeelms(struct conn *conn,struct cw_action_in * a,uint8_t *data | |||||||
| 		uint32_t vendor_id = cw_get_dword(data+sub); | 		uint32_t vendor_id = cw_get_dword(data+sub); | ||||||
| 		int sublen = cw_get_word(data+sub+6); | 		int sublen = cw_get_word(data+sub+6); | ||||||
| 		int subtype = cw_get_word(data+sub+4); | 		int subtype = cw_get_word(data+sub+4); | ||||||
| printf("substart : %d\n",sub); | //printf("substart : %d\n",sub); | ||||||
|  |  | ||||||
| 		bstrv_t vstr=NULL; | 		bstrv_t vstr=NULL; | ||||||
| 		switch (subtype){ | 		switch (subtype){ | ||||||
|  | |||||||
							
								
								
									
										46
									
								
								src/cw/cw_in_wtp_reboot_statistics.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								src/cw/cw_in_wtp_reboot_statistics.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,46 @@ | |||||||
|  | /* | ||||||
|  |     This file is part of libcapwap. | ||||||
|  |  | ||||||
|  |     libcapwap is free software: you can redistribute it and/or modify | ||||||
|  |     it under the terms of the GNU General Public License as published by | ||||||
|  |     the Free Software Foundation, either version 3 of the License, or | ||||||
|  |     (at your option) any later version. | ||||||
|  |  | ||||||
|  |     libcapwap is distributed in the hope that it will be useful, | ||||||
|  |     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |     GNU General Public License for more details. | ||||||
|  |  | ||||||
|  |     You should have received a copy of the GNU General Public License | ||||||
|  |     along with Foobar.  If not, see <http://www.gnu.org/licenses/>. | ||||||
|  |  | ||||||
|  | */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #include "cw.h" | ||||||
|  | #include "log.h" | ||||||
|  | #include "capwap_items.h" | ||||||
|  |  | ||||||
|  | int cw_in_wtp_reboot_statistics(struct conn *conn, struct cw_action_in *a, uint8_t * data, | ||||||
|  | 			 int len, struct sockaddr *from) | ||||||
|  | { | ||||||
|  | 	mbag_t rs = mbag_create(); | ||||||
|  | 	if (!rs) { | ||||||
|  | 		cw_log(LOG_ERR,"Can't create REBOOT_STATISITCS"); | ||||||
|  | 		return 0; | ||||||
|  | 	}		 | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 	mbag_set_word( rs, CW_ITEM_REBOOT_COUNT,cw_get_word(data+0) ); | ||||||
|  | 	mbag_set_word( rs, CW_ITEM_REBOOT_AC_INITIATED_COUNT,cw_get_word(data+2) ); | ||||||
|  | 	mbag_set_word( rs, CW_ITEM_REBOOT_LINK_FAILURE_COUNT,cw_get_word(data+2) ); | ||||||
|  | 	mbag_set_word( rs, CW_ITEM_REBOOT_SW_FAILURE_COUNT,cw_get_word(data+4) ); | ||||||
|  | 	mbag_set_word( rs, CW_ITEM_REBOOT_HW_FAILURE_COUNT,cw_get_word(data+6) ); | ||||||
|  | 	mbag_set_word( rs, CW_ITEM_REBOOT_OTHER_FAILURE_COUNT,cw_get_word(data+8) ); | ||||||
|  | 	mbag_set_word( rs, CW_ITEM_REBOOT_UNKNOWN_FAILURE_COUNT,cw_get_word(data+10) ); | ||||||
|  | 	mbag_set_byte( rs, CW_ITEM_REBOOT_LAST_FAILURE_TYPE,cw_get_byte(data+12) ); | ||||||
|  |  | ||||||
|  | 	return 1; | ||||||
|  |  | ||||||
|  | } | ||||||
|  |  | ||||||
| @ -73,7 +73,7 @@ int cw_put_msg(struct conn *conn, uint8_t * rawout) | |||||||
| 		cw_action_out_t *ae=(cw_action_out_t*)e->data; | 		cw_action_out_t *ae=(cw_action_out_t*)e->data; | ||||||
|  |  | ||||||
| 		DBGX("Put %d %i %p\n",ae->msg_id,ae->elem_id,ae->item_id); | 		DBGX("Put %d %i %p\n",ae->msg_id,ae->elem_id,ae->item_id); | ||||||
| 		printf("Put %d %i %s\n",ae->msg_id,ae->elem_id,ae->item_id); | 		//printf("Put %d %i %s\n",ae->msg_id,ae->elem_id,ae->item_id); | ||||||
| 		DBGX("Elem ID %s",ae->item_id); | 		DBGX("Elem ID %s",ae->item_id); | ||||||
| 		if ( ae->item_id ) { | 		if ( ae->item_id ) { | ||||||
| 			DBGX("Item ID: %s %p",ae->item_id,CW_ITEM_NONE); | 			DBGX("Item ID: %s %p",ae->item_id,CW_ITEM_NONE); | ||||||
| @ -86,11 +86,11 @@ int cw_put_msg(struct conn *conn, uint8_t * rawout) | |||||||
| 		if (ae->out) { | 		if (ae->out) { | ||||||
| 			int l=0; | 			int l=0; | ||||||
|  |  | ||||||
| 			printf("Out Call with len =%d\n",len); | 		//	printf("Out Call with len =%d\n",len); | ||||||
|  |  | ||||||
| 			l= ae->out(conn, ae, dst+len);  | 			l= ae->out(conn, ae, dst+len);  | ||||||
|  |  | ||||||
| 			printf("Returned len = %d\n",l); | 		//	printf("Returned len = %d\n",l); | ||||||
|  |  | ||||||
|  |  | ||||||
| 			len +=l; | 			len +=l; | ||||||
|  | |||||||
| @ -1,40 +0,0 @@ | |||||||
| /* |  | ||||||
|     This file is part of libcapwap. |  | ||||||
|  |  | ||||||
|     libcapwap is free software: you can redistribute it and/or modify |  | ||||||
|     it under the terms of the GNU General Public License as published by |  | ||||||
|     the Free Software Foundation, either version 3 of the License, or |  | ||||||
|     (at your option) any later version. |  | ||||||
|  |  | ||||||
|     libcapwap is distributed in the hope that it will be useful, |  | ||||||
|     but WITHOUT ANY WARRANTY; without even the implied warranty of |  | ||||||
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the |  | ||||||
|     GNU General Public License for more details. |  | ||||||
|  |  | ||||||
|     You should have received a copy of the GNU General Public License |  | ||||||
|     along with Foobar.  If not, see <http://www.gnu.org/licenses/>. |  | ||||||
|  |  | ||||||
| */ |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #include "capwap.h" |  | ||||||
| #include "wtpinfo.h" |  | ||||||
|  |  | ||||||
|  |  | ||||||
| int cw_readelem_wtp_reboot_statistics(struct wtp_reboot_statistics *s, int type,uint8_t *msgelem, int len) |  | ||||||
| { |  | ||||||
| 	if (type != CW_ELEM_WTP_REBOOT_STATISTICS) |  | ||||||
| 		return 0; |  | ||||||
|  |  | ||||||
| 	s->reboot_count=ntohs(*((uint16_t*)(msgelem+0))); |  | ||||||
| 	s->ac_initiated_count=ntohs(*((uint16_t*)(msgelem+2))); |  | ||||||
| 	s->link_failure_count=ntohs(*((uint16_t*)(msgelem+4))); |  | ||||||
| 	s->sw_failure_count=ntohs(*((uint16_t*)(msgelem+6))); |  | ||||||
| 	s->hw_failure_count=ntohs(*((uint16_t*)(msgelem+8))); |  | ||||||
| 	s->other_failure_count=ntohs(*((uint16_t*)(msgelem+10))); |  | ||||||
| 	s->unknown_failure_count=ntohs(*((uint16_t*)(msgelem+12))); |  | ||||||
| 	s->last_failure_type=*(msgelem+14); |  | ||||||
|  |  | ||||||
| 	return 1;	 |  | ||||||
| } |  | ||||||
|  |  | ||||||
| @ -281,6 +281,18 @@ static cw_action_in_t actions_in[] = { | |||||||
| 	} | 	} | ||||||
| 	, | 	, | ||||||
|  |  | ||||||
|  | 	/* WTP Reboot Statistics - Join Request */ | ||||||
|  | 	{ | ||||||
|  | 		.capwap_state = CW_STATE_JOIN,  | ||||||
|  | 		.msg_id = CW_MSG_JOIN_REQUEST,  | ||||||
|  | 		.elem_id = CW_ELEM_WTP_REBOOT_STATISTICS, | ||||||
|  | 	 	.start = cw_in_wtp_reboot_statistics,  | ||||||
|  | 		.item_id = CW_ITEM_WTP_REBOOT_STATISTICS,  | ||||||
|  | 		.min_len = 15,  | ||||||
|  | 		.max_len = 15 | ||||||
|  | 	} | ||||||
|  | 	, | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	/* -------------------------------------------------------------------------- | 	/* -------------------------------------------------------------------------- | ||||||
|  | |||||||
| @ -329,11 +329,21 @@ static cw_action_out_t actions_out[] = { | |||||||
| 		.msg_id = CW_MSG_JOIN_REQUEST,  | 		.msg_id = CW_MSG_JOIN_REQUEST,  | ||||||
| 		.item_id = CW_ITEM_CAPWAP_LOCAL_IP_ADDRESS,  | 		.item_id = CW_ITEM_CAPWAP_LOCAL_IP_ADDRESS,  | ||||||
| 		.out = cw_out_capwap_local_ip_address, | 		.out = cw_out_capwap_local_ip_address, | ||||||
| 	//	.get = cw_out_get_config, |  | ||||||
| 		.mand = 1 | 		.mand = 1 | ||||||
| 	} | 	} | ||||||
| 	, | 	, | ||||||
|  |  | ||||||
|  | 	/* WTP Reboot Statistics - Join Request */ | ||||||
|  | 	{ | ||||||
|  | 		.msg_id = CW_MSG_JOIN_REQUEST,  | ||||||
|  | 		.elem_id = CW_ELEM_WTP_REBOOT_STATISTICS, | ||||||
|  | 		.item_id = CW_ITEM_WTP_REBOOT_STATISTICS,  | ||||||
|  | 		.out = cw_out_wtp_reboot_statistics, | ||||||
|  | 		.get = cw_out_get_config, | ||||||
|  | 		.mand = 0 | ||||||
|  | 	} | ||||||
|  | 	, | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user