From 3a8159320f1b45c80ccf503f528e8dc989e4437c Mon Sep 17 00:00:00 2001 From: 7u83 <7u83@mail.ru> Date: Sat, 13 Aug 2022 10:19:06 +0200 Subject: [PATCH] Deleted cwmsg.h --- src/cw/conn.c | 18 --------- src/cw/conn.h | 36 ++++-------------- src/cw/conn_init.c | 74 ------------------------------------ src/cw/conn_process_packet.c | 4 +- src/cw/cwmsg.h | 44 --------------------- src/cw/msgset.h | 4 +- 6 files changed, 12 insertions(+), 168 deletions(-) delete mode 100644 src/cw/conn_init.c delete mode 100644 src/cw/cwmsg.h diff --git a/src/cw/conn.c b/src/cw/conn.c index 7ba7f9e7..40dc949c 100644 --- a/src/cw/conn.c +++ b/src/cw/conn.c @@ -25,20 +25,6 @@ - -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; -} - /** * Put a message to a buffer * This functions assumes, that a message header is @@ -190,13 +176,9 @@ void cw_conn_init(struct cw_Conn * conn) // 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; } diff --git a/src/cw/conn.h b/src/cw/conn.h index 358b8fc8..0d427304 100644 --- a/src/cw/conn.h +++ b/src/cw/conn.h @@ -30,7 +30,7 @@ #include #include "fragman.h" -#include "cwmsg.h" +//#include "cwmsg.h" @@ -78,21 +78,6 @@ struct cw_Conn { mavl_t local_cfg; mavl_t global_cfg; - int (*write_header)(struct cw_ElemHandler * handler, uint8_t * dst, int len); - int (*header_len)(struct cw_ElemHandler *handler); - -/* mbag_t outgoing; - mbag_t incomming; - mbag_t remote; - mbag_t local; - - mbag_t radios; - mbag_t radios_upd; - mbag_t config; - mbag_t config_upd; -*/ - -/* uint8_t session_id[16];*/ bstr16_t session_id; @@ -114,7 +99,6 @@ struct cw_Conn { of the protocoll */ - struct cw_MsgSet * msgset; uint8_t capwap_prevstate; @@ -136,8 +120,8 @@ struct cw_Conn { int last_message_id_received; - struct cwmsg req_msg; - struct cwmsg resp_msg; +// struct cwmsg req_msg; +// struct cwmsg resp_msg; /** Buffer for outgoing request messages */ uint8_t req_buffer[CONN_MAX_MSG_LENGTH]; @@ -235,19 +219,15 @@ struct cw_Conn { int detected; + struct cw_MsgSet * msgset; void (*setup_complete)(struct cw_Conn *conn); -// void * mods; - - +/* int (*msg_start)(struct cw_Conn*conn,struct cw_action_in *a,uint8_t*data,int len,struct sockaddr *from); int (*msg_end)(struct cw_Conn*conn,struct cw_action_in *a,uint8_t*elem,int len,struct sockaddr *from); int (*elem_end)(struct cw_Conn*conn,struct cw_action_in *a,int afrc,uint8_t*elem,int len,struct sockaddr *from); - -/* -// void (*actions_registered)(struct cw_Conn*conn); -*/ + */ }; typedef struct cw_Conn cw_Conn_t; @@ -262,7 +242,7 @@ struct cw_Conn* cw_conn_create(int sock, struct sockaddr *addr, int qsize); 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); /* //extern int conn_process_packet(struct cw_Conn*conn, uint8_t * packet, int len, @@ -287,7 +267,7 @@ extern int conn_q_recv_packet_peek(struct cw_Conn*conn, uint8_t * buffer, int le extern int conn_recv_packet(struct cw_Conn*conn, uint8_t * buf, int len); extern int conn_recv_packet_peek(struct cw_Conn*conn, uint8_t * buf, int len); -extern int conn_send_response(struct cw_Conn*conn, struct cwmsg *cwmsg, int seqnum); +//extern int conn_send_response(struct cw_Conn*conn, struct cwmsg *cwmsg, int seqnum); extern struct cwrmsg *conn_get_response(struct cw_Conn*conn); diff --git a/src/cw/conn_init.c b/src/cw/conn_init.c deleted file mode 100644 index f2357086..00000000 --- a/src/cw/conn_init.c +++ /dev/null @@ -1,74 +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 . - -*/ - - -/** - * @file - * @brief conn_init - */ - -#include - - -#include "conn.h" -#include "capwap.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 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; -*/ - -} - - diff --git a/src/cw/conn_process_packet.c b/src/cw/conn_process_packet.c index b6517783..8c7ef723 100644 --- a/src/cw/conn_process_packet.c +++ b/src/cw/conn_process_packet.c @@ -502,9 +502,9 @@ int process_message(struct cw_Conn *conn, uint8_t * rawmsg, int rawlen, if (cw_get_hdr_msg_type(conn->resp_buffer) - 1 != type) { - cw_dbg(DBG_MSG_ERR, +/* cw_dbg(DBG_MSG_ERR, "No cached response for retransmission, request seqnum=%d,in cache=%d", - s2, conn->resp_msg.type); + s2, conn->resp_msg.type);*/ errno = EAGAIN; return -1; } diff --git a/src/cw/cwmsg.h b/src/cw/cwmsg.h deleted file mode 100644 index fb7ea1a1..00000000 --- a/src/cw/cwmsg.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef __CWMSG_H -#define __CWMSG_H - -#include - -#include "radioinfo.h" - -struct cwmsg{ - uint8_t * buffer; - uint8_t * trnsprthdr; - uint8_t * ctrlhdr; - uint8_t * msgelems; - int pos; - int flags; - int hlen; - int rid; - int seqnum; - int type; - int capwap_mode; -}; - -struct conn; - -/* -extern void cwmsg_init(struct cwmsg * cwmsg, uint8_t *buffer, int type, int seqnum, struct radioinfo * radioinfo); -//int cwmsg_send(struct cwmsg * cwmsg, int seqnum, int rid, struct conn * conn); -// -extern void cwmsg_addelem(struct cwmsg *msg,int type, const uint8_t *elem, int len); -extern void cwmsg_vaddelem(struct cwmsg *msg,int type, ...); - -//extern void cwmsg_addelem_ac_descriptor(struct cwmsg *msg,struct ac_info * acinfo,struct wtpinfo * wtpinfo); -extern void cwmsg_addelem_ac_timestamp(struct cwmsg *msg); - - -extern void cwmsg_init_echo_request(struct cwmsg * cwmsg,uint8_t *buffer,struct conn * conn, struct radioinfo * radioinfo); -extern void cwmsg_addelem_mtu_discovery_padding(struct cwmsg * msg, struct conn* conn); -extern void cwmsg_addelem_image_identifier(struct cwmsg *msg,uint32_t vendor_id,uint8_t *img, int len); - -//extern void cwmsg_addelem_radio_operational_state(struct cwmsg * cwmsg, struct radioinfo * ri); - -extern void cwmsg_addelem_vendor_cisco_mwar_addr(struct cwmsg *msg, struct conn *conn); -*/ - -#endif diff --git a/src/cw/msgset.h b/src/cw/msgset.h index a2f327a3..3f89aef6 100644 --- a/src/cw/msgset.h +++ b/src/cw/msgset.h @@ -86,7 +86,7 @@ struct cw_MsgDef{ struct cw_ElemDef * elements; - int (*preprocess)(struct conn * conn); + int (*preprocess)(struct cw_Conn * conn); // int (*postprocess)(struct conn * conn); int (*postprocess)(struct cw_ElemHandlerParams * params, uint8_t * elems_ptr, int elems_len); @@ -105,7 +105,7 @@ struct cw_MsgData{ mlist_t elements_list; mlist_t mand_keys; /**< Keys of mandatory elements */ - int (*preprocess)(struct conn * conn); + int (*preprocess)(struct cw_Conn * conn); //int (*postprocess)(struct conn * conn); int (*postprocess)(struct cw_ElemHandlerParams * params, uint8_t * elems_ptr, int elems_len); /* uint8_t next_state;*/