OCT 1.删除无用变量 2.添加dhcp_tools请求参数类型
This commit is contained in:
parent
9d6dae9171
commit
4285e264da
|
@ -119,7 +119,6 @@ static void add_dhcp_tree_colums(GtkWidget *treeView) {
|
|||
#define ADD_SUB_OPTION(code, len, val) \
|
||||
do { \
|
||||
int count_flag = 0; \
|
||||
char *p; \
|
||||
gtk_tree_store_append(store, &iterOpt, &iterSub); \
|
||||
s = sdsempty(); \
|
||||
sprintf(s, "%u", (len)); \
|
||||
|
@ -135,9 +134,12 @@ static void add_dhcp_tree_colums(GtkWidget *treeView) {
|
|||
do { \
|
||||
gtk_tree_store_append(store, &iterOpt, &iterSub); \
|
||||
s = sdsempty(); \
|
||||
sprintf(s, "(%u) %s", (val)[count_flag], dhcp_get_opName((val)[count_flag]));\
|
||||
gtk_tree_store_set(store, &iterOpt, 0, dhcp_get_opName(code), 1, s, -1);\
|
||||
t = sdsempty(); \
|
||||
sprintf(s, "(%u) %s", (val)[count_flag], dhcp_get_opName((val)[count_flag])); \
|
||||
sprintf(t, "%s Item", dhcp_get_opName(code)); \
|
||||
gtk_tree_store_set(store, &iterOpt, 0, t, 1, s, -1);\
|
||||
sdsfree(s); \
|
||||
sdsfree(t); \
|
||||
count_flag++; \
|
||||
} while(count_flag != (len)); \
|
||||
break; \
|
||||
|
@ -176,7 +178,7 @@ static void add_dhcp_tree_colums(GtkWidget *treeView) {
|
|||
|
||||
static void create_dhcp_tree_mode(PDHCP_PACKAGE p, GtkWidget *treeView) {
|
||||
// 填充右上侧 TreeView 协议数据
|
||||
sds s;
|
||||
sds s, t;
|
||||
GtkTreeIter iter, iterSub, iterOpt;
|
||||
GtkTreeStore *store = gtk_tree_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
|
||||
const char *itemTitle[] = {"Ethernet II", "802.1Q Virtual LAN", "IP Version 4", "UDP", "DHCP"};
|
||||
|
@ -261,15 +263,15 @@ static void create_dhcp_tree_mode(PDHCP_PACKAGE p, GtkWidget *treeView) {
|
|||
ADD_SUB_STRING("Relay agent IP address", inet_ntoa(*(struct in_addr*)&p->dhcp.giaddr));
|
||||
s = sdsempty();
|
||||
MAC_TO_STR(p->dhcp.chaddr, s);
|
||||
ADD_SUB_STRING("Destination", s);
|
||||
ADD_SUB_STRING("Client MAC address", s);
|
||||
sdsfree(s);
|
||||
|
||||
if(strlen(p->dhcp.sname) != 0)
|
||||
if(p->dhcp.sname[0] != '\0')
|
||||
ADD_SUB_STRING("Server host name", p->dhcp.sname);
|
||||
else
|
||||
ADD_SUB_STRING("Server host name", "not given");
|
||||
|
||||
if(strlen(p->dhcp.file) != 0)
|
||||
if(p->dhcp.file[0] != '\0')
|
||||
ADD_SUB_STRING("Boot file name", p->dhcp.file);
|
||||
else
|
||||
ADD_SUB_STRING("Boot file name", "not given");
|
||||
|
|
|
@ -105,6 +105,7 @@ static const DHCP_OPTION_CFG g_opCfg[] = {
|
|||
{"SubnetSelectionOption", OPT_SUBNETSELECTION, 3, TRUE },
|
||||
{"DomainSearch", OPT_DOMAINSEARCH, 1, TRUE },
|
||||
{"SIPServersDHCPOption", OPT_SIPSERVERSDHCP, 1, TRUE },
|
||||
{"ClasslessStaticRoute", OPT_CLASSLESSSTATICROUTE, 1, TRUE },
|
||||
{"CCC", OPT_CCC, 1, TRUE },
|
||||
{"TFTPServerIPaddress", OPT_TFPTSERVERIPADDRESS, 3, TRUE },
|
||||
{"CallServerIPaddress", OPT_CALLSERVERIPADDRESS, 3, TRUE },
|
||||
|
|
Loading…
Reference in New Issue