From 9386daa98af0d6b155d6fbdb39cbeeff6dc2f790 Mon Sep 17 00:00:00 2001
From: "7u83@mail.ru" <7u83@mail.ru@noemail.net>
Date: Sun, 17 Aug 2014 16:29:42 +0000
Subject: [PATCH] Inital commit.
FossilOrigin-Name: d4dab43da113a0c96fd3668cb15f4288ec5563581bd34e77150931a79c994750
---
.../cwmsg_addelem_maximum_message_length.c | 10 +++++
src/capwap/cwmsg_vaddelem.c | 42 +++++++++++++++++++
.../cwsend_configuration_status_request.c | 39 +++++++++++++++++
3 files changed, 91 insertions(+)
create mode 100644 src/capwap/cwmsg_addelem_maximum_message_length.c
create mode 100644 src/capwap/cwmsg_vaddelem.c
create mode 100644 src/capwap/cwsend_configuration_status_request.c
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);
+}