Working ...

FossilOrigin-Name: 76683772133379e4ebd35973998048a7dfc1f5ff63deb2182f849c1390c67a92
This commit is contained in:
7u83@mail.ru 2014-09-22 04:57:50 +00:00
parent f0bba94efa
commit 8a19989b7e
5 changed files with 47 additions and 21 deletions

View File

@ -101,6 +101,7 @@ OBJS += $(CONFOBJS)
OBJS += nlt_attrnames.o
OBJS += nlt_cmdnames.o
#OBJS += $(HA_FILES)

View File

@ -1,22 +1,47 @@
<?php
function enum2_array($data,$arrayname,$comment)
{
$str = "";
$values = explode(",",$data);
$str.=$comment;
$str.= "char * $arrayname"."[] = {\n";
$c="";
foreach($values as $val){
$str.= $c.'"'.trim($val).'"';
$c=",\n";
}
$str.= "\n};";
return $str;
}
$data = file_get_contents("nl80211attr.txt");
$values = explode(",",$data);
echo "/*
Generated by php
$arrayname="nlt_attrnames";
$comment = "/*
Generated by enum2array.php
Do not modify
*/
";
$r = enum2_array($data,$arrayname,$comment);
file_put_contents('nlt_attrnames.c',$r);
$data = file_get_contents("nl80211cmd.txt");
$arrayname="nlt_cmdnames";
$comment = "/*
Generated by enum2array.php
Do not modify
*/
";
$r = enum2_array($data,$arrayname,$comment);
file_put_contents('nlt_cmdnames.c',$r);
echo "char nlt_attrname[] = {\n";
$c="";
foreach($values as $val){
echo $c.'"'.trim($val).'"';
$c=",\n";
}
echo "\n};";

View File

@ -1,11 +1,13 @@
#ifndef __NLT_H
#define __NLT_H
#include "nl80211.h"
extern const char * nlt_attrnames[];
extern const char * nlt_cmdnames[];
#define nlt_get_attrname(type) nlt_attrnames[type]
#define nlt_get_cmdname(cmd) (cmd>NL80211_CMD_MAX? "Unknown": nlt_cmdnames[cmd])
#endif

View File

@ -1,10 +1,8 @@
#include "nlt.h"
/*
Generated by php
Generated by enum2array.php
Do not modify
*/
const char * nlt_attrnames[] = {
char * nlt_attrnames[] = {
"NL80211_ATTR_UNSPEC",
"NL80211_ATTR_WIPHY",
"NL80211_ATTR_WIPHY_NAME",
@ -212,4 +210,4 @@ const char * nlt_attrnames[] = {
"NL80211_ATTR_IFACE_SOCKET_OWNER",
"NL80211_ATTR_CSA_C_OFFSETS_TX",
"NL80211_ATTR_MAX_CSA_COUNTERS"
};
};

View File

@ -57,8 +57,6 @@ const char * interfaces[]={
int main()
{
gr();
exit(0);
wtp_main();
}
@ -93,7 +91,9 @@ int do_connect(void *priv,void *data)
int wtp_main(const char *ad)
{
cw_dbg_opt_level = DBG_DTLS | DBG_CW_INFO | DBG_ALL;
cw_dbg_opt_level = DBG_DTLS | DBG_CW_INFO | DBG_ALL;
gr();
exit(0);
wtpconf_preinit();