aboutsummaryrefslogtreecommitdiffstats
path: root/gpxe/src/hci
diff options
context:
space:
mode:
Diffstat (limited to 'gpxe/src/hci')
-rw-r--r--gpxe/src/hci/commands/autoboot_cmd.c2
-rw-r--r--gpxe/src/hci/commands/config_cmd.c2
-rw-r--r--gpxe/src/hci/commands/dhcp_cmd.c2
-rw-r--r--gpxe/src/hci/commands/digest_cmd.c120
-rw-r--r--gpxe/src/hci/commands/ifmgmt_cmd.c21
-rw-r--r--gpxe/src/hci/commands/image_cmd.c25
-rw-r--r--gpxe/src/hci/commands/iwmgmt_cmd.c69
-rw-r--r--gpxe/src/hci/commands/login_cmd.c2
-rw-r--r--gpxe/src/hci/commands/nvo_cmd.c2
-rw-r--r--gpxe/src/hci/commands/route_cmd.c2
-rw-r--r--gpxe/src/hci/commands/sanboot_cmd.c2
-rw-r--r--gpxe/src/hci/commands/time_cmd.c84
-rw-r--r--gpxe/src/hci/editstring.c2
-rw-r--r--gpxe/src/hci/mucurses/ansi_screen.c2
-rw-r--r--gpxe/src/hci/mucurses/clear.c2
-rw-r--r--gpxe/src/hci/mucurses/colour.c2
-rw-r--r--gpxe/src/hci/mucurses/cursor.h2
-rw-r--r--gpxe/src/hci/mucurses/mucurses.c2
-rw-r--r--gpxe/src/hci/mucurses/mucurses.h2
-rw-r--r--gpxe/src/hci/mucurses/print.c2
-rw-r--r--gpxe/src/hci/mucurses/widgets/editbox.c2
-rw-r--r--gpxe/src/hci/mucurses/winattrs.c2
-rw-r--r--gpxe/src/hci/mucurses/wininit.c2
-rw-r--r--gpxe/src/hci/readline.c2
-rw-r--r--gpxe/src/hci/shell.c9
-rw-r--r--gpxe/src/hci/shell_banner.c2
-rw-r--r--gpxe/src/hci/strerror.c19
-rw-r--r--gpxe/src/hci/tui/login_ui.c2
-rw-r--r--gpxe/src/hci/tui/settings_ui.c12
-rw-r--r--gpxe/src/hci/wireless_errors.c118
30 files changed, 482 insertions, 37 deletions
diff --git a/gpxe/src/hci/commands/autoboot_cmd.c b/gpxe/src/hci/commands/autoboot_cmd.c
index 0e6f2948..95b172d1 100644
--- a/gpxe/src/hci/commands/autoboot_cmd.c
+++ b/gpxe/src/hci/commands/autoboot_cmd.c
@@ -2,6 +2,8 @@
#include <gpxe/command.h>
#include <usr/autoboot.h>
+FILE_LICENCE ( GPL2_OR_LATER );
+
static int autoboot_exec ( int argc, char **argv ) {
if ( argc != 1 ) {
diff --git a/gpxe/src/hci/commands/config_cmd.c b/gpxe/src/hci/commands/config_cmd.c
index 87abb05a..a9e1f169 100644
--- a/gpxe/src/hci/commands/config_cmd.c
+++ b/gpxe/src/hci/commands/config_cmd.c
@@ -4,6 +4,8 @@
#include <gpxe/settings.h>
#include <gpxe/settings_ui.h>
+FILE_LICENCE ( GPL2_OR_LATER );
+
static int config_exec ( int argc, char **argv ) {
char *settings_name;
struct settings *settings;
diff --git a/gpxe/src/hci/commands/dhcp_cmd.c b/gpxe/src/hci/commands/dhcp_cmd.c
index 9b577c86..96aac8d4 100644
--- a/gpxe/src/hci/commands/dhcp_cmd.c
+++ b/gpxe/src/hci/commands/dhcp_cmd.c
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+FILE_LICENCE ( GPL2_OR_LATER );
+
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
diff --git a/gpxe/src/hci/commands/digest_cmd.c b/gpxe/src/hci/commands/digest_cmd.c
new file mode 100644
index 00000000..bc6e5516
--- /dev/null
+++ b/gpxe/src/hci/commands/digest_cmd.c
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2009 Daniel Verkamp <daniel@drv.nu>.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <gpxe/command.h>
+#include <gpxe/image.h>
+#include <gpxe/crypto.h>
+
+#include <gpxe/md5.h>
+#include <gpxe/sha1.h>
+
+/**
+ * "digest" command syntax message
+ *
+ * @v argv Argument list
+ */
+static void digest_syntax ( char **argv ) {
+ printf ( "Usage:\n"
+ " %s <image name>\n"
+ "\n"
+ "Calculate the %s of an image\n",
+ argv[0], argv[0] );
+}
+
+/**
+ * The "digest" command
+ *
+ * @v argc Argument count
+ * @v argv Argument list
+ * @v digest Digest algorithm
+ * @ret rc Exit code
+ */
+static int digest_exec ( int argc, char **argv,
+ struct digest_algorithm *digest ) {
+ const char *image_name;
+ struct image *image;
+ uint8_t digest_ctx[digest->ctxsize];
+ uint8_t digest_out[digest->digestsize];
+ uint8_t buf[128];
+ size_t offset;
+ size_t len;
+ size_t frag_len;
+ int i;
+ unsigned j;
+
+ if ( argc < 2 ||
+ !strcmp ( argv[1], "--help" ) ||
+ !strcmp ( argv[1], "-h" ) ) {
+ digest_syntax ( argv );
+ return 1;
+ }
+
+ for ( i = 1 ; i < argc ; i++ ) {
+ image_name = argv[i];
+
+ /* find image */
+ image = find_image ( image_name );
+ if ( ! image ) {
+ printf ( "No such image: %s\n", image_name );
+ continue;
+ }
+ offset = 0;
+ len = image->len;
+
+ /* calculate digest */
+ digest_init ( digest, digest_ctx );
+ while ( len ) {
+ frag_len = len;
+ if ( frag_len > sizeof ( buf ) )
+ frag_len = sizeof ( buf );
+ copy_from_user ( buf, image->data, offset, frag_len );
+ digest_update ( digest, digest_ctx, buf, frag_len );
+ len -= frag_len;
+ offset += frag_len;
+ }
+ digest_final ( digest, digest_ctx, digest_out );
+
+ for ( j = 0 ; j < sizeof ( digest_out ) ; j++ )
+ printf ( "%02x", digest_out[j] );
+
+ printf ( " %s\n", image->name );
+ }
+
+ return 0;
+}
+
+static int md5sum_exec ( int argc, char **argv ) {
+ return digest_exec ( argc, argv, &md5_algorithm );
+}
+
+static int sha1sum_exec ( int argc, char **argv ) {
+ return digest_exec ( argc, argv, &sha1_algorithm );
+}
+
+struct command md5sum_command __command = {
+ .name = "md5sum",
+ .exec = md5sum_exec,
+};
+
+struct command sha1sum_command __command = {
+ .name = "sha1sum",
+ .exec = sha1sum_exec,
+};
diff --git a/gpxe/src/hci/commands/ifmgmt_cmd.c b/gpxe/src/hci/commands/ifmgmt_cmd.c
index f2508e55..ad069f14 100644
--- a/gpxe/src/hci/commands/ifmgmt_cmd.c
+++ b/gpxe/src/hci/commands/ifmgmt_cmd.c
@@ -16,11 +16,14 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+FILE_LICENCE ( GPL2_OR_LATER );
+
#include <stdio.h>
#include <getopt.h>
#include <gpxe/netdevice.h>
#include <gpxe/command.h>
#include <usr/ifmgmt.h>
+#include <hci/ifmgmt_cmd.h>
/** @file
*
@@ -95,15 +98,15 @@ static int ifcommon_do_list ( int ( * payload ) ( struct net_device * ),
/**
* Execute if<xxx> command
*
- * @v payload Command to execute
- * @v verb Verb describing the action of the command
* @v argc Argument count
* @v argv Argument list
+ * @v payload Command to execute
+ * @v verb Verb describing the action of the command
* @ret rc Exit code
*/
-static __attribute__ (( regparm ( 2 ) )) int
-ifcommon_exec ( int ( * payload ) ( struct net_device * ),
- const char *verb, int argc, char **argv ) {
+int ifcommon_exec ( int argc, char **argv,
+ int ( * payload ) ( struct net_device * ),
+ const char *verb ) {
int c;
/* Parse options */
@@ -134,7 +137,7 @@ static int ifopen_payload ( struct net_device *netdev ) {
}
static int ifopen_exec ( int argc, char **argv ) {
- return ifcommon_exec ( ifopen_payload, "Open", argc, argv );
+ return ifcommon_exec ( argc, argv, ifopen_payload, "Open" );
}
/* "ifclose" command */
@@ -145,7 +148,7 @@ static int ifclose_payload ( struct net_device *netdev ) {
}
static int ifclose_exec ( int argc, char **argv ) {
- return ifcommon_exec ( ifclose_payload, "Close", argc, argv );
+ return ifcommon_exec ( argc, argv, ifclose_payload, "Close" );
}
/* "ifstat" command */
@@ -156,8 +159,8 @@ static int ifstat_payload ( struct net_device *netdev ) {
}
static int ifstat_exec ( int argc, char **argv ) {
- return ifcommon_exec ( ifstat_payload, "Display status of",
- argc, argv );
+ return ifcommon_exec ( argc, argv,
+ ifstat_payload, "Display status of" );
}
/** Interface management commands */
diff --git a/gpxe/src/hci/commands/image_cmd.c b/gpxe/src/hci/commands/image_cmd.c
index 6d8b5908..33994b51 100644
--- a/gpxe/src/hci/commands/image_cmd.c
+++ b/gpxe/src/hci/commands/image_cmd.c
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+FILE_LICENCE ( GPL2_OR_LATER );
+
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
@@ -497,9 +499,9 @@ static int imgstat_exec ( int argc, char **argv ) {
*/
static void imgfree_syntax ( char **argv ) {
printf ( "Usage:\n"
- " %s\n"
+ " %s [<image name>]\n"
"\n"
- "Free all executable/loadable images\n",
+ "Free one or all executable/loadable images\n",
argv[0] );
}
@@ -517,6 +519,7 @@ static int imgfree_exec ( int argc, char **argv ) {
};
struct image *image;
struct image *tmp;
+ const char *name = NULL;
int c;
/* Parse options */
@@ -531,15 +534,27 @@ static int imgfree_exec ( int argc, char **argv ) {
}
}
- /* No arguments */
+ /* Need no more than one image name */
+ if ( optind != argc )
+ name = argv[optind++];
if ( optind != argc ) {
imgfree_syntax ( argv );
return 1;
}
- /* Free all images */
- list_for_each_entry_safe ( image, tmp, &images, list ) {
+ if ( name ) {
+ /* Free specified image (may leak) */
+ image = find_image ( name );
+ if ( ! image ) {
+ printf ( "No such image: %s\n", name );
+ return 1;
+ }
imgfree ( image );
+ } else {
+ /* Free all images */
+ list_for_each_entry_safe ( image, tmp, &images, list ) {
+ imgfree ( image );
+ }
}
return 0;
}
diff --git a/gpxe/src/hci/commands/iwmgmt_cmd.c b/gpxe/src/hci/commands/iwmgmt_cmd.c
new file mode 100644
index 00000000..006c9f1d
--- /dev/null
+++ b/gpxe/src/hci/commands/iwmgmt_cmd.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2009 Joshua Oreman <oremanj@rwcr.net>.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+FILE_LICENCE ( GPL2_OR_LATER );
+
+#include <gpxe/netdevice.h>
+#include <gpxe/net80211.h>
+#include <gpxe/command.h>
+#include <usr/iwmgmt.h>
+#include <hci/ifmgmt_cmd.h>
+
+/* "iwstat" command */
+
+static int iwstat_payload ( struct net_device *netdev ) {
+ struct net80211_device *dev = net80211_get ( netdev );
+
+ if ( dev )
+ iwstat ( dev );
+
+ return 0;
+}
+
+static int iwstat_exec ( int argc, char **argv ) {
+ return ifcommon_exec ( argc, argv,
+ iwstat_payload, "Display wireless status of" );
+}
+
+/* "iwlist" command */
+
+static int iwlist_payload ( struct net_device *netdev ) {
+ struct net80211_device *dev = net80211_get ( netdev );
+
+ if ( dev )
+ return iwlist ( dev );
+
+ return 0;
+}
+
+static int iwlist_exec ( int argc, char **argv ) {
+ return ifcommon_exec ( argc, argv, iwlist_payload,
+ "List wireless networks available via" );
+}
+
+/** Wireless interface management commands */
+struct command iwmgmt_commands[] __command = {
+ {
+ .name = "iwstat",
+ .exec = iwstat_exec,
+ },
+ {
+ .name = "iwlist",
+ .exec = iwlist_exec,
+ },
+};
diff --git a/gpxe/src/hci/commands/login_cmd.c b/gpxe/src/hci/commands/login_cmd.c
index e425247d..0da2497a 100644
--- a/gpxe/src/hci/commands/login_cmd.c
+++ b/gpxe/src/hci/commands/login_cmd.c
@@ -3,6 +3,8 @@
#include <gpxe/command.h>
#include <gpxe/login_ui.h>
+FILE_LICENCE ( GPL2_OR_LATER );
+
static int login_exec ( int argc, char **argv ) {
int rc;
diff --git a/gpxe/src/hci/commands/nvo_cmd.c b/gpxe/src/hci/commands/nvo_cmd.c
index c0c07280..5eb2f06f 100644
--- a/gpxe/src/hci/commands/nvo_cmd.c
+++ b/gpxe/src/hci/commands/nvo_cmd.c
@@ -7,6 +7,8 @@
#include <gpxe/settings.h>
#include <gpxe/command.h>
+FILE_LICENCE ( GPL2_OR_LATER );
+
static int show_exec ( int argc, char **argv ) {
char buf[256];
int rc;
diff --git a/gpxe/src/hci/commands/route_cmd.c b/gpxe/src/hci/commands/route_cmd.c
index 227682cb..4372e34f 100644
--- a/gpxe/src/hci/commands/route_cmd.c
+++ b/gpxe/src/hci/commands/route_cmd.c
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+FILE_LICENCE ( GPL2_OR_LATER );
+
#include <stdio.h>
#include <getopt.h>
#include <gpxe/command.h>
diff --git a/gpxe/src/hci/commands/sanboot_cmd.c b/gpxe/src/hci/commands/sanboot_cmd.c
index d5bbfb85..783b747b 100644
--- a/gpxe/src/hci/commands/sanboot_cmd.c
+++ b/gpxe/src/hci/commands/sanboot_cmd.c
@@ -4,6 +4,8 @@
#include <gpxe/command.h>
#include <usr/autoboot.h>
+FILE_LICENCE ( GPL2_OR_LATER );
+
/**
* "sanboot" command syntax message
*
diff --git a/gpxe/src/hci/commands/time_cmd.c b/gpxe/src/hci/commands/time_cmd.c
new file mode 100644
index 00000000..947410ec
--- /dev/null
+++ b/gpxe/src/hci/commands/time_cmd.c
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2009 Daniel Verkamp <daniel@drv.nu>.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * March-19-2009 @ 02:44: Added sleep command.
+ * Shao Miller <shao.miller@yrdsb.edu.on.ca>.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <gpxe/command.h>
+#include <gpxe/nap.h>
+#include <gpxe/timer.h>
+
+static int time_exec ( int argc, char **argv ) {
+ unsigned long start;
+ int rc, secs;
+
+ if ( argc == 1 ||
+ !strcmp ( argv[1], "--help" ) ||
+ !strcmp ( argv[1], "-h" ) )
+ {
+ printf ( "Usage:\n"
+ " %s <command>\n"
+ "\n"
+ "Time a command\n",
+ argv[0] );
+ return 1;
+ }
+
+ start = currticks();
+ rc = execv ( argv[1], argv + 1 );
+ secs = (currticks() - start) / ticks_per_sec();
+
+ printf ( "%s: %ds\n", argv[0], secs );
+
+ return rc;
+}
+
+struct command time_command __command = {
+ .name = "time",
+ .exec = time_exec,
+};
+
+static int sleep_exec ( int argc, char **argv ) {
+ unsigned long start, delay;
+
+ if ( argc == 1 ||
+ !strcmp ( argv[1], "--help" ) ||
+ !strcmp ( argv[1], "-h" ))
+ {
+ printf ( "Usage:\n"
+ " %s <seconds>\n"
+ "\n"
+ "Sleep for <seconds> seconds\n",
+ argv[0] );
+ return 1;
+ }
+ start = currticks();
+ delay = strtoul ( argv[1], NULL, 0 ) * ticks_per_sec();
+ while ( ( currticks() - start ) <= delay )
+ cpu_nap();
+ return 0;
+}
+
+struct command sleep_command __command = {
+ .name = "sleep",
+ .exec = sleep_exec,
+};
diff --git a/gpxe/src/hci/editstring.c b/gpxe/src/hci/editstring.c
index 347249f7..648f3389 100644
--- a/gpxe/src/hci/editstring.c
+++ b/gpxe/src/hci/editstring.c
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+FILE_LICENCE ( GPL2_OR_LATER );
+
#include <assert.h>
#include <string.h>
#include <gpxe/keys.h>
diff --git a/gpxe/src/hci/mucurses/ansi_screen.c b/gpxe/src/hci/mucurses/ansi_screen.c
index 468bac02..51fc7c90 100644
--- a/gpxe/src/hci/mucurses/ansi_screen.c
+++ b/gpxe/src/hci/mucurses/ansi_screen.c
@@ -2,6 +2,8 @@
#include <curses.h>
#include <console.h>
+FILE_LICENCE ( GPL2_OR_LATER );
+
static void ansiscr_reset(struct _curses_screen *scr) __nonnull;
static void ansiscr_movetoyx(struct _curses_screen *scr,
unsigned int y, unsigned int x) __nonnull;
diff --git a/gpxe/src/hci/mucurses/clear.c b/gpxe/src/hci/mucurses/clear.c
index 1813939b..79b296cf 100644
--- a/gpxe/src/hci/mucurses/clear.c
+++ b/gpxe/src/hci/mucurses/clear.c
@@ -8,6 +8,8 @@
*
*/
+FILE_LICENCE ( GPL2_OR_LATER );
+
/**
* Clear a window to the bottom from current cursor position
*
diff --git a/gpxe/src/hci/mucurses/colour.c b/gpxe/src/hci/mucurses/colour.c
index 2310641e..c1359c86 100644
--- a/gpxe/src/hci/mucurses/colour.c
+++ b/gpxe/src/hci/mucurses/colour.c
@@ -1,5 +1,7 @@
#include <curses.h>
+FILE_LICENCE ( GPL2_OR_LATER );
+
struct colour_pair {
short fcol;
short bcol;
diff --git a/gpxe/src/hci/mucurses/cursor.h b/gpxe/src/hci/mucurses/cursor.h
index af86519c..16b7d27c 100644
--- a/gpxe/src/hci/mucurses/cursor.h
+++ b/gpxe/src/hci/mucurses/cursor.h
@@ -7,6 +7,8 @@
*
*/
+FILE_LICENCE ( GPL2_OR_LATER );
+
struct cursor_pos {
unsigned int y, x;
};
diff --git a/gpxe/src/hci/mucurses/mucurses.c b/gpxe/src/hci/mucurses/mucurses.c
index 3620d08b..087ebcc3 100644
--- a/gpxe/src/hci/mucurses/mucurses.c
+++ b/gpxe/src/hci/mucurses/mucurses.c
@@ -8,6 +8,8 @@
*
*/
+FILE_LICENCE ( GPL2_OR_LATER );
+
static void _wupdcurs ( WINDOW *win ) __nonnull;
void _wputch ( WINDOW *win, chtype ch, int wrap ) __nonnull;
void _wputc ( WINDOW *win, char c, int wrap ) __nonnull;
diff --git a/gpxe/src/hci/mucurses/mucurses.h b/gpxe/src/hci/mucurses/mucurses.h
index 1476733f..7ac1086a 100644
--- a/gpxe/src/hci/mucurses/mucurses.h
+++ b/gpxe/src/hci/mucurses/mucurses.h
@@ -7,6 +7,8 @@
*
*/
+FILE_LICENCE ( GPL2_OR_LATER );
+
#define WRAP 0
#define NOWRAP 1
diff --git a/gpxe/src/hci/mucurses/print.c b/gpxe/src/hci/mucurses/print.c
index 9fca3088..1608c0a7 100644
--- a/gpxe/src/hci/mucurses/print.c
+++ b/gpxe/src/hci/mucurses/print.c
@@ -10,6 +10,8 @@
*
*/
+FILE_LICENCE ( GPL2_OR_LATER );
+
/**
* Add a single-byte character and rendition to a window and advance
* the cursor
diff --git a/gpxe/src/hci/mucurses/widgets/editbox.c b/gpxe/src/hci/mucurses/widgets/editbox.c
index a52089ce..ee7d609d 100644
--- a/gpxe/src/hci/mucurses/widgets/editbox.c
+++ b/gpxe/src/hci/mucurses/widgets/editbox.c
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+FILE_LICENCE ( GPL2_OR_LATER );
+
#include <string.h>
#include <assert.h>
#include <gpxe/editbox.h>
diff --git a/gpxe/src/hci/mucurses/winattrs.c b/gpxe/src/hci/mucurses/winattrs.c
index 15f97326..f549d751 100644
--- a/gpxe/src/hci/mucurses/winattrs.c
+++ b/gpxe/src/hci/mucurses/winattrs.c
@@ -6,6 +6,8 @@
*
*/
+FILE_LICENCE ( GPL2_OR_LATER );
+
/**
* Get the background rendition attributes for a window
*
diff --git a/gpxe/src/hci/mucurses/wininit.c b/gpxe/src/hci/mucurses/wininit.c
index cd27f9fe..782e7b5c 100644
--- a/gpxe/src/hci/mucurses/wininit.c
+++ b/gpxe/src/hci/mucurses/wininit.c
@@ -7,6 +7,8 @@
*
*/
+FILE_LICENCE ( GPL2_OR_LATER );
+
/**
* Initialise console environment
*
diff --git a/gpxe/src/hci/readline.c b/gpxe/src/hci/readline.c
index ff7a7679..e5699d51 100644
--- a/gpxe/src/hci/readline.c
+++ b/gpxe/src/hci/readline.c
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+FILE_LICENCE ( GPL2_OR_LATER );
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
diff --git a/gpxe/src/hci/shell.c b/gpxe/src/hci/shell.c
index 18b1068e..5bedbdc9 100644
--- a/gpxe/src/hci/shell.c
+++ b/gpxe/src/hci/shell.c
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+FILE_LICENCE ( GPL2_OR_LATER );
+
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
@@ -29,11 +31,6 @@
*
*/
-static struct command commands[0]
- __table_start ( struct command, commands );
-static struct command commands_end[0]
- __table_end ( struct command, commands );
-
/** The shell prompt string */
static const char shell_prompt[] = "gPXE> ";
@@ -65,7 +62,7 @@ static int help_exec ( int argc __unused, char **argv __unused ) {
unsigned int hpos = 0;
printf ( "\nAvailable commands:\n\n" );
- for ( command = commands ; command < commands_end ; command++ ) {
+ for_each_table_entry ( command, COMMANDS ) {
hpos += printf ( " %s", command->name );
if ( hpos > ( 16 * 4 ) ) {
printf ( "\n" );
diff --git a/gpxe/src/hci/shell_banner.c b/gpxe/src/hci/shell_banner.c
index 3271c483..8afefe3d 100644
--- a/gpxe/src/hci/shell_banner.c
+++ b/gpxe/src/hci/shell_banner.c
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+FILE_LICENCE ( GPL2_OR_LATER );
+
#include <stdio.h>
#include <console.h>
#include <unistd.h>
diff --git a/gpxe/src/hci/strerror.c b/gpxe/src/hci/strerror.c
index 74995e8b..94547dd4 100644
--- a/gpxe/src/hci/strerror.c
+++ b/gpxe/src/hci/strerror.c
@@ -18,24 +18,19 @@
*
*/
-static struct errortab errortab_start[0]
- __table_start ( struct errortab, errortab );
-static struct errortab errortab_end[0]
- __table_end ( struct errortab, errortab );
+FILE_LICENCE ( GPL2_OR_LATER );
/**
* Find error description
*
* @v errno Error number
- * @v mask Mask of bits that we care about
* @ret errortab Error description, or NULL
*/
-static struct errortab * find_error ( int errno, int mask ) {
+static struct errortab * find_error ( int errno ) {
struct errortab *errortab;
- for ( errortab = errortab_start ; errortab < errortab_end ;
- errortab++ ) {
- if ( ( ( errortab->errno ^ errno ) & mask ) == 0 )
+ for_each_table_entry ( errortab, ERRORTAB ) {
+ if ( errortab->errno == errno )
return errortab;
}
@@ -54,13 +49,13 @@ static struct errortab * find_closest_error ( int errno ) {
struct errortab *errortab;
/* First, look for an exact match */
- if ( ( errortab = find_error ( errno, 0x7fffffff ) ) != NULL )
+ if ( ( errortab = find_error ( errno ) ) != NULL )
return errortab;
/* Second, try masking off the gPXE-specific bit and seeing if
* we have an entry for the generic POSIX error message.
*/
- if ( ( errortab = find_error ( errno, 0x4f0000ff ) ) != NULL )
+ if ( ( errortab = find_error ( errno & 0x7f0000ff ) ) != NULL )
return errortab;
return NULL;
@@ -119,7 +114,9 @@ struct errortab common_errors[] __errortab = {
{ ENOEXEC, "Not an executable image" },
{ ENOMEM, "Out of memory" },
{ ENOSPC, "No space left on device" },
+ { ENOTCONN, "Not connected" },
{ ENOTSUP, "Not supported" },
{ EPERM, "Operation not permitted" },
+ { ERANGE, "Out of range" },
{ ETIMEDOUT, "Connection timed out" },
};
diff --git a/gpxe/src/hci/tui/login_ui.c b/gpxe/src/hci/tui/login_ui.c
index c14a2c03..b80bf27b 100644
--- a/gpxe/src/hci/tui/login_ui.c
+++ b/gpxe/src/hci/tui/login_ui.c
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+FILE_LICENCE ( GPL2_OR_LATER );
+
/** @file
*
* Login UI
diff --git a/gpxe/src/hci/tui/settings_ui.c b/gpxe/src/hci/tui/settings_ui.c
index 4ab38270..74ce6afb 100644
--- a/gpxe/src/hci/tui/settings_ui.c
+++ b/gpxe/src/hci/tui/settings_ui.c
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+FILE_LICENCE ( GPL2_OR_LATER );
+
#include <stdio.h>
#include <stdarg.h>
#include <unistd.h>
@@ -77,12 +79,8 @@ struct setting_widget {
char value[256]; /* enough size for a DHCP string */
};
-/** Registered configuration settings */
-static struct setting all_settings[0]
- __table_start ( struct setting, settings );
-static struct setting all_settings_end[0]
- __table_end ( struct setting, settings );
-#define NUM_SETTINGS ( ( unsigned ) ( all_settings_end - all_settings ) )
+/** Number of registered configuration settings */
+#define NUM_SETTINGS table_num_entries ( SETTINGS )
static void load_setting ( struct setting_widget *widget ) __nonnull;
static int save_setting ( struct setting_widget *widget ) __nonnull;
@@ -223,6 +221,8 @@ static int edit_setting ( struct setting_widget *widget, int key ) {
static void init_setting_index ( struct setting_widget *widget,
struct settings *settings,
unsigned int index ) {
+ struct setting *all_settings = table_start ( SETTINGS );
+
init_setting ( widget, settings, &all_settings[index],
( SETTINGS_LIST_ROW + index ), SETTINGS_LIST_COL );
}
diff --git a/gpxe/src/hci/wireless_errors.c b/gpxe/src/hci/wireless_errors.c
new file mode 100644
index 00000000..46006f9e
--- /dev/null
+++ b/gpxe/src/hci/wireless_errors.c
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2009 Joshua Oreman <oremanj@rwcr.net>.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+FILE_LICENCE ( GPL2_OR_LATER );
+
+#include <errno.h>
+#include <gpxe/errortab.h>
+
+/* Record errors as though they come from the 802.11 stack */
+#undef ERRFILE
+#define ERRFILE ERRFILE_net80211
+
+/** All 802.11 errors
+ *
+ * These follow the 802.11 standard as much as is feasible, but most
+ * have been abbreviated to fit the 50-character limit imposed by
+ * strerror.
+ */
+struct errortab wireless_errors[] __errortab = {
+ /* gPXE 802.11 stack errors */
+ { EINVAL | EUNIQ_01, "Packet too short" },
+ { EINVAL | EUNIQ_02, "Packet 802.11 version not supported" },
+ { EINVAL | EUNIQ_03, "Packet not a data packet" },
+ { EINVAL | EUNIQ_04, "Packet not from an Access Point" },
+ { EINVAL | EUNIQ_05, "Packet has invalid LLC header" },
+ { EINVAL | EUNIQ_06, "Packet decryption error", },
+ { EINVAL | EUNIQ_07, "Invalid active scan requested" },
+
+ /* 802.11 status codes (IEEE Std 802.11-2007, Table 7-23) */
+ /* Maximum error length: 50 chars | */
+ { ECONNREFUSED | EUNIQ_01, "Unspecified failure" },
+ { ECONNREFUSED | EUNIQ_0A, "Cannot support all requested capabilities" },
+ { ECONNREFUSED | EUNIQ_0B, "Reassociation denied due to lack of association" },
+ { ECONNREFUSED | EUNIQ_0C, "Association denied for another reason" },
+ { ECONNREFUSED | EUNIQ_0D, "Authentication algorithm unsupported" },
+ { ECONNREFUSED | EUNIQ_0E, "Authentication sequence number unexpected" },
+ { ECONNREFUSED | EUNIQ_0F, "Authentication rejected due to challenge failure" },
+ { ECONNREFUSED | EUNIQ_10, "Authentication rejected due to timeout" },
+ { ECONNREFUSED | EUNIQ_11, "Association denied because AP is out of resources" },
+ { ECONNREFUSED | EUNIQ_12, "Association denied; basic rate support required" },
+ { ECONNREFUSED | EUNIQ_13, "Association denied; short preamble support req'd" },
+ { ECONNREFUSED | EUNIQ_14, "Association denied; PBCC modulation support req'd" },
+ { ECONNREFUSED | EUNIQ_15, "Association denied; Channel Agility support req'd" },
+ { ECONNREFUSED | EUNIQ_16, "Association denied; Spectrum Management required" },
+ { ECONNREFUSED | EUNIQ_17, "Association denied; Power Capability unacceptable" },
+ { ECONNREFUSED | EUNIQ_18, "Association denied; Supported Channels unacceptable" },
+ { ECONNREFUSED | EUNIQ_19, "Association denied; Short Slot Tume support req'd" },
+ { ECONNREFUSED | EUNIQ_1A, "Association denied; DSSS-OFDM support required" },
+ { EHOSTUNREACH, "Unspecified, QoS-related failure" },
+ { EHOSTUNREACH | EUNIQ_01, "Association denied; QoS AP out of QoS resources" },
+ { EHOSTUNREACH | EUNIQ_02, "Association denied due to excessively poor link" },
+ { EHOSTUNREACH | EUNIQ_03, "Association denied; QoS support required" },
+ { EHOSTUNREACH | EUNIQ_05, "The request has been declined" },
+ { EHOSTUNREACH | EUNIQ_06, "Request unsuccessful due to invalid parameters" },
+ { EHOSTUNREACH | EUNIQ_07, "TS not created due to bad specification" },
+ { EHOSTUNREACH | EUNIQ_08, "Invalid information element" },
+ { EHOSTUNREACH | EUNIQ_09, "Invalid group cipher" },
+ { EHOSTUNREACH | EUNIQ_0A, "Invalid pairwise cipher" },
+ { EHOSTUNREACH | EUNIQ_0B, "Invalid AKMP" },
+ { EHOSTUNREACH | EUNIQ_0C, "Unsupported RSN information element version" },
+ { EHOSTUNREACH | EUNIQ_0D, "Invalid RSN information element capabilities" },
+ { EHOSTUNREACH | EUNIQ_0E, "Cipher suite rejected because of security policy" },
+ { EHOSTUNREACH | EUNIQ_0F, "TS not created due to insufficient delay" },
+ { EHOSTUNREACH | EUNIQ_10, "Direct link is not allowed in the BSS by policy" },
+ { EHOSTUNREACH | EUNIQ_11, "The Destination STA is not present within the BSS" },
+ { EHOSTUNREACH | EUNIQ_12, "The Destination STA is not a QoS STA" },
+ { EHOSTUNREACH | EUNIQ_13, "Association denied; Listen Interval is too large" },
+
+ /* 802.11 reason codes (IEEE Std 802.11-2007, Table 7-22) */
+ /* Maximum error length: 50 chars | */
+ { ECONNRESET | EUNIQ_01, "Unspecified reason" },
+ { ECONNRESET | EUNIQ_02, "Previous authentication no longer valid" },
+ { ECONNRESET | EUNIQ_03, "Deauthenticated due to leaving network" },
+ { ECONNRESET | EUNIQ_04, "Disassociated due to inactivity" },
+ { ECONNRESET | EUNIQ_05, "Disassociated because AP is out of resources" },
+ { ECONNRESET | EUNIQ_06, "Class 2 frame received from nonauthenticated STA" },
+ { ECONNRESET | EUNIQ_07, "Class 3 frame received from nonassociated STA" },
+ { ECONNRESET | EUNIQ_08, "Disassociated due to roaming" },
+ { ECONNRESET | EUNIQ_09, "STA requesting (re)association not authenticated" },
+ { ECONNRESET | EUNIQ_0A, "Disassociated; Power Capability unacceptable" },
+ { ECONNRESET | EUNIQ_0B, "Disassociated; Supported Channels unacceptable" },
+ { ECONNRESET | EUNIQ_0D, "Invalid information element" },
+ { ECONNRESET | EUNIQ_0E, "Message integrity code (MIC) failure" },
+ { ECONNRESET | EUNIQ_0F, "4-Way Handshake timeout" },
+ { ECONNRESET | EUNIQ_10, "Group Key Handshake timeout" },
+ { ECONNRESET | EUNIQ_11, "4-Way Handshake information element changed unduly" },
+ { ECONNRESET | EUNIQ_12, "Invalid group cipher" },
+ { ECONNRESET | EUNIQ_13, "Invalid pairwise cipher" },
+ { ECONNRESET | EUNIQ_14, "Invalid AKMP" },
+ { ECONNRESET | EUNIQ_15, "Unsupported RSN information element version" },
+ { ECONNRESET | EUNIQ_16, "Invalid RSN information element capabilities" },
+ { ECONNRESET | EUNIQ_17, "IEEE 802.1X authentication failed" },
+ { ECONNRESET | EUNIQ_18, "Cipher suite rejected because of security policy" },
+ { ENETRESET, "Disassociated for unspecified, QoS-related reason" },
+ { ENETRESET | EUNIQ_01, "Disassociated; QoS AP is out of QoS resources" },
+ { ENETRESET | EUNIQ_02, "Disassociated due to excessively poor link" },
+ { ENETRESET | EUNIQ_03, "Disassociated due to TXOP limit violation" },
+ { ENETRESET | EUNIQ_04, "Requested; STA is leaving the BSS (or resetting)" },
+ { ENETRESET | EUNIQ_05, "Requested; does not want to use the mechanism" },
+ { ENETRESET | EUNIQ_06, "Requested; setup is required" },
+ { ENETRESET | EUNIQ_07, "Requested from peer STA due to timeout" },
+ { ENETRESET | EUNIQ_0D, "Peer STA does not support requested cipher suite" },
+};