iPXE
Data Structures | Functions | Variables
dhcp_cmd.c File Reference

DHCP management commands. More...

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <errno.h>
#include <stddef.h>
#include <string.h>
#include <assert.h>
#include <getopt.h>
#include <ipxe/netdevice.h>
#include <ipxe/in.h>
#include <ipxe/command.h>
#include <ipxe/parseopt.h>
#include <usr/dhcpmgmt.h>
#include <hci/ifmgmt_cmd.h>

Go to the source code of this file.

Data Structures

struct  pxebs_options
 "pxebs" options More...

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
static int pxebs_exec (int argc, char **argv)
 The "pxebs" command.

Variables

static struct option_descriptor pxebs_opts [] = {}
 "pxebs" option list
static struct command_descriptor pxebs_cmd
 "pxebs" command descriptor
struct command dhcp_commands[] __command
 DHCP management commands.

Detailed Description

DHCP management commands.

Definition in file dhcp_cmd.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
static int pxebs_exec ( int  argc,
char **  argv 
) [static]

The "pxebs" command.

Parameters:
argcArgument count
argvArgument list
Return values:
rcReturn status code

Definition at line 66 of file dhcp_cmd.c.

References net_device::name, netdev, optind, parse_integer(), parse_netdev(), parse_options(), printf(), pxebs(), rc, and strerror().

                                                {
        struct pxebs_options opts;
        struct net_device *netdev;
        unsigned int pxe_type;
        int rc;

        /* Parse options */
        if ( ( rc = parse_options ( argc, argv, &pxebs_cmd, &opts ) ) != 0 )
                return rc;

        /* Parse net device name */
        if ( ( rc = parse_netdev ( argv[optind], &netdev ) ) != 0 )
                return rc;

        /* Parse boot server type */
        if ( ( rc = parse_integer ( argv[ optind + 1 ], &pxe_type ) ) != 0 )
                return rc;

        /* Perform Boot Server Discovery */
        if ( ( rc = pxebs ( netdev, pxe_type ) ) != 0 ) {
                printf ( "Could not discover boot server on %s: %s\n",
                         netdev->name, strerror ( rc ) );
                return rc;
        }

        return 0;
}

Variable Documentation

struct option_descriptor pxebs_opts[] = {} [static]

"pxebs" option list

Definition at line 52 of file dhcp_cmd.c.

struct command_descriptor pxebs_cmd [static]
Initial value:
        COMMAND_DESC ( struct pxebs_options, pxebs_opts, 2, 2,
                       "<interface> <server type>" )

"pxebs" command descriptor

Definition at line 55 of file dhcp_cmd.c.

struct command dhcp_commands [] __command
Initial value:
 {
        {
                .name = "dhcp",
                .exec = ifconf_exec, 
        },
        {
                .name = "pxebs",
                .exec = pxebs_exec,
        },
}

DHCP management commands.

Definition at line 95 of file dhcp_cmd.c.