}
-bool do_bitrate_set (int argc, const char **argv, struct ngadmin *nga)
+int do_bitrate_set (int argc, const char **argv, struct ngadmin *nga)
{
- int i, k = 0, defs[] = {12, 12}, p, *ports = NULL;
+ int i, k = 0, defs[] = {12, 12}, p, *ports = NULL, ret = 0;
const struct swi_attr *sa;
- bool ret = true;
+
if (argc < 2) {
printf(
"usage: bitrate set [all SPEEDSPEC] <port1> SPEEDSPEC [<port2> SPEEDSPEC ...]\n"
"SPEEDSPEC: [inout <speed>] [in <ispeed>] [out <ospeed>]\n"
);
- ret = false;
+ ret = 1;
goto end;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- ret = false;
+ ret = 1;
goto end;
}
}
-bool do_bitrate_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
+int do_bitrate_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
{
- int i, ret = true, *ports = NULL;
+ int i, ret = 0, *ports = NULL;
const struct swi_attr *sa;
if (argc > 0) {
printf("this command takes no argument\n");
- ret = false;
+ ret = 1;
goto end;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- ret = false;
+ ret = 1;
goto end;
}
i = ngadmin_getBitrateLimits(nga, ports);
if (i != ERR_OK) {
printErrCode(i);
- ret = false;
+ ret = 1;
goto end;
}
#include "commands.h"
-bool do_cabletest (int argc, const char **argv, struct ngadmin *nga)
+int do_cabletest (int argc, const char **argv, struct ngadmin *nga)
{
- bool ret = true;
const struct swi_attr *sa;
struct cabletest *ct = NULL;
- int i, j=0, k=0;
+ int i, j = 0, k = 0, ret = 0;
if (argc < 1) {
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- ret = false;
+ ret = 1;
goto end;
}
i = ngadmin_cabletest(nga, ct, j);
if (i < 0) {
printErrCode(i);
- ret = false;
+ ret = 1;
goto end;
}
#include "commands.h"
-bool do_defaults (int argc, const char **argv UNUSED, struct ngadmin *nga)
+int do_defaults (int argc, const char **argv UNUSED, struct ngadmin *nga)
{
- int i, ret = true;
+ int i, ret = 0;
const struct swi_attr *sa;
char line[16];
if (argc > 0) {
printf("this command takes no argument\n");
- ret = false;
+ ret = 1;
goto end;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- ret = false;
+ ret = 1;
goto end;
}
#include "commands.h"
-bool do_firmware_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
+int do_firmware_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
{
const struct swi_attr *sa;
- bool ret = true;
+ int ret = 0;
if (argc > 0) {
printf("this command takes no argument\n");
- ret = false;
+ ret = 1;
goto end;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- ret = false;
+ ret = 1;
goto end;
}
}
-bool do_firmware_upgrade (int argc, const char **argv, struct ngadmin *nga)
+int do_firmware_upgrade (int argc, const char **argv, struct ngadmin *nga)
{
const struct swi_attr *sa;
- bool ret = true;
- int i;
+ int i, ret = 0;
if (argc != 1) {
printf("usage: firmware upgrade <file>\n");
- ret = false;
+ ret = 1;
goto end;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- ret = false;
+ ret = 1;
goto end;
}
if (argc > 0) {
printf("this command takes no argument\n");
- return false;
+ return 1;
}
printf("Available commands: \n");
printf("%s ", s->name);
putchar('\n');
- return true;
+
+ return 0;
}
#include "commands.h"
-bool do_igmp_set (int argc, const char **argv, struct ngadmin *nga)
+int do_igmp_set (int argc, const char **argv, struct ngadmin *nga)
{
int i;
struct igmp_conf ic;
if (argc != 4) {
printf("usage: igmp set <enable> <vlan> <validate> <block>\n");
- return false;
+ return 1;
}
if (ngadmin_getCurrentSwitch(nga) == NULL) {
printf("must be logged\n");
- return false;
+ return 1;
}
ic.enable = strtol(argv[0], NULL, 0);
printErrCode(i);
- return true;
+ return 0;
}
-bool do_igmp_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
+int do_igmp_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
{
- int i;
+ int i, ret = 0;
const struct swi_attr *sa;
struct igmp_conf ic;
- bool ret = true;
if (argc > 0) {
printf("this command takes no argument\n");
- ret = false;
+ ret = 1;
goto end;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- ret = false;
+ ret = 1;
goto end;
}
i = ngadmin_getIGMPConf(nga, &ic);
if (i != ERR_OK) {
printErrCode(i);
- ret = false;
+ ret = 1;
goto end;
}
if (argc > 0) {
printf("this command takes no argument\n");
- return false;
+ return 1;
}
sa = ngadmin_getSwitchTab(nga, &n);
displaySwitchTab(sa, n);
- return true;
+
+ return 0;
}
if (argc != 1) {
printf("usage: login <num>\n");
- return false;
+ return 1;
}
i = strtol(argv[0], NULL, 0);
printErrCode(i);
- return true;
+ return 0;
}
#include "commands.h"
-bool do_mirror_disable (int argc, const char **argv UNUSED, struct ngadmin *nga)
+int do_mirror_disable (int argc, const char **argv UNUSED, struct ngadmin *nga)
{
int i;
if (argc > 0) {
printf("this command takes no argument\n");
- return false;
+ return 1;
}
if (ngadmin_getCurrentSwitch(nga) == NULL) {
printf("must be logged\n");
- return false;
+ return 1;
}
i = ngadmin_setMirror(nga, NULL);
printErrCode(i);
- return true;
+ return 0;
}
-bool do_mirror_set (int argc, const char **argv, struct ngadmin *nga)
+int do_mirror_set (int argc, const char **argv, struct ngadmin *nga)
{
const struct swi_attr *sa;
char *ports = NULL;
- bool ret = true;
- int i, k = 0;
+ int i, k = 0, ret = 0;
if (argc < 3) {
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- ret = false;
+ ret = 1;
goto end;
}
ports[0] = strtol(argv[k++], NULL, 0);
if (ports[0] < 1 || ports[0] > sa->ports || strcasecmp(argv[k++], "clone") != 0) {
printf("syntax error\n");
- ret = false;
+ ret = 1;
goto end;
}
i = strtol(argv[k++], NULL, 0);
if (i < 1 || i > sa->ports) {
printf("port out of range\n");
- ret = false;
+ ret = 1;
goto end;
} else if (i == ports[0]) {
printf("destination port cannot be in port list\n");
- ret = false;
+ ret = 1;
goto end;
}
ports[i] = 1;
}
-bool do_mirror_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
+int do_mirror_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
{
const struct swi_attr *sa;
char *ports = NULL;
if (argc > 0) {
printf("this command takes no argument\n");
- return false;
+ return 1;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- return false;
+ return 1;
}
ports = malloc((sa->ports + 1) * sizeof(char));
end:
free(ports);
- return true;
+ return 0;
}
#include "commands.h"
-bool do_name_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
+int do_name_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
{
const struct swi_attr *sa;
if (argc > 0) {
printf("this command takes no argument\n");
- return false;
+ return 1;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- return false;
+ return 1;
}
puts(sa->name);
- return true;
+ return 0;
}
-bool do_name_set (int argc, const char **argv, struct ngadmin *nga)
+int do_name_set (int argc, const char **argv, struct ngadmin *nga)
{
int i;
const struct swi_attr *sa;
if (argc != 1) {
printf("usage: name set <value>\n");
- return false;
+ return 1;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- return false;
+ return 1;
}
i = ngadmin_setName(nga, argv[0]);
printErrCode(i);
- return true;
+ return 0;
}
-bool do_name_clear (int argc, const char **argv UNUSED, struct ngadmin *nga)
+int do_name_clear (int argc, const char **argv UNUSED, struct ngadmin *nga)
{
int i;
const struct swi_attr *sa;
if (argc > 0) {
printf("this command takes no argument\n");
- return false;
+ return 1;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- return false;
+ return 1;
}
i = ngadmin_setName(nga, NULL);
printErrCode(i);
- return true;
+ return 0;
}
#include "commands.h"
-bool do_netconf_set (int argc, const char **argv, struct ngadmin *nga)
+int do_netconf_set (int argc, const char **argv, struct ngadmin *nga)
{
- int i, k;
+ int i, k, ret = 0;
const struct swi_attr *sa;
struct net_conf nc;
- bool ret = true;
if (argc == 0) {
printf("usage: netconf set [dhcp yes|no] [ip <ip>] [mask <mask>] [gw <gw>]\n");
- return false;
+ return 1;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- return false;
+ return 1;
}
memset(&nc, 0, sizeof(struct net_conf));
if (strcasecmp(argv[k + 1], "yes") == 0) {
nc.dhcp = true;
} else if (strcasecmp(argv[k + 1], "no") == 0) {
- nc.dhcp = false;
+ nc.dhcp = 1;
} else {
printf("Incorrect DHCP value\n");
- ret = false;
+ ret = 1;
goto end;
}
} else if (strcasecmp(argv[k], "ip") == 0) {
if (inet_aton(argv[k + 1], &nc.ip) == 0) {
printf("Incorrect IP value\n");
- ret = false;
+ ret = 1;
goto end;
}
} else if (strcasecmp(argv[k], "mask") == 0) {
/* TODO: check if it is a correct mask */
if (inet_aton(argv[k + 1], &nc.netmask) == 0) {
printf("Incorrect mask value\n");
- ret = false;
+ ret = 1;
goto end;
}
} else if (strcasecmp(argv[k], "gw") == 0) {
if (inet_aton(argv[k + 1], &nc.gw) == 0) {
printf("Incorrect gateway value\n");
- ret = false;
+ ret = 1;
goto end;
}
}
i = ngadmin_setNetConf(nga, &nc);
if (i != ERR_OK) {
printErrCode(i);
- ret = false;
+ ret = 1;
}
end:
#include "commands.h"
-bool do_password_change (int argc, const char **argv, struct ngadmin *nga)
+int do_password_change (int argc, const char **argv, struct ngadmin *nga)
{
int i;
const struct swi_attr *sa;
if (argc != 1) {
printf("usage: password change <value>\n");
- return false;
+ return 1;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- return false;
+ return 1;
}
i = ngadmin_changePassword(nga, argv[0]);
printErrCode(i);
- return true;
+ return 0;
}
-bool do_password_set (int argc, const char **argv, struct ngadmin *nga)
+int do_password_set (int argc, const char **argv, struct ngadmin *nga)
{
int i;
char buf[64];
if (argc > 1) {
printf("usage: password set [<value>]\n");
- return false;
+ return 1;
}
if (argc == 0) {
}
- return true;
+ return 0;
}
#include "commands.h"
-bool do_ports_state (int argc, const char **argv UNUSED, struct ngadmin *nga)
+int do_ports_state (int argc, const char **argv UNUSED, struct ngadmin *nga)
{
- int i;
+ int i, ret = 0;
const struct swi_attr *sa;
unsigned char *ports = NULL;
- bool ret = true;
if (argc > 0) {
printf("this command takes no argument\n");
- ret = false;
+ ret = 1;
goto end;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- ret = false;
+ ret = 1;
goto end;
}
i = ngadmin_getPortsStatus(nga, ports);
if (i < 0) {
printErrCode(i);
- ret = false;
+ ret = 1;
goto end;
}
}
-bool do_ports_statistics_reset (int argc, const char **argv UNUSED, struct ngadmin *nga)
+int do_ports_statistics_reset (int argc, const char **argv UNUSED, struct ngadmin *nga)
{
int i;
if (argc > 0) {
printf("this command takes no argument\n");
- return false;
+ return 1;
}
if (ngadmin_getCurrentSwitch(nga) == NULL) {
printf("must be logged\n");
- return false;
+ return 1;
}
i = ngadmin_resetPortsStatistics(nga);
printErrCode(i);
- return true;
+ return 0;
}
-bool do_ports_statistics_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
+int do_ports_statistics_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
{
- int i;
+ int i, ret = 0;
const struct swi_attr *sa;
- bool ret = true;
struct port_stats *ps = NULL;
if (argc > 0) {
printf("this command takes no argument\n");
- ret = false;
+ ret = 1;
goto end;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- ret = false;
+ ret = 1;
goto end;
}
i = ngadmin_getPortsStatistics(nga, ps);
if (i < 0) {
printErrCode(i);
- ret = false;
+ ret = 1;
goto end;
}
#include "commands.h"
-bool do_qos_mode (int argc, const char **argv, struct ngadmin *nga)
+int do_qos_mode (int argc, const char **argv, struct ngadmin *nga)
{
- int i, s, ret = true;
+ int i, s, ret = 0;
const struct swi_attr *sa;
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- ret = false;
+ ret = 1;
goto end;
}
s = QOS_DOT;
} else {
printf("Unknown QOS mode\n");
- ret = false;
+ ret = 1;
goto end;
}
}
-bool do_qos_set (int argc, const char **argv, struct ngadmin *nga)
+int do_qos_set (int argc, const char **argv, struct ngadmin *nga)
{
- int i, p;
+ int i, p, ret = 0;
const struct swi_attr *sa;
- bool ret = true;
char d = PRIO_UNSPEC, *ports = NULL;
if (argc < 2) {
printf("usage: qos set (all <prio0>)|(<port1> <prio1> [<port2> <prio2> ...])\n");
- ret = false;
+ ret = 1;
goto end;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa ==NULL) {
printf("must be logged\n");
- ret = false;
+ ret = 1;
goto end;
}
}
-bool do_qos_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
+int do_qos_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
{
- int i, s = 0, ret = true;
+ int i, s = 0, ret = 0;
const struct swi_attr *sa;
char *ports = NULL;
if (argc > 0) {
printf("this command takes no argument\n");
- ret = false;
+ ret = 1;
goto end;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- ret = false;
+ ret = 1;
goto end;
}
i = ngadmin_getQOSMode(nga, &s);
if (i != ERR_OK) {
printErrCode(i);
- ret = false;
+ ret = 1;
goto end;
}
i = ngadmin_getQOSValues(nga, ports);
if (i != ERR_OK) {
printErrCode(i);
- ret = false;
+ ret = 1;
goto end;
}
#include "commands.h"
-bool do_quit (int argc, const char **argv UNUSED, struct ngadmin *nga UNUSED)
+int do_quit (int argc, const char **argv UNUSED, struct ngadmin *nga UNUSED)
{
if (argc > 0) {
printf("this command takes no argument\n");
- return false;
+ return 1;
}
main_loop_continue = 0;
- return true;
+ return 0;
}
#include "commands.h"
-bool do_restart (int argc, const char **argv UNUSED, struct ngadmin *nga UNUSED)
+int do_restart (int argc, const char **argv UNUSED, struct ngadmin *nga UNUSED)
{
- int i, ret = true;
+ int i, ret = 0;
const struct swi_attr *sa;
char line[16];
if (argc > 0) {
printf("this command takes no argument\n");
- ret = false;
+ ret = 1;
goto end;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- ret = false;
+ ret = 1;
goto end;
}
#include "commands.h"
-bool do_scan (int argc, const char **argv UNUSED, struct ngadmin *nga)
+int do_scan (int argc, const char **argv UNUSED, struct ngadmin *nga)
{
int i;
const struct swi_attr *sa;
if (argc > 0) {
printf("this command takes no argument\n");
- return false;
+ return 1;
}
i = ngadmin_scan(nga);
if (i < 0) {
printErrCode(i);
- return false;
+ return 1;
}
sa = ngadmin_getSwitchTab(nga, &i);
displaySwitchTab(sa, i);
- return true;
+ return 0;
}
#include "commands.h"
-bool do_stormfilter_enable (int argc, const char **argv UNUSED, struct ngadmin *nga)
+int do_stormfilter_enable (int argc, const char **argv UNUSED, struct ngadmin *nga)
{
int i;
const struct swi_attr *sa;
if (argc > 0) {
printf("this command takes no argument\n");
- return false;
+ return 1;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- return false;
+ return 1;
}
i = ngadmin_setStormFilterState(nga, 1);
printErrCode(i);
- return true;
+ return 0;
}
-bool do_stormfilter_disable (int argc, const char **argv UNUSED, struct ngadmin *nga)
+int do_stormfilter_disable (int argc, const char **argv UNUSED, struct ngadmin *nga)
{
int i;
const struct swi_attr *sa;
if (argc > 0) {
printf("this command takes no argument\n");
- return false;
+ return 1;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- return false;
+ return 1;
}
i = ngadmin_setStormFilterState(nga, 0);
printErrCode(i);
- return true;
+ return 0;
}
-bool do_stormfilter_set (int argc, const char **argv, struct ngadmin *nga)
+int do_stormfilter_set (int argc, const char **argv, struct ngadmin *nga)
{
- int i, d = BITRATE_UNSPEC, p, *ports = NULL;
+ int i, d = BITRATE_UNSPEC, p, *ports = NULL, ret = 0;
const struct swi_attr *sa;
- bool ret = true;
if (argc < 2) {
printf("usage: stormfilt set (all <speed0>)|(<port1> <speed1> [<port2> <speed2> ...])\n");
- ret = false;
+ ret = 1;
goto end;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- ret = false;
+ ret = 1;
goto end;
}
}
-bool do_stormfilter_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
+int do_stormfilter_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
{
- int i, s, ret = true, *ports = NULL;
+ int i, s, ret = 0, *ports = NULL;
const struct swi_attr *sa;
if (argc > 0) {
printf("this command takes no argument\n");
- ret = false;
+ ret = 1;
goto end;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- ret = false;
+ ret = 1;
goto end;
}
i = ngadmin_getStormFilterState(nga, &s);
if (i != ERR_OK) {
printErrCode(i);
- ret = false;
+ ret = 1;
goto end;
}
i = ngadmin_getStormFilterValues(nga, ports);
if (i != ERR_OK) {
printErrCode(i);
- ret = false;
+ ret = 1;
goto end;
}
}
-bool do_tree (int argc, const char **argv UNUSED, struct ngadmin *nga UNUSED)
+int do_tree (int argc, const char **argv UNUSED, struct ngadmin *nga UNUSED)
{
if (argc > 0) {
printf("this command takes no argument\n");
- return false;
+ return 1;
}
display_node(&commands, 0);
- return true;
+ return 0;
}
}
-bool do_vlan_8021q_del (int argc, const char **argv, struct ngadmin *nga)
+int do_vlan_8021q_del (int argc, const char **argv, struct ngadmin *nga)
{
const struct swi_attr *sa;
unsigned short vlan;
if (argc != 1) {
printf("usage: vlan 8021q del <vlan>\n");
- return false;
+ return 1;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- return false;
+ return 1;
}
vlan=strtoul(argv[0], NULL, 0);
if (vlan < 1 || vlan > VLAN_MAX) {
printf("vlan out of range\n");
- return false;
+ return 1;
}
i = ngadmin_VLANDestroy(nga, vlan);
printErrCode(i);
- return true;
+ return 0;
}
-bool do_vlan_8021q_set (int argc, const char **argv, struct ngadmin *nga)
+int do_vlan_8021q_set (int argc, const char **argv, struct ngadmin *nga)
{
unsigned char *ports = NULL, p, def = VLAN_UNSPEC;
const struct swi_attr *sa;
- bool ret = true;
unsigned short vlan;
- int i, k = 0;
+ int i, k = 0, ret = 0;
if (argc == 0) {
printf("usage: vlan 802.1q set <vlan> [all unspec|no|untagged|tagged] [<port1> unspec|no|untagged|tagged ...]\n");
- ret = false;
+ ret = 1;
goto end;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- ret = false;
+ ret = 1;
goto end;
}
if (vlan < 1 || vlan > VLAN_MAX) {
printf("vlan out of range\n");
- ret = false;
+ ret = 1;
goto end;
}
def = VLAN_UNSPEC;
} else {
printf("incorrect type\n");
- ret = false;
+ ret = 1;
goto end;
}
k++;
p = strtoul(argv[k++], NULL, 0) - 1;
if (p >= sa->ports) {
printf("port out of range\n");
- ret = false;
+ ret = 1;
goto end;
}
if (strcasecmp(argv[k], "tagged") ==0) {
ports[p] = VLAN_UNSPEC;
} else {
printf("incorrect type\n");
- ret = false;
+ ret = 1;
goto end;
}
k++;
}
-bool do_vlan_8021q_show (int argc, const char **argv, struct ngadmin *nga)
+int do_vlan_8021q_show (int argc, const char **argv, struct ngadmin *nga)
{
unsigned short vl = 0, *vlans = NULL;
unsigned char *ports = NULL;
const struct swi_attr *sa;
- int i, j, n = 16;
- bool ret = true;
+ int i, j, n = 16, ret = 0;
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- ret = false;
+ ret = 1;
goto end;
}
if (i != ERR_OK) {
printErrCode(i);
- ret = false;
+ ret = 1;
goto end;
}
}
-bool do_vlan_mode_set (int argc, const char **argv, struct ngadmin *nga)
+int do_vlan_mode_set (int argc, const char **argv, struct ngadmin *nga)
{
int mode, i;
"3 - basic 802.1Q\n"
"4 - advanced 802.1Q\n"
);
- return true;
+ return 0;
}
if (ngadmin_getCurrentSwitch(nga) == NULL) {
printf("must be logged\n");
- return false;
+ return 1;
}
mode = strtoul(argv[0], NULL, 0);
if (mode < 1 || mode > 4) {
printf("mode out of range\n");
- return false;
+ return 1;
}
i = ngadmin_setVLANType(nga, mode);
printErrCode(i);
- return true;
+ return 0;
}
-bool do_vlan_mode_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
+int do_vlan_mode_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
{
- int i, t, ret = true;
+ int i, t, ret = 0;
if (argc > 0) {
printf("this command takes no argument\n");
- ret = false;
+ ret = 1;
goto end;
}
if (ngadmin_getCurrentSwitch(nga) == NULL) {
printf("must be logged\n");
- ret = false;
+ ret = 1;
goto end;
}
i = ngadmin_getVLANType(nga, &t);
if (i != ERR_OK) {
printErrCode(i);
- ret = false;
+ ret = 1;
goto end;
}
}
-bool do_vlan_pvid_set (int argc, const char **argv, struct ngadmin *nga)
+int do_vlan_pvid_set (int argc, const char **argv, struct ngadmin *nga)
{
const struct swi_attr *sa;
unsigned char port;
if (argc != 2) {
printf("usage: vlan pvid set <port> <vlan>\n");
- return false;
+ return 1;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- return false;
+ return 1;
}
port = strtoul(argv[0], NULL, 0);
if (port < 1 || port > sa->ports) {
printf("port out of range\n");
- return false;
+ return 1;
}
if (vlan < 1 || vlan > VLAN_MAX) {
printf("vlan out of range\n");
- return false;
+ return 1;
}
i = ngadmin_setPVID(nga, port, vlan);
printErrCode(i);
- return true;
+ return 0;
}
-bool do_vlan_pvid_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
+int do_vlan_pvid_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
{
unsigned short *ports = NULL;
const struct swi_attr *sa;
- int i;
- bool ret = true;
+ int i, ret = 0;
if (argc > 0) {
printf("this command takes no argument\n");
- ret = false;
+ ret = 1;
goto end;
}
sa = ngadmin_getCurrentSwitch(nga);
if (sa == NULL) {
printf("must be logged\n");
- ret = false;
+ ret = 1;
goto end;
}
i = ngadmin_getAllPVID(nga, ports);
if (i != ERR_OK) {
printErrCode(i);
- ret = false;
+ ret = 1;
goto end;
}
/* bitrate */
-bool do_bitrate_set (int argc, const char **argv, struct ngadmin *nga);
-bool do_bitrate_show (int argc, const char **argv, struct ngadmin *nga);
+int do_bitrate_set (int argc, const char **argv, struct ngadmin *nga);
+int do_bitrate_show (int argc, const char **argv, struct ngadmin *nga);
/* cabletest */
-bool do_cabletest (int argc, const char **argv, struct ngadmin *nga);
+int do_cabletest (int argc, const char **argv, struct ngadmin *nga);
/* defaults */
-bool do_defaults (int argc, const char **argv, struct ngadmin *nga);
+int do_defaults (int argc, const char **argv, struct ngadmin *nga);
/* firmware */
-bool do_firmware_show (int argc, const char **argv, struct ngadmin *nga);
-bool do_firmware_upgrade (int argc, const char **argv, struct ngadmin *nga);
+int do_firmware_show (int argc, const char **argv, struct ngadmin *nga);
+int do_firmware_upgrade (int argc, const char **argv, struct ngadmin *nga);
/* help */
-bool do_help (int argc, const char **argv, struct ngadmin *nga);
+int do_help (int argc, const char **argv, struct ngadmin *nga);
/* igmp */
-bool do_igmp_set (int argc, const char **argv, struct ngadmin *nga);
-bool do_igmp_show (int argc, const char **argv, struct ngadmin *nga);
+int do_igmp_set (int argc, const char **argv, struct ngadmin *nga);
+int do_igmp_show (int argc, const char **argv, struct ngadmin *nga);
/* list */
-bool do_list (int argc, const char **argv, struct ngadmin *nga);
+int do_list (int argc, const char **argv, struct ngadmin *nga);
/* login */
-bool do_login (int argc, const char **argv, struct ngadmin *nga);
+int do_login (int argc, const char **argv, struct ngadmin *nga);
/* mirror */
-bool do_mirror_disable (int argc, const char **argv, struct ngadmin *nga);
-bool do_mirror_set (int argc, const char **argv, struct ngadmin *nga);
-bool do_mirror_show (int argc, const char **argv, struct ngadmin *nga);
+int do_mirror_disable (int argc, const char **argv, struct ngadmin *nga);
+int do_mirror_set (int argc, const char **argv, struct ngadmin *nga);
+int do_mirror_show (int argc, const char **argv, struct ngadmin *nga);
/* name */
-bool do_name_show (int argc, const char **argv, struct ngadmin *nga);
-bool do_name_set (int argc, const char **argv, struct ngadmin *nga);
-bool do_name_clear (int argc, const char **argv, struct ngadmin *nga);
+int do_name_show (int argc, const char **argv, struct ngadmin *nga);
+int do_name_set (int argc, const char **argv, struct ngadmin *nga);
+int do_name_clear (int argc, const char **argv, struct ngadmin *nga);
/* netconf */
-bool do_netconf_set (int argc, const char **argv, struct ngadmin *nga);
+int do_netconf_set (int argc, const char **argv, struct ngadmin *nga);
/* password */
-bool do_password_change (int argc, const char **argv, struct ngadmin *nga);
-bool do_password_set (int argc, const char **argv, struct ngadmin *nga);
+int do_password_change (int argc, const char **argv, struct ngadmin *nga);
+int do_password_set (int argc, const char **argv, struct ngadmin *nga);
/* ports */
-bool do_ports_state (int argc, const char **argv, struct ngadmin *nga);
-bool do_ports_statistics_reset (int argc, const char **argv, struct ngadmin *nga);
-bool do_ports_statistics_show (int argc, const char **argv, struct ngadmin *nga);
+int do_ports_state (int argc, const char **argv, struct ngadmin *nga);
+int do_ports_statistics_reset (int argc, const char **argv, struct ngadmin *nga);
+int do_ports_statistics_show (int argc, const char **argv, struct ngadmin *nga);
/* qos */
-bool do_qos_mode (int argc, const char **argv, struct ngadmin *nga);
-bool do_qos_set (int argc, const char **argv, struct ngadmin *nga);
-bool do_qos_show (int argc, const char **argv, struct ngadmin *nga);
+int do_qos_mode (int argc, const char **argv, struct ngadmin *nga);
+int do_qos_set (int argc, const char **argv, struct ngadmin *nga);
+int do_qos_show (int argc, const char **argv, struct ngadmin *nga);
/* quit */
-bool do_quit (int argc, const char **argv, struct ngadmin *nga);
+int do_quit (int argc, const char **argv, struct ngadmin *nga);
/* restart */
-bool do_restart (int argc, const char **argv, struct ngadmin *nga);
+int do_restart (int argc, const char **argv, struct ngadmin *nga);
/* scan */
-bool do_scan (int argc, const char **argv, struct ngadmin *nga);
+int do_scan (int argc, const char **argv, struct ngadmin *nga);
/* stormfilter */
-bool do_stormfilter_enable (int argc, const char **argv, struct ngadmin *nga);
-bool do_stormfilter_disable (int argc, const char **argv, struct ngadmin *nga);
-bool do_stormfilter_set (int argc, const char **argv, struct ngadmin *nga);
-bool do_stormfilter_show (int argc, const char **argv, struct ngadmin *nga);
+int do_stormfilter_enable (int argc, const char **argv, struct ngadmin *nga);
+int do_stormfilter_disable (int argc, const char **argv, struct ngadmin *nga);
+int do_stormfilter_set (int argc, const char **argv, struct ngadmin *nga);
+int do_stormfilter_show (int argc, const char **argv, struct ngadmin *nga);
/* tree */
-bool do_tree (int argc, const char **argv, struct ngadmin *nga);
+int do_tree (int argc, const char **argv, struct ngadmin *nga);
/* vlan */
-bool do_vlan_8021q_del (int argc, const char **argv, struct ngadmin *nga);
-bool do_vlan_8021q_set (int argc, const char **argv, struct ngadmin *nga);
-bool do_vlan_8021q_show (int argc, const char **argv, struct ngadmin *nga);
-bool do_vlan_mode_set (int argc, const char **argv, struct ngadmin *nga);
-bool do_vlan_mode_show (int argc, const char **argv, struct ngadmin *nga);
-bool do_vlan_pvid_set (int argc, const char **argv, struct ngadmin *nga);
-bool do_vlan_pvid_show (int argc, const char **argv, struct ngadmin *nga);
+int do_vlan_8021q_del (int argc, const char **argv, struct ngadmin *nga);
+int do_vlan_8021q_set (int argc, const char **argv, struct ngadmin *nga);
+int do_vlan_8021q_show (int argc, const char **argv, struct ngadmin *nga);
+int do_vlan_mode_set (int argc, const char **argv, struct ngadmin *nga);
+int do_vlan_mode_show (int argc, const char **argv, struct ngadmin *nga);
+int do_vlan_pvid_set (int argc, const char **argv, struct ngadmin *nga);
+int do_vlan_pvid_show (int argc, const char **argv, struct ngadmin *nga);
/* commands structure */
struct TreeNode {
const char *name;
- bool (* const comfunc)(int, const char**, struct ngadmin*);
+ int (*comfunc)(int, const char**, struct ngadmin*);
const struct TreeNode *sub;
};