You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

iwmgmt_cmd.c 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * Copyright (C) 2009 Joshua Oreman <oremanj@rwcr.net>.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation; either version 2 of the
  7. * License, or any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  17. * 02110-1301, USA.
  18. */
  19. FILE_LICENCE ( GPL2_OR_LATER );
  20. #include <ipxe/netdevice.h>
  21. #include <ipxe/net80211.h>
  22. #include <ipxe/command.h>
  23. #include <ipxe/parseopt.h>
  24. #include <usr/iwmgmt.h>
  25. #include <hci/ifmgmt_cmd.h>
  26. /** @file
  27. *
  28. * Wireless interface management commands
  29. *
  30. */
  31. /** "iwstat" command descriptor */
  32. static struct command_descriptor iwstat_cmd =
  33. COMMAND_DESC ( struct ifcommon_options, ifcommon_opts, 0, MAX_ARGUMENTS,
  34. "[<interface>...]" );
  35. /**
  36. * "iwstat" payload
  37. *
  38. * @v netdev Network device
  39. * @ret rc Return status code
  40. */
  41. static int iwstat_payload ( struct net_device *netdev ) {
  42. struct net80211_device *dev = net80211_get ( netdev );
  43. if ( dev )
  44. iwstat ( dev );
  45. return 0;
  46. }
  47. /**
  48. * The "iwstat" command
  49. *
  50. * @v argc Argument count
  51. * @v argv Argument list
  52. * @ret rc Return status code
  53. */
  54. static int iwstat_exec ( int argc, char **argv ) {
  55. return ifcommon_exec ( argc, argv, &iwstat_cmd, iwstat_payload, 0 );
  56. }
  57. /** "iwlist" command descriptor */
  58. static struct command_descriptor iwlist_cmd =
  59. COMMAND_DESC ( struct ifcommon_options, ifcommon_opts, 0, MAX_ARGUMENTS,
  60. "[<interface>...]" );
  61. /**
  62. * "iwlist" payload
  63. *
  64. * @v netdev Network device
  65. * @ret rc Return status code
  66. */
  67. static int iwlist_payload ( struct net_device *netdev ) {
  68. struct net80211_device *dev = net80211_get ( netdev );
  69. if ( dev )
  70. return iwlist ( dev );
  71. return 0;
  72. }
  73. /**
  74. * The "iwlist" command
  75. *
  76. * @v argc Argument count
  77. * @v argv Argument list
  78. * @ret rc Return status code
  79. */
  80. static int iwlist_exec ( int argc, char **argv ) {
  81. return ifcommon_exec ( argc, argv, &iwlist_cmd, iwlist_payload, 0 );
  82. }
  83. /** Wireless interface management commands */
  84. struct command iwmgmt_commands[] __command = {
  85. {
  86. .name = "iwstat",
  87. .exec = iwstat_exec,
  88. },
  89. {
  90. .name = "iwlist",
  91. .exec = iwlist_exec,
  92. },
  93. };