Inital commit.

FossilOrigin-Name: d4dab43da113a0c96fd3668cb15f4288ec5563581bd34e77150931a79c994750
This commit is contained in:
7u83@mail.ru 2014-08-17 16:29:42 +00:00
parent 1b9db41057
commit 9386daa98a
3 changed files with 91 additions and 0 deletions

View File

@ -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);
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <stdarg.h>
#include <arpa/inet.h>
#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; i<n; i++){
uint8_t *data=va_arg(vl,uint8_t*);
int l=va_arg(vl,int);
memcpy(msg->msgelems+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);
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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);
}