iPXE
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)
 FILE_SECBOOT (PERMITTED)
static int pxebs_exec (int argc, char **argv)
 The "pxebs" command.
 COMMAND (dhcp, ifconf_exec)
 DHCP management commands.
 COMMAND (pxebs, pxebs_exec)

Variables

static struct option_descriptor pxebs_opts [] = {}
 "pxebs" option list
static struct command_descriptor pxebs_cmd
 "pxebs" command descriptor

Detailed Description

DHCP management commands.

Definition in file dhcp_cmd.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

◆ pxebs_exec()

int pxebs_exec ( int argc,
char ** argv )
static

The "pxebs" command.

Parameters
argcArgument count
argvArgument list
Return values
rcReturn status code

Definition at line 67 of file dhcp_cmd.c.

67 {
68 struct pxebs_options opts;
69 struct net_device *netdev;
70 unsigned int pxe_type;
71 int rc;
72
73 /* Parse options */
74 if ( ( rc = parse_options ( argc, argv, &pxebs_cmd, &opts ) ) != 0 )
75 return rc;
76
77 /* Parse net device name */
78 if ( ( rc = parse_netdev ( argv[optind], &netdev ) ) != 0 )
79 return rc;
80
81 /* Parse boot server type */
82 if ( ( rc = parse_integer ( argv[ optind + 1 ], &pxe_type ) ) != 0 )
83 return rc;
84
85 /* Perform Boot Server Discovery */
86 if ( ( rc = pxebs ( netdev, pxe_type ) ) != 0 ) {
87 printf ( "Could not discover boot server on %s: %s\n",
88 netdev->name, strerror ( rc ) );
89 return rc;
90 }
91
92 return 0;
93}
struct arbelprm_rc_send_wqe rc
Definition arbel.h:3
static union @024010030001061367220137227263210031030210157031 opts
"cert<xxx>" option list
static struct command_descriptor pxebs_cmd
"pxebs" command descriptor
Definition dhcp_cmd.c:56
int pxebs(struct net_device *netdev, unsigned int pxe_type)
Definition dhcpmgmt.c:42
static struct net_device * netdev
Definition gdbudp.c:53
int optind
Current option index.
Definition getopt.c:52
int parse_netdev(char *text, struct net_device **netdev)
Parse network device name.
Definition parseopt.c:159
int parse_integer(char *text, unsigned int *value)
Parse integer value.
Definition parseopt.c:92
int parse_options(int argc, char **argv, struct command_descriptor *cmd, void *opts)
Parse command-line options.
Definition parseopt.c:485
char * strerror(int errno)
Retrieve string representation of error number.
Definition strerror.c:79
A network device.
Definition netdevice.h:353
"pxebs" options
Definition dhcp_cmd.c:50
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition vsprintf.c:465

References netdev, optind, opts, parse_integer(), parse_netdev(), parse_options(), printf(), pxebs(), pxebs_cmd, rc, and strerror().

Referenced by COMMAND().

◆ COMMAND() [1/2]

COMMAND ( dhcp ,
ifconf_exec  )

DHCP management commands.

References ifconf_exec().

◆ COMMAND() [2/2]

COMMAND ( pxebs ,
pxebs_exec  )

References pxebs(), and pxebs_exec().

Variable Documentation

◆ pxebs_opts

struct option_descriptor pxebs_opts[] = {}
static

"pxebs" option list

Definition at line 53 of file dhcp_cmd.c.

53{};

◆ pxebs_cmd

struct command_descriptor pxebs_cmd
static
Initial value:
=
"<interface> <server type>" )
static struct option_descriptor pxebs_opts[]
"pxebs" option list
Definition dhcp_cmd.c:53
#define COMMAND_DESC(_struct, _options, _min_args, _max_args, _usage)
Construct command descriptor.
Definition parseopt.h:109

"pxebs" command descriptor

Definition at line 56 of file dhcp_cmd.c.

Referenced by pxebs_exec().