diff --git a/src/capwap/cwmsg_addelem_maximum_message_length.c b/src/capwap/cwmsg_addelem_maximum_message_length.c new file mode 100644 index 00000000..c097a6bc --- /dev/null +++ b/src/capwap/cwmsg_addelem_maximum_message_length.c @@ -0,0 +1,10 @@ + +#include "capwap.h" + +void cwmsg_addelem_maximum_message_length(struct cwmsg *msg,int len) +{ + uint8_t c[2]; + *((uint16_t*)c)= htons(len); + cwmsg_addelem(msg,CWMSGELEM_MAXIMUM_MESSAGE_LENGTH,c,4); +} + diff --git a/src/capwap/cwmsg_vaddelem.c b/src/capwap/cwmsg_vaddelem.c new file mode 100644 index 00000000..4fd3d5b7 --- /dev/null +++ b/src/capwap/cwmsg_vaddelem.c @@ -0,0 +1,42 @@ +/* + 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 . + +*/ + +#include +#include +#include + +#include "cwmsg.h" + +void cwmsg_vaddelem(struct cwmsg *msg,int type,int n, ...) +{ + va_list vl; + va_start(vl,n); + int i,len=0; + for (i=0; imsgelems+4+msg->pos+len,data,l); + len+=l; + } + + uint32_t val = type<<16|len; + *((uint32_t*)(msg->msgelems+msg->pos))=htonl(val); + msg->pos+=4+len; + va_end(vl); +} diff --git a/src/capwap/cwsend_configuration_status_request.c b/src/capwap/cwsend_configuration_status_request.c new file mode 100644 index 00000000..5e9a2b89 --- /dev/null +++ b/src/capwap/cwsend_configuration_status_request.c @@ -0,0 +1,39 @@ +/* + 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 . + +*/ + +#include "capwap.h" +#include "conn.h" +#include "cwmsg.h" + +int cwsend_configuration_status_request(struct conn * conn,struct radioinfo * radioinfo,struct wtpinfo * wtpinfo) +{ + uint8_t buffer[CWMSG_MAX_SIZE]; + struct cwmsg cwmsg; + + cwmsg_init(&cwmsg,buffer,CWMSG_DISCOVERY_REQUEST,conn_get_next_seqnum(conn),radioinfo); + + cwmsg_addelem(&cwmsg,CWMSGELEM_DISCOVERY_TYPE,&wtpinfo->discovery_type,sizeof(uint8_t)); + cwmsg_addelem_wtp_board_data(&cwmsg,wtpinfo); + cwmsg_addelem_wtp_descriptor(&cwmsg,wtpinfo); + cwmsg_addelem(&cwmsg,CWMSGELEM_WTP_FRAME_TUNNEL_MODE,&wtpinfo->frame_tunnel_mode,sizeof(uint8_t)); + cwmsg_addelem(&cwmsg,CWMSGELEM_WTP_MAC_TYPE,&wtpinfo->mac_type,sizeof(uint8_t)); + cwmsg_addelem_wtp_radio_infos(&cwmsg,wtpinfo); + cwmsg_addelem_mtu_discovery_padding(&cwmsg,conn); + + return conn_send_cwmsg(conn,&cwmsg); +}