New files.

FossilOrigin-Name: 2a7c230f1c4b05ec3ecd04e5b231f9fe290877c96c15ba08f65cd0f0e6b659ca
This commit is contained in: 2015-05-04 05:27:35 +00:00
parent 4d2593ff1f
commit d3119dfef5
2 changed files with 80 additions and 85 deletions

View File

@ -1,85 +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
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 <stdio.h>
#include "lwapp.h"
#include "cw_util.h"
*@brief Implementation of cw_sprintf_version
* Converts a CAPWAP version string to readable format.
* @param s target where the formated string will be stored
* @param ver the CAPWAP version data
* @param vendor vendor id
* @param def default string will be printed if version is NULL
* @return the number bytes added to the output *s
* This function tries to determine if the bstr_t string version
* is human readable, and if not, it will put out a hexadecimal value
* or a dot-seaprated list of number for version elements used
* by Cisco.
int cw_format_version(char *s, bstr_t ver, uint32_t vendor, char * def)
if (!ver)
return sprintf(s,"%s",def);
uint8_t * version = bstr_data(ver);
int len = bstr_len(ver);
int rs=0;
int i;
if ( cw_is_printable(version,len) ){
if (len != 0 )
for (i=0; i<len && i<20; i++){
int dot=0;
rs+=sprintf(s+rs," (");
for (i=0; i<len && i<20; i++){
if (dot)
if (vendor)
rs+=sprintf(s+rs,", Vendor Id: %d, %s",vendor, lw_vendor_id_to_str(vendor));
return rs;

src/capwap/doc.dox Normal file
View File

@ -0,0 +1,80 @@
\mainpage LIBCAWAP Documentation
\section IBCAPWAPInstall Installing
To install libcapwap you need the following things:
A computer, a keyboard, some software and time.
\section MsgHandling Extending CAPWAP
Probably the easies way to explain, how to extend the CAPWAP, is to show an example.\n
Here we go ...
\subsection SimpleExample A Simple Example
Imagine you whant to implement a new vendor specific message element called
"WTP LED Status and Color". In the real world this could be a message element, that
is used by a WTP to indicate it's LED status, and sent by the AC to set the WTP's
LED status.\n
There might be a specification where the message element is idefined as follows:
Vendor Specific Element - WTP LED Status and Color
0 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6
| Status | Color |
Type: 17
Length: 2
The first thing we have now to do, ist to define an item ID, that is interlnally
used by AC-Tube to store and find data associated with this message element.
This ID is simply a system-wide unique string constant.\n
So let's create a file "mycapwap.c" and define the ID.
const char CW_MYITEM_WTP_LED_STATUS_AND_COLOR[]="wtp_led_status_and_color";
The item ID is also used to identify message element data stored in a SQL
database or in json objects.\n
Next we should provide some information about our item, which is done by
creating an item definition, described by structure #cw_itemdef.\n
Looking at the specification of our message element we see that the value
is built of two bytes, which can be represented as word. There is a
pre-defined type MBAG_WORD which we will use.
#include "capwap/mbag.h"
const char CW_MYITEM_WTP_LED_STATUS_AND_COLOR[]="wtp_led_status_and_color";
struct cw_itemdef_t myitemdefs[] = {
\section ItemsElements Items, Elements, Messages ...
\subsection asd fdglksd
This is the text for the subsection.