-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for loop detection setting
- Loading branch information
darkcoven
committed
Sep 10, 2014
1 parent
63c275b
commit 973f32d
Showing
10 changed files
with
183 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
|
||
#include "commands.h" | ||
|
||
|
||
int do_loop_enable (int argc, const char **argv UNUSED, struct ngadmin *nga) | ||
{ | ||
int i; | ||
|
||
|
||
if (argc > 0) { | ||
printf("this command takes no argument\n"); | ||
return 1; | ||
} | ||
|
||
i = ngadmin_setLoopDetectionState(nga, 1); | ||
printErrCode(i); | ||
|
||
|
||
return 0; | ||
} | ||
|
||
|
||
int do_loop_disable (int argc, const char **argv UNUSED, struct ngadmin *nga) | ||
{ | ||
int i; | ||
|
||
|
||
if (argc > 0) { | ||
printf("this command takes no argument\n"); | ||
return 1; | ||
} | ||
|
||
i = ngadmin_setLoopDetectionState(nga, 0); | ||
printErrCode(i); | ||
|
||
|
||
return 0; | ||
} | ||
|
||
|
||
int do_loop_show (int argc, const char **argv UNUSED, struct ngadmin *nga) | ||
{ | ||
int i, s; | ||
const struct swi_attr *sa; | ||
|
||
|
||
if (argc > 0) { | ||
printf("this command takes no argument\n"); | ||
return 1; | ||
} | ||
|
||
sa = ngadmin_getCurrentSwitch(nga); | ||
if (sa == NULL) { | ||
printf("must be logged\n"); | ||
return 1; | ||
} | ||
|
||
i = ngadmin_getLoopDetectionState(nga, &s); | ||
if (i != ERR_OK) { | ||
printErrCode(i); | ||
return 1; | ||
} | ||
|
||
printf("loop detection is %s\n", s ? "enabled" : "disabled"); | ||
|
||
return 0; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters