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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. */
  18. FILE_LICENCE ( GPL2_OR_LATER );
  19. #include <ipxe/netdevice.h>
  20. #include <ipxe/net80211.h>
  21. #include <ipxe/command.h>
  22. #include <ipxe/parseopt.h>
  23. #include <usr/iwmgmt.h>
  24. #include <hci/ifmgmt_cmd.h>
  25. /** @file
  26. *
  27. * Wireless interface management commands
  28. *
  29. */
  30. /** "iwstat" command descriptor */
  31. static struct command_descriptor iwstat_cmd =
  32. COMMAND_DESC ( struct ifcommon_options, ifcommon_opts, 0, MAX_ARGUMENTS,
  33. "[<interface>...]" );
  34. /**
  35. * "iwstat" payload
  36. *
  37. * @v netdev Network device
  38. * @ret rc Return status code
  39. */
  40. static int iwstat_payload ( struct net_device *netdev ) {
  41. struct net80211_device *dev = net80211_get ( netdev );
  42. if ( dev )
  43. iwstat ( dev );
  44. return 0;
  45. }
  46. /**
  47. * The "iwstat" command
  48. *
  49. * @v argc Argument count
  50. * @v argv Argument list
  51. * @ret rc Return status code
  52. */
  53. static int iwstat_exec ( int argc, char **argv ) {
  54. return ifcommon_exec ( argc, argv, &iwstat_cmd, iwstat_payload, 0 );
  55. }
  56. /** "iwlist" command descriptor */
  57. static struct command_descriptor iwlist_cmd =
  58. COMMAND_DESC ( struct ifcommon_options, ifcommon_opts, 0, MAX_ARGUMENTS,
  59. "[<interface>...]" );
  60. /**
  61. * "iwlist" payload
  62. *
  63. * @v netdev Network device
  64. * @ret rc Return status code
  65. */
  66. static int iwlist_payload ( struct net_device *netdev ) {
  67. struct net80211_device *dev = net80211_get ( netdev );
  68. if ( dev )
  69. return iwlist ( dev );
  70. return 0;
  71. }
  72. /**
  73. * The "iwlist" command
  74. *
  75. * @v argc Argument count
  76. * @v argv Argument list
  77. * @ret rc Return status code
  78. */
  79. static int iwlist_exec ( int argc, char **argv ) {
  80. return ifcommon_exec ( argc, argv, &iwlist_cmd, iwlist_payload, 0 );
  81. }
  82. /** Wireless interface management commands */
  83. struct command iwmgmt_commands[] __command = {
  84. {
  85. .name = "iwstat",
  86. .exec = iwstat_exec,
  87. },
  88. {
  89. .name = "iwlist",
  90. .exec = iwlist_exec,
  91. },
  92. };