All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
dhcpclient.c File Reference
#include <freeradius-devel/libradius.h>
#include <freeradius-devel/conf.h>
#include <freeradius-devel/dhcp.h>
#include <freeradius-devel/pcap.h>
#include <ctype.h>
#include <assert.h>
#include <net/if.h>
+ Include dependency graph for dhcpclient.c:

Go to the source code of this file.

Data Structures

struct  dc_offer
 

Macros

#define DEBUG(fmt,...)   if (fr_debug_lvl > 0) fr_printf_log(fmt "\n", ## __VA_ARGS__)
 
#define DEBUG2(fmt,...)   if (fr_debug_lvl > 1) fr_printf_log(fmt "\n", ## __VA_ARGS__)
 
#define DHCP_CHADDR_LEN   (16)
 
#define DHCP_FILE_LEN   (128)
 
#define DHCP_SNAME_LEN   (64)
 
#define ERROR(fmt,...)   fr_perror("dhcpclient: " fmt, ## __VA_ARGS__)
 
#define USEC   1000000
 

Typedefs

typedef struct dc_offer dc_offer_t
 

Functions

static void dhcp_packet_debug (RADIUS_PACKET *packet, bool received)
 
int main (int argc, char **argv)
 
static void print_hex (RADIUS_PACKET *packet)
 
static RADIUS_PACKETrequest_init (char const *filename)
 
static int send_with_socket (RADIUS_PACKET **reply, RADIUS_PACKET *request)
 
static void NEVER_RETURNS usage (void)
 

Variables

static int dhcp_header_sizes []
 
static char const * dhcpclient_version
 
static char * iface = NULL
 
static int iface_ind = -1
 
static bool raw_mode = false
 
static bool reply_expected = true
 
static const FR_NAME_NUMBER request_types []
 
static int retries = 3
 
static int sockfd
 
static float timeout = 5.0
 
static struct timeval tv_timeout
 

Data Structure Documentation

struct dc_offer

Definition at line 89 of file dhcpclient.c.

Data Fields
uint32_t offered_addr
uint32_t server_addr

Macro Definition Documentation

#define DEBUG (   fmt,
  ... 
)    if (fr_debug_lvl > 0) fr_printf_log(fmt "\n", ## __VA_ARGS__)

Definition at line 36 of file dhcpclient.c.

#define DEBUG2 (   fmt,
  ... 
)    if (fr_debug_lvl > 1) fr_printf_log(fmt "\n", ## __VA_ARGS__)

Definition at line 38 of file dhcpclient.c.

#define DHCP_CHADDR_LEN   (16)

Definition at line 78 of file dhcpclient.c.

#define DHCP_FILE_LEN   (128)

Definition at line 80 of file dhcpclient.c.

#define DHCP_SNAME_LEN   (64)

Definition at line 79 of file dhcpclient.c.

#define ERROR (   fmt,
  ... 
)    fr_perror("dhcpclient: " fmt, ## __VA_ARGS__)

Definition at line 41 of file dhcpclient.c.

#define USEC   1000000

Typedef Documentation

typedef struct dc_offer dc_offer_t

Function Documentation

static void dhcp_packet_debug ( RADIUS_PACKET packet,
bool  received 
)
static

Definition at line 523 of file dhcpclient.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 580 of file dhcpclient.c.

+ Here is the call graph for this function:

static void print_hex ( RADIUS_PACKET packet)
static

Definition at line 235 of file dhcpclient.c.

+ Here is the caller graph for this function:

static RADIUS_PACKET* request_init ( char const *  filename)
static

Definition at line 126 of file dhcpclient.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int send_with_socket ( RADIUS_PACKET **  reply,
RADIUS_PACKET request 
)
static

Definition at line 401 of file dhcpclient.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void NEVER_RETURNS usage ( void  )
static

Definition at line 105 of file dhcpclient.c.

+ Here is the caller graph for this function:

Variable Documentation

int dhcp_header_sizes[]
static
Initial value:
= {
1, 1, 1, 1,
4, 2, 2, 4,
4, 4, 4,
}
#define DHCP_CHADDR_LEN
Definition: dhcpclient.c:78
#define DHCP_SNAME_LEN
Definition: dhcpclient.c:79
#define DHCP_FILE_LEN
Definition: dhcpclient.c:80

Definition at line 225 of file dhcpclient.c.

char const* dhcpclient_version
static
Initial value:
= "dhcpclient version " RADIUSD_VERSION_STRING
", built on " __DATE__ " at " __TIME__

Definition at line 82 of file dhcpclient.c.

char* iface = NULL
static

Definition at line 66 of file dhcpclient.c.

int iface_ind = -1
static

Definition at line 67 of file dhcpclient.c.

bool raw_mode = false
static

Definition at line 74 of file dhcpclient.c.

bool reply_expected = true
static

Definition at line 76 of file dhcpclient.c.

const FR_NAME_NUMBER request_types[]
static
Initial value:
= {
{ "discover", PW_DHCP_DISCOVER },
{ "request", PW_DHCP_REQUEST },
{ "decline", PW_DHCP_DECLINE },
{ "release", PW_DHCP_RELEASE },
{ "inform", PW_DHCP_INFORM },
{ "lease_query", PW_DHCP_LEASE_QUERY },
{ "auto", PW_CODE_UNDEFINED },
{ NULL, 0}
}
Packet code has not been set.
Definition: radius.h:91

Definition at line 94 of file dhcpclient.c.

int retries = 3
static

Definition at line 55 of file dhcpclient.c.

int sockfd
static

Definition at line 59 of file dhcpclient.c.

float timeout = 5.0
static

Definition at line 56 of file dhcpclient.c.

struct timeval tv_timeout
static

Definition at line 57 of file dhcpclient.c.