More move to cw_Conn and conn-stuff within on file
This commit is contained in:
		
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							| @ -4,11 +4,13 @@ all: | |||||||
| 	$(MAKE) -C src/cw | 	$(MAKE) -C src/cw | ||||||
| 	$(MAKE) -C src/mod | 	$(MAKE) -C src/mod | ||||||
| 	$(MAKE) -C src/ac | 	$(MAKE) -C src/ac | ||||||
|  | 	$(MAKE) -C src/wtp | ||||||
| 	 | 	 | ||||||
|  |  | ||||||
| clean: | clean: | ||||||
| 	$(MAKE) -C src/cw clean | 	$(MAKE) -C src/cw clean | ||||||
| 	$(MAKE) -C src/mod clean | 	$(MAKE) -C src/mod clean | ||||||
| 	$(MAKE) -C src/ac clean | 	$(MAKE) -C src/ac clean | ||||||
|  | 	$(MAKE) -C src/wtp | ||||||
| 	 | 	 | ||||||
|  |  | ||||||
|  | |||||||
| @ -62,7 +62,7 @@ static void reset_echointerval_timer(struct wtpman *wtpman) | |||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /* | ||||||
| static int msg_start_handler(struct cw_Conn *conn, struct cw_action_in *a, | static int msg_start_handler(struct cw_Conn *conn, struct cw_action_in *a, | ||||||
| 			     uint8_t * data, int len, struct sockaddr *from) | 			     uint8_t * data, int len, struct sockaddr *from) | ||||||
| { | { | ||||||
| @ -71,7 +71,7 @@ static int msg_start_handler(struct cw_Conn *conn, struct cw_action_in *a, | |||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | */ | ||||||
|  |  | ||||||
|  |  | ||||||
| static void wtpman_remove(struct wtpman *wtpman) | static void wtpman_remove(struct wtpman *wtpman) | ||||||
| @ -92,7 +92,6 @@ static void wtpman_run_discovery(void *arg) | |||||||
|  |  | ||||||
| 	wtpman->conn->capwap_state = CAPWAP_STATE_DISCOVERY; | 	wtpman->conn->capwap_state = CAPWAP_STATE_DISCOVERY; | ||||||
|  |  | ||||||
|  |  | ||||||
| 	while (!cw_timer_timeout(timer) | 	while (!cw_timer_timeout(timer) | ||||||
| 	       && wtpman->conn->capwap_state == CAPWAP_STATE_DISCOVERY) { | 	       && wtpman->conn->capwap_state == CAPWAP_STATE_DISCOVERY) { | ||||||
| 		int rc; | 		int rc; | ||||||
| @ -328,7 +327,6 @@ static void *wtpman_main(void *arg) | |||||||
| 	char sock_buf[SOCK_ADDR_BUFSIZE]; | 	char sock_buf[SOCK_ADDR_BUFSIZE]; | ||||||
| 	struct cw_Conn *conn; | 	struct cw_Conn *conn; | ||||||
| 	int last_state; | 	int last_state; | ||||||
|  |  | ||||||
| 	struct wtpman *wtpman = (struct wtpman *) arg; | 	struct wtpman *wtpman = (struct wtpman *) arg; | ||||||
|  |  | ||||||
| 	wtpman->conn->seqnum = 0; | 	wtpman->conn->seqnum = 0; | ||||||
| @ -337,9 +335,9 @@ static void *wtpman_main(void *arg) | |||||||
| 	wtpman->conn->remote_cfg = cw_ktv_create(); | 	wtpman->conn->remote_cfg = cw_ktv_create(); | ||||||
|  |  | ||||||
|  |  | ||||||
| 	/* We were invoked with an unencrypted packet,  |  | ||||||
| 	 * so assume, it is a discovery request */ |  | ||||||
| 	if (!wtpman->dtlsmode) { | 	if (!wtpman->dtlsmode) { | ||||||
|  | 		/* We were invoked with an unencrypted packet,  | ||||||
|  | 		 * so assume, it is a discovery request */ | ||||||
| 		wtpman_run_discovery(arg); | 		wtpman_run_discovery(arg); | ||||||
| 		wtpman_remove(wtpman); | 		wtpman_remove(wtpman); | ||||||
| 		return NULL; | 		return NULL; | ||||||
| @ -691,7 +689,7 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr, | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	wtpman->conn = conn_create(sockfd, srcaddr, 100); | 	wtpman->conn = cw_conn_create(sockfd, srcaddr, 5); | ||||||
| 	wtpman->conn->role = CW_ROLE_AC; | 	wtpman->conn->role = CW_ROLE_AC; | ||||||
|  |  | ||||||
| 	wtpman->conn->data_sock = socklist[socklistindex].data_sockfd; | 	wtpman->conn->data_sock = socklist[socklistindex].data_sockfd; | ||||||
|  | |||||||
| @ -74,8 +74,7 @@ CWSRC=\ | |||||||
| 	cw_write_descriptor_subelem.c\ | 	cw_write_descriptor_subelem.c\ | ||||||
| 	cw_write_radio_element.c\ | 	cw_write_radio_element.c\ | ||||||
| 	cw_detect_nat.c\ | 	cw_detect_nat.c\ | ||||||
|  | 	cw_read_from.c \ | ||||||
| #cw_read_from.c \ |  | ||||||
|  |  | ||||||
| KTVSRC=\ | KTVSRC=\ | ||||||
| 	cw_ktv_add.c\ | 	cw_ktv_add.c\ | ||||||
| @ -177,10 +176,8 @@ MISCSRC=\ | |||||||
| 	capwap_strings_result.c\ | 	capwap_strings_result.c\ | ||||||
| 	capwap_strings_state.c\ | 	capwap_strings_state.c\ | ||||||
| 	capwap_strings_vendor.c\ | 	capwap_strings_vendor.c\ | ||||||
| 	conn_create.c\ |  | ||||||
| 	conn_create_noq.c\ | 	conn_create_noq.c\ | ||||||
| 	conn_destroy.c\ | 	conn_destroy.c\ | ||||||
| 	conn_init.c\ |  | ||||||
| 	connlist.c\ | 	connlist.c\ | ||||||
| 	conn_prepare_image_data_request.c\ | 	conn_prepare_image_data_request.c\ | ||||||
| 	conn_process_packet.c\ | 	conn_process_packet.c\ | ||||||
| @ -192,7 +189,6 @@ MISCSRC=\ | |||||||
| 	conn_send_data_packet.c\ | 	conn_send_data_packet.c\ | ||||||
| 	conn_send_msg.c\ | 	conn_send_msg.c\ | ||||||
| 	conn_send_packet.c\ | 	conn_send_packet.c\ | ||||||
| 	conn_send_request.c\ |  | ||||||
| 	dot11.c\ | 	dot11.c\ | ||||||
| 	dot11_inline.c\ | 	dot11_inline.c\ | ||||||
| 	format.c\ | 	format.c\ | ||||||
| @ -205,8 +201,12 @@ MISCSRC=\ | |||||||
| 	send.c\ | 	send.c\ | ||||||
| 	strheap.c\ | 	strheap.c\ | ||||||
| 	netconn.c\ | 	netconn.c\ | ||||||
|  | 	conn.c | ||||||
|  |  | ||||||
| #	conn_q_wait_packet.c\ | #	conn_q_wait_packet.c\ | ||||||
|  | #	conn_init.c\ | ||||||
|  | #	conn_create.c\ | ||||||
|  | #	conn_send_request.c\ | ||||||
|  |  | ||||||
| DTLSSRC+=\ | DTLSSRC+=\ | ||||||
| 	dtls_bio.c\ | 	dtls_bio.c\ | ||||||
| @ -267,3 +267,6 @@ dynamic: $(DNAME) | |||||||
| 	 | 	 | ||||||
| include ../lib.mk | include ../lib.mk | ||||||
|  |  | ||||||
|  | depend: | ||||||
|  | 	mkdep -c ${CFLAGS} ${SOURCES} | ||||||
|  |  | ||||||
|  | |||||||
							
								
								
									
										134
									
								
								src/cw/conn.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										134
									
								
								src/cw/conn.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,134 @@ | |||||||
|  | #include <string.h> | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #include "conn.h" | ||||||
|  | #include "capwap.h" | ||||||
|  | #include "cw.h" | ||||||
|  | #include <stdlib.h> | ||||||
|  | #include <string.h> | ||||||
|  | #include <errno.h> | ||||||
|  |  | ||||||
|  | #include "log.h" | ||||||
|  | #include "capwap.h" | ||||||
|  | #include "conn.h" | ||||||
|  | #include "sock.h" | ||||||
|  |  | ||||||
|  | #include "msgset.h" | ||||||
|  | #include "cw.h" | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | static int write_header(struct cw_ElemHandler * handler, uint8_t * dst, int len) | ||||||
|  | { | ||||||
|  | 	if (handler->vendor) | ||||||
|  | 		return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len); | ||||||
|  |  | ||||||
|  | 	return  len + cw_put_elem_hdr(dst, handler->id, len); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static int header_len(struct cw_ElemHandler * handler) | ||||||
|  | { | ||||||
|  | 	return handler->vendor ? 10 : 4; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Basic initialization of a conn object  | ||||||
|  |  * @param conn conn object to initialize | ||||||
|  |  */  | ||||||
|  | void cw_conn_init(struct cw_Conn * conn) | ||||||
|  | { | ||||||
|  | 	memset(conn,0,sizeof(struct cw_Conn )); | ||||||
|  | 	conn->retransmit_interval=CAPWAP_RETRANSMIT_INTERVAL; | ||||||
|  | 	conn->max_retransmit=CAPWAP_MAX_RETRANSMIT; | ||||||
|  | 	conn->wait_dtls=CAPWAP_WAIT_DTLS; | ||||||
|  | 	conn->wait_join=CAPWAP_WAIT_JOIN; | ||||||
|  | 	conn->mtu_discovery=1; | ||||||
|  | //	conn->capwap_mode = 0; | ||||||
|  | 	conn->strict_capwap=1; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 	conn->process_packet=conn_process_packet; | ||||||
|  | 	conn->process_message=process_message; | ||||||
|  |  | ||||||
|  | 	conn->write_header = write_header; | ||||||
|  | 	conn->header_len = header_len; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Create a conn object | ||||||
|  |  * @param sock a socket | ||||||
|  |  * @param addr the address associated | ||||||
|  |  * @param qsize size of packet queue | ||||||
|  |  * @return A pointer to the created object | ||||||
|  |  * This function creates a conn obnject with queueing functionality | ||||||
|  |  * for asynchronous operation.  | ||||||
|  |  * To create a conn object without queue functionallity use  #conn_create_noq. | ||||||
|  |  */ | ||||||
|  | struct cw_Conn * cw_conn_create(int sock, struct sockaddr * addr, int qsize) | ||||||
|  | { | ||||||
|  | 	struct cw_Conn * conn;  | ||||||
|  | 	conn = malloc(sizeof (struct cw_Conn )); | ||||||
|  | 	if (!conn) | ||||||
|  | 		return NULL; | ||||||
|  |  | ||||||
|  | 	cw_conn_init(conn); | ||||||
|  |  | ||||||
|  | 	conn->sock=sock; | ||||||
|  |  | ||||||
|  | 	if (addr) | ||||||
|  | 		sock_copyaddr(&conn->addr,addr); | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 	conn->fragman = fragman_create(); | ||||||
|  | 	if (conn->fragman==NULL){ | ||||||
|  | 		conn_destroy(conn); | ||||||
|  | 		return NULL; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	conn->qsize=qsize; | ||||||
|  | 	if (qsize != 0){ | ||||||
|  | 		if (!(conn->q=malloc( sizeof(uint8_t *) * qsize))){ | ||||||
|  | 			conn_destroy(conn); | ||||||
|  | 			return NULL; | ||||||
|  | 		} | ||||||
|  | 		conn->qrpos=-1; | ||||||
|  | 		if (sem_init(&conn->q_sem,0,0)!=0){ | ||||||
|  | 			cw_log(LOG_ERR,"Fatal- Can't init semaphore for conn object: %s",strerror(errno)); | ||||||
|  | 			conn_destroy(conn); | ||||||
|  | 			return NULL; | ||||||
|  | 		}; | ||||||
|  | 		conn->recv_packet=conn_q_recv_packet; | ||||||
|  | 		conn->recv_packet_peek=conn_q_recv_packet_peek; | ||||||
|  | 	} | ||||||
|  | 	else{ | ||||||
|  | 		conn->recv_packet = conn_recv_packet; | ||||||
|  | 		conn->recv_packet_peek = conn_recv_packet_peek; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	conn->send_packet = conn_send_packet; | ||||||
|  | /*	conn->send_data_packet = conn_send_data_packet;*/ | ||||||
|  |  | ||||||
|  | 	conn->last_seqnum_received=-1; | ||||||
|  | 	conn->mtu=600; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 	conn->cur_packet=0; | ||||||
|  | 	conn->recv_timeout=1; | ||||||
|  |  | ||||||
|  | 	conn->seqnum=-1; | ||||||
|  | 	conn->write = conn->send_packet; | ||||||
|  | 	conn->read = conn->recv_packet; | ||||||
|  |  | ||||||
|  | /*	conn->write_data = conn->send_data_packet; */ | ||||||
|  |  | ||||||
|  | 	conn->dtls_mtu = 600; | ||||||
|  |  | ||||||
|  | 	return conn; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
| @ -256,8 +256,8 @@ typedef struct cw_Conn cw_Conn_t; | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| struct cw_Conn*conn_create(int sock, struct sockaddr *addr, int qsize); | struct cw_Conn* cw_conn_create(int sock, struct sockaddr *addr, int qsize); | ||||||
| struct cw_Conn*conn_create_noq(int sock, struct sockaddr *addr); | struct cw_Conn* conn_create_noq(int sock, struct sockaddr *addr); | ||||||
|  |  | ||||||
|  |  | ||||||
| extern int conn_send_cwmsg(struct cw_Conn*conn, struct cwmsg *cwmsg); | extern int conn_send_cwmsg(struct cw_Conn*conn, struct cwmsg *cwmsg); | ||||||
| @ -310,11 +310,11 @@ struct cwrmsg *conn_wait_for_message(struct cw_Conn*conn, time_t timer); | |||||||
|  |  | ||||||
| struct cwrmsg *conn_wait_for_request(struct cw_Conn*conn, int *msglist, time_t timer); | struct cwrmsg *conn_wait_for_request(struct cw_Conn*conn, int *msglist, time_t timer); | ||||||
|  |  | ||||||
| int conn_q_wait_packet(struct cw_Conn* conn, int seconds); | //int conn_q_wait_packet(struct cw_Conn* conn, int seconds); | ||||||
|  |  | ||||||
| #define conn_is_error(conn) (conn->dtls_error) | #define conn_is_error(conn) (conn->dtls_error) | ||||||
|  |  | ||||||
| void conn_init(struct cw_Conn*conn); | void cw_conn_init(struct cw_Conn*conn); | ||||||
|  |  | ||||||
| extern int cw_read_messages(struct cw_Conn*conn); | extern int cw_read_messages(struct cw_Conn*conn); | ||||||
|  |  | ||||||
|  | |||||||
| @ -35,76 +35,4 @@ | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Create a conn object |  | ||||||
|  * @param sock a socket |  | ||||||
|  * @param addr the address associated |  | ||||||
|  * @param qsize size of packet queue |  | ||||||
|  * @return A pointer to the created object |  | ||||||
|  * This function creates a conn obnject with queueing functionality |  | ||||||
|  * for asynchronous operation.  |  | ||||||
|  * To create a conn object without queue functionallity use  #conn_create_noq. |  | ||||||
|  */ |  | ||||||
| struct cw_Conn * conn_create(int sock, struct sockaddr * addr, int qsize) |  | ||||||
| { |  | ||||||
| 	struct cw_Conn * conn;  |  | ||||||
| 	conn = malloc(sizeof (struct cw_Conn )); |  | ||||||
| 	if (!conn) |  | ||||||
| 		return NULL; |  | ||||||
|  |  | ||||||
| 	conn_init(conn); |  | ||||||
|  |  | ||||||
| 	conn->sock=sock; |  | ||||||
|  |  | ||||||
| 	if (addr) |  | ||||||
| 		sock_copyaddr(&conn->addr,addr); |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	conn->fragman = fragman_create(); |  | ||||||
| 	if (conn->fragman==NULL){ |  | ||||||
| 		conn_destroy(conn); |  | ||||||
| 		return NULL; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	conn->qsize=qsize; |  | ||||||
| 	if (qsize != 0){ |  | ||||||
| 		if (!(conn->q=malloc( sizeof(uint8_t *) * qsize))){ |  | ||||||
| 			conn_destroy(conn); |  | ||||||
| 			return NULL; |  | ||||||
| 		} |  | ||||||
| 		conn->qrpos=-1; |  | ||||||
| 		if (sem_init(&conn->q_sem,0,0)!=0){ |  | ||||||
| 			cw_log(LOG_ERR,"Fatal- Can't init semaphore for conn object: %s",strerror(errno)); |  | ||||||
| 			conn_destroy(conn); |  | ||||||
| 			return NULL; |  | ||||||
| 		}; |  | ||||||
| 		conn->recv_packet=conn_q_recv_packet; |  | ||||||
| 		conn->recv_packet_peek=conn_q_recv_packet_peek; |  | ||||||
| 	} |  | ||||||
| 	else{ |  | ||||||
| 		conn->recv_packet = conn_recv_packet; |  | ||||||
| 		conn->recv_packet_peek = conn_recv_packet_peek; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	conn->send_packet = conn_send_packet; |  | ||||||
| /*	conn->send_data_packet = conn_send_data_packet;*/ |  | ||||||
|  |  | ||||||
| 	conn->last_seqnum_received=-1; |  | ||||||
| 	conn->mtu=600; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	conn->cur_packet=0; |  | ||||||
| 	conn->recv_timeout=1; |  | ||||||
|  |  | ||||||
| 	conn->seqnum=-1; |  | ||||||
| 	conn->write = conn->send_packet; |  | ||||||
| 	conn->read = conn->recv_packet; |  | ||||||
|  |  | ||||||
| /*	conn->write_data = conn->send_data_packet; */ |  | ||||||
|  |  | ||||||
| 	conn->dtls_mtu = 600; |  | ||||||
|  |  | ||||||
| 	return conn; |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | |||||||
| @ -43,7 +43,7 @@ struct cw_Conn * conn_create_noq(int sock, struct sockaddr * addr) | |||||||
| 	if (!conn) | 	if (!conn) | ||||||
| 		return NULL; | 		return NULL; | ||||||
|  |  | ||||||
| 	conn_init(conn); | 	cw_conn_init(conn); | ||||||
|  |  | ||||||
|  |  | ||||||
| 	conn->sock=sock; | 	conn->sock=sock; | ||||||
|  | |||||||
| @ -132,7 +132,7 @@ static struct cw_StrListElem prefix[] = { | |||||||
| 	{DBG_DTLS_DETAIL, " DTLS - "}, | 	{DBG_DTLS_DETAIL, " DTLS - "}, | ||||||
| 	{DBG_WARN, " Warning - "}, | 	{DBG_WARN, " Warning - "}, | ||||||
| 	{DBG_MOD, " Mod - "}, | 	{DBG_MOD, " Mod - "}, | ||||||
| 	{DBG_STATE, " State - "}, | 	{DBG_STATE, " State Machine - "}, | ||||||
| 	{DBG_CFG_SET, "    Cfg Set - "}, | 	{DBG_CFG_SET, "    Cfg Set - "}, | ||||||
|  |  | ||||||
|  |  | ||||||
|  | |||||||
| @ -128,7 +128,7 @@ errX: | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| static int run_discovery(struct conn *conn, struct cw_DiscoveryResult * dis) | static int run_discovery(struct cw_Conn *conn, struct cw_DiscoveryResult * dis) | ||||||
| { | { | ||||||
| 	time_t timer; | 	time_t timer; | ||||||
| 	struct sockaddr_storage from; | 	struct sockaddr_storage from; | ||||||
| @ -200,7 +200,7 @@ static int run_discovery(struct conn *conn, struct cw_DiscoveryResult * dis) | |||||||
| /** | /** | ||||||
|  * Run discovery for on address (eg broadcast 255.255.255.255) |  * Run discovery for on address (eg broadcast 255.255.255.255) | ||||||
|  */ |  */ | ||||||
| int cw_run_discovery(struct conn *conn, const char *addr, const char *bindaddr,  | int cw_run_discovery(struct cw_Conn *conn, const char *addr, const char *bindaddr,  | ||||||
| 		struct cw_DiscoveryResult * dis) | 		struct cw_DiscoveryResult * dis) | ||||||
| { | { | ||||||
| 	char sock_buf[SOCK_ADDR_BUFSIZE]; | 	char sock_buf[SOCK_ADDR_BUFSIZE]; | ||||||
|  | |||||||
| @ -32,7 +32,7 @@ void acinfo_log_(int level,const struct ac_info *acinfo,const char * xstr) | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| int join_state(struct conn * conn) | int join_state(struct cw_Conn * conn) | ||||||
| { | { | ||||||
| 	struct wtpinfo * wtpinfo = get_wtpinfo(); | 	struct wtpinfo * wtpinfo = get_wtpinfo(); | ||||||
|  |  | ||||||
| @ -98,7 +98,7 @@ acinfo.result_code=99; | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| int run_join_d(struct conn * conn, struct sockaddr *sa) | int run_join_d(struct cw_Conn * conn, struct sockaddr *sa) | ||||||
| { | { | ||||||
| 	char addrstr[SOCK_ADDR_BUFSIZE]; | 	char addrstr[SOCK_ADDR_BUFSIZE]; | ||||||
| 	int sockfd; | 	int sockfd; | ||||||
| @ -164,7 +164,7 @@ int run_join_d(struct conn * conn, struct sockaddr *sa) | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| int run_join(struct conn *conn) | int run_join(struct cw_Conn *conn) | ||||||
| { | { | ||||||
| 	char addrstr[SOCK_ADDR_BUFSIZE]; | 	char addrstr[SOCK_ADDR_BUFSIZE]; | ||||||
| /*	 | /*	 | ||||||
| @ -199,7 +199,7 @@ int run_join(struct conn *conn) | |||||||
| 	return 1; | 	return 1; | ||||||
| } | } | ||||||
|  |  | ||||||
| int join(struct conn * conn, struct cw_DiscoveryResult * dis) | int join(struct cw_Conn * conn, struct cw_DiscoveryResult * dis) | ||||||
| { | { | ||||||
| 	mavliter_t ii; | 	mavliter_t ii; | ||||||
| 	mavliter_init(&ii,dis->prio_ip); | 	mavliter_init(&ii,dis->prio_ip); | ||||||
|  | |||||||
| @ -30,7 +30,7 @@ | |||||||
| int update =1; | int update =1; | ||||||
|  |  | ||||||
| /* | /* | ||||||
| int handle_update_req(struct conn *conn, struct cw_action_in *a, uint8_t * data, | int handle_update_req(struct cw_Conn *conn, struct cw_action_in *a, uint8_t * data, | ||||||
| 		      int len, struct sockaddr *from) | 		      int len, struct sockaddr *from) | ||||||
| { | { | ||||||
| 	if (a->msg_id == CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST){ | 	if (a->msg_id == CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST){ | ||||||
| @ -58,7 +58,7 @@ cw_dbg(DBG_X,"Saving configuration ..."); | |||||||
|  |  | ||||||
|  |  | ||||||
| /* | /* | ||||||
| static void update_radio(struct conn * conn, int rid, mbag_t radio_upd, mbag_t radio,mbag_t iresult ) | static void update_radio(struct cw_Conn * conn, int rid, mbag_t radio_upd, mbag_t radio,mbag_t iresult ) | ||||||
| { | { | ||||||
|  |  | ||||||
| 	printf("Updating radio with rid %d\n",rid); | 	printf("Updating radio with rid %d\n",rid); | ||||||
| @ -67,7 +67,7 @@ static void update_radio(struct conn * conn, int rid, mbag_t radio_upd, mbag_t r | |||||||
|  |  | ||||||
|  |  | ||||||
| /* | /* | ||||||
| static void update_radios(struct conn * conn, mbag_t result) | static void update_radios(struct cw_Conn * conn, mbag_t result) | ||||||
| { | { | ||||||
| 	MAVLITER_DEFINE (it,conn->radios_upd); | 	MAVLITER_DEFINE (it,conn->radios_upd); | ||||||
| 	mavliter_foreach(&it){ | 	mavliter_foreach(&it){ | ||||||
| @ -87,7 +87,7 @@ static void update_radios(struct conn * conn, mbag_t result) | |||||||
| } | } | ||||||
| */ | */ | ||||||
|  |  | ||||||
| static void do_update(struct conn * conn) | static void do_update(struct cw_Conn * conn) | ||||||
| { | { | ||||||
| 	int rc; | 	int rc; | ||||||
|  |  | ||||||
| @ -138,7 +138,7 @@ void clean_cfg(mavl_t cfg) | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| int run(struct conn * conn) | int run(struct cw_Conn * conn) | ||||||
| { | { | ||||||
|  |  | ||||||
|  |  | ||||||
| @ -224,7 +224,7 @@ cw_dbg_ktv_dump(conn->remote_cfg,DBG_INFO,"KTV DUMP ----------------","Remote:", | |||||||
| /* | /* | ||||||
| static int echo_interval_timer; | static int echo_interval_timer; | ||||||
|  |  | ||||||
| struct cwrmsg * get_response(struct conn * conn, int type,int seqnum) | struct cwrmsg * get_response(struct cw_Conn * conn, int type,int seqnum) | ||||||
| { | { | ||||||
| 	struct cwrmsg * cwrmsg;  | 	struct cwrmsg * cwrmsg;  | ||||||
| 	int i; | 	int i; | ||||||
| @ -246,7 +246,7 @@ struct cwrmsg * get_response(struct conn * conn, int type,int seqnum) | |||||||
|  |  | ||||||
|  |  | ||||||
| /* | /* | ||||||
| struct cwrmsg * send_request(struct conn * conn,struct cwmsg *cwmsg) | struct cwrmsg * send_request(struct cw_Conn * conn,struct cwmsg *cwmsg) | ||||||
| { | { | ||||||
| 	int i; | 	int i; | ||||||
| 	for (i=0; i<conf_max_retransmit; i++){ | 	for (i=0; i<conf_max_retransmit; i++){ | ||||||
| @ -272,10 +272,10 @@ struct cwrmsg * send_request(struct conn * conn,struct cwmsg *cwmsg) | |||||||
|  |  | ||||||
| */ | */ | ||||||
|  |  | ||||||
| /*//extern struct conn * get_conn();*/ | /*//extern struct cw_Conn * get_conn();*/ | ||||||
|  |  | ||||||
| /* | /* | ||||||
| int run(struct conn * conn) | int run(struct cw_Conn * conn) | ||||||
| { | { | ||||||
|  |  | ||||||
| 	conn = get_conn(); | 	conn = get_conn(); | ||||||
|  | |||||||
| @ -9,7 +9,7 @@ extern int sulking_state(); | |||||||
| extern int join(); | extern int join(); | ||||||
| extern int discovery(); | extern int discovery(); | ||||||
| extern int image_update(); | extern int image_update(); | ||||||
| extern int setup_conf(struct conn * conn); | extern int setup_conf(struct cw_Conn * conn); | ||||||
| extern int configure(); | extern int configure(); | ||||||
| extern int run(); | extern int run(); | ||||||
| extern int changestate(); | extern int changestate(); | ||||||
| @ -22,13 +22,13 @@ struct cw_DiscoveryResult{ | |||||||
| 	mlist_t results; | 	mlist_t results; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| int cw_run_discovery(struct conn *conn, const char *acaddr, const char *bindaddr, | int cw_run_discovery(struct cw_Conn *conn, const char *acaddr, const char *bindaddr, | ||||||
| 		struct cw_DiscoveryResult * dis); | 		struct cw_DiscoveryResult * dis); | ||||||
|  |  | ||||||
| int cw_discovery_init_results(struct cw_DiscoveryResult *dis); | int cw_discovery_init_results(struct cw_DiscoveryResult *dis); | ||||||
| void cw_discovery_free_results(struct cw_DiscoveryResult * dis); | void cw_discovery_free_results(struct cw_DiscoveryResult * dis); | ||||||
| int join(struct conn * conn, struct cw_DiscoveryResult * dis); | int join(struct cw_Conn * conn, struct cw_DiscoveryResult * dis); | ||||||
|  |  | ||||||
| struct conn * get_conn(); | struct cw_Conn * get_conn(); | ||||||
|  |  | ||||||
| #endif | #endif | ||||||
|  | |||||||
| @ -4,7 +4,7 @@ | |||||||
| #include <stdint.h> | #include <stdint.h> | ||||||
| #include "cw/bstr.h" | #include "cw/bstr.h" | ||||||
|  |  | ||||||
| extern struct conn * get_conn(); | extern struct cw_Conn * get_conn(); | ||||||
| extern bstr_t get_base_rmac(); | extern bstr_t get_base_rmac(); | ||||||
| uint8_t get_ecn_support(); | uint8_t get_ecn_support(); | ||||||
|  |  | ||||||
|  | |||||||
| @ -86,7 +86,7 @@ int main (int argc, char **argv) | |||||||
| 	struct bootcfg bootcfg; | 	struct bootcfg bootcfg; | ||||||
| 	struct cw_Mod * mod; | 	struct cw_Mod * mod; | ||||||
| 	struct cw_MsgSet * msgset; | 	struct cw_MsgSet * msgset; | ||||||
| 	struct conn * conn; | 	struct cw_Conn * conn; | ||||||
| 	FILE * file; | 	FILE * file; | ||||||
| 	mavl_t global_cfg, types_tree; | 	mavl_t global_cfg, types_tree; | ||||||
| 	const cw_Type_t ** ti; | 	const cw_Type_t ** ti; | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user