All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Enumerations | Functions | Variables
dhcp.h File Reference

Implementation of the DHCPv4 protocol. More...

Go to the source code of this file.

Macros

#define DHCP_BASE_ATTR(x)   (x & 0xff)
 
#define DHCP_MAGIC_VENDOR   (54)
 
#define DHCP_PACK_OPTION1(x, y)   ((x) | ((y) << 8))
 
#define DHCP_UNPACK_OPTION1(x)   (((x) & 0xff00) >> 8)
 
#define PW_DHCP_IP_ADDRESS_LEASE_TIME   (51)
 
#define PW_DHCP_MESSAGE_TYPE   (53)
 
#define PW_DHCP_OFFSET   (1024)
 
#define PW_DHCP_OPTION_82   (82)
 
#define PW_DHCP_SUBNET_MASK   (1)
 
#define PW_DHCP_YOUR_IP_ADDRESS   (264)
 

Enumerations

enum  fr_dhcp_codes_t {
  PW_DHCP_DISCOVER = (PW_DHCP_OFFSET + 1),
  PW_DHCP_OFFER = (PW_DHCP_OFFSET + 2),
  PW_DHCP_REQUEST = (PW_DHCP_OFFSET+ 3),
  PW_DHCP_DECLINE = (PW_DHCP_OFFSET + 4),
  PW_DHCP_ACK = (PW_DHCP_OFFSET + 5),
  PW_DHCP_NAK = (PW_DHCP_OFFSET + 6),
  PW_DHCP_RELEASE = (PW_DHCP_OFFSET + 7),
  PW_DHCP_INFORM = (PW_DHCP_OFFSET + 8),
  PW_DHCP_FORCE_RENEW = (PW_DHCP_OFFSET + 9),
  PW_DHCP_LEASE_QUERY = (PW_DHCP_OFFSET + 10),
  PW_DHCP_LEASE_UNASSIGNED = (PW_DHCP_OFFSET + 11),
  PW_DHCP_LEASE_UNKNOWN = (PW_DHCP_OFFSET + 12),
  PW_DHCP_LEASE_ACTIVE = (PW_DHCP_OFFSET + 13),
  PW_DHCP_BULK_LEASE_QUERY = (PW_DHCP_OFFSET + 14),
  PW_DHCP_LEASE_QUERY_DONE = (PW_DHCP_OFFSET + 15),
  PW_DHCP_MAX = (PW_DHCP_OFFSET + 16)
}
 

Functions

int fr_dhcp_add_arp_entry (int fd, char const *interface, VALUE_PAIR *hwvp, VALUE_PAIR *clvp)
 
int8_t fr_dhcp_attr_cmp (void const *a, void const *b)
 
int fr_dhcp_decode (RADIUS_PACKET *packet)
 
ssize_t fr_dhcp_decode_option (TALLOC_CTX *ctx, vp_cursor_t *cursor, fr_dict_attr_t const *parent, uint8_t const *data, size_t len, void *decoder_ctx)
 
int fr_dhcp_encode (RADIUS_PACKET *packet)
 
ssize_t fr_dhcp_encode_option (uint8_t *out, size_t outlen, vp_cursor_t *cursor, void *encoder_ctx)
 
RADIUS_PACKETfr_dhcp_recv_socket (int sockfd)
 Receive DHCP packet using socket. More...
 
int fr_dhcp_send_socket (RADIUS_PACKET *packet)
 Send DHCP packet using socket. More...
 

Variables

char const * dhcp_header_names []
 
char const * dhcp_message_types []
 

Detailed Description

Implementation of the DHCPv4 protocol.

Id:
4060daa8e946b236f96a375bb177fe5a5a9dd13d

Definition in file dhcp.h.

Macro Definition Documentation

#define DHCP_BASE_ATTR (   x)    (x & 0xff)

Definition at line 101 of file dhcp.h.

#define DHCP_MAGIC_VENDOR   (54)

Definition at line 97 of file dhcp.h.

#define DHCP_PACK_OPTION1 (   x,
 
)    ((x) | ((y) << 8))

Definition at line 100 of file dhcp.h.

#define DHCP_UNPACK_OPTION1 (   x)    (((x) & 0xff00) >> 8)

Definition at line 102 of file dhcp.h.

#define PW_DHCP_IP_ADDRESS_LEASE_TIME   (51)

Definition at line 107 of file dhcp.h.

#define PW_DHCP_MESSAGE_TYPE   (53)

Definition at line 104 of file dhcp.h.

#define PW_DHCP_OFFSET   (1024)

Definition at line 73 of file dhcp.h.

#define PW_DHCP_OPTION_82   (82)

Definition at line 99 of file dhcp.h.

#define PW_DHCP_SUBNET_MASK   (1)

Definition at line 106 of file dhcp.h.

#define PW_DHCP_YOUR_IP_ADDRESS   (264)

Definition at line 105 of file dhcp.h.

Enumeration Type Documentation

Enumerator
PW_DHCP_DISCOVER 
PW_DHCP_OFFER 
PW_DHCP_REQUEST 
PW_DHCP_DECLINE 
PW_DHCP_ACK 
PW_DHCP_NAK 
PW_DHCP_RELEASE 
PW_DHCP_INFORM 
PW_DHCP_FORCE_RENEW 
PW_DHCP_LEASE_QUERY 
PW_DHCP_LEASE_UNASSIGNED 
PW_DHCP_LEASE_UNKNOWN 
PW_DHCP_LEASE_ACTIVE 
PW_DHCP_BULK_LEASE_QUERY 
PW_DHCP_LEASE_QUERY_DONE 
PW_DHCP_MAX 

Definition at line 75 of file dhcp.h.

Function Documentation

int fr_dhcp_add_arp_entry ( int  fd,
char const *  interface,
VALUE_PAIR hwvp,
VALUE_PAIR clvp 
)

+ Here is the caller graph for this function:

int8_t fr_dhcp_attr_cmp ( void const *  a,
void const *  b 
)

Definition at line 1309 of file dhcp.c.

+ Here is the caller graph for this function:

int fr_dhcp_decode ( RADIUS_PACKET packet)

Definition at line 1103 of file dhcp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ssize_t fr_dhcp_decode_option ( TALLOC_CTX *  ctx,
vp_cursor_t cursor,
fr_dict_attr_t const *  parent,
uint8_t const *  data,
size_t  len,
void *  decoder_ctx 
)

+ Here is the caller graph for this function:

int fr_dhcp_encode ( RADIUS_PACKET packet)

Definition at line 1629 of file dhcp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ssize_t fr_dhcp_encode_option ( uint8_t *  out,
size_t  outlen,
vp_cursor_t cursor,
void *  encoder_ctx 
)

+ Here is the caller graph for this function:

RADIUS_PACKET* fr_dhcp_recv_socket ( int  sockfd)

Receive DHCP packet using socket.

Parameters
sockfdhandle.
Returns
  • pointer to RADIUS_PACKET if successful.
  • NULL if failed.

Definition at line 255 of file dhcp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int fr_dhcp_send_socket ( RADIUS_PACKET packet)

Send DHCP packet using socket.

Parameters
packetto send
Returns
  • >= 0 if successful.
  • < 0 if failed.

Definition at line 561 of file dhcp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

char const* dhcp_header_names[]

Definition at line 121 of file dhcp.c.

char const* dhcp_message_types[]

Definition at line 140 of file dhcp.c.