DhcpMessage

Namespace: inet

class DhcpMessage

Represents a DHCP message. DHCP (Dynamic Host Configuration Protocol, RFC 2131) provides a framework for passing configuration information to hosts on a TCP/IP network.

See also: DhcpClient, DhcpServer

Usage diagram

Inheritance diagram

Extends

Name

Type

Description

FieldsChunk

class

(no description)

Fields

Name

Type

Description

id

int

mutable

bool

complete

bool

correct

bool

properlyRepresented

bool

chunkLength

b

rawBin

string[]

rawHex

string[]

regionTags

SharingRegionTagSet::TagBaseRegionTag[]

op

DhcpOpcode

message op code / message type. 1 = BOOTREQUEST, 2 = BOOTREPLY

htype

int

hardware address type, see Arp section in “Assigned Numbers” RFC; e.g., ‘1’ = 10mb ethernet

hlen

int

hardware address length (e.g. ‘6’ for 10mb ethernet)

hops

int

client sets to zero, optionally used by relay agents when booting via a relay agent

xid

unsigned int

transaction ID, a random number chosen by the client, used by the client and server to associate messages and responses between a client and a server

secs

int

filled in by client, seconds elapsed since client began address acquisition or renewal process

broadcast

bool

the broadcast bit in the flags field

reserved

uint16_t

MUST BE ZERO (reserved for future use)

ciaddr

Ipv4Address

client IP address; only filled in if client is in BOUND, RENEW or REBINDING state and can respond to Arp requests

yiaddr

Ipv4Address

‘your’ (client) IP address

giaddr

Ipv4Address

relay agent IP address, used in booting via a relay agent

chaddr

MacAddress

client hardware address (MAC)

sname

string

optional server host name

file

string

boot file name (unused in the simulation)

options

DhcpOptions

holds DHCP options

Properties

Name

Value

Description

beforeChange

handleChange()

descriptor

readonly

existingClass

packetData

Source code

//
// Represents a DHCP message. DHCP (Dynamic Host Configuration Protocol, RFC 2131)
// provides a framework for passing configuration information to hosts on a TCP/IP network.
//
// @see DhcpClient, DhcpServer
//
class DhcpMessage extends FieldsChunk
{
    DhcpOpcode op; // message op code / message type. 1 = BOOTREQUEST, 2 = BOOTREPLY
    int htype; // hardware address type, see Arp section in "Assigned Numbers" RFC; e.g., '1' = 10mb ethernet
    int hlen; // hardware address length (e.g.  '6' for 10mb ethernet)
    int hops; // client sets to zero, optionally used by relay agents when booting via a relay agent
    unsigned int xid; // transaction ID, a random number chosen by the client, used by the client and server to associate messages and responses between a client and a server
    int secs; // filled in by client, seconds elapsed since client began address acquisition or renewal process
    bool broadcast; // the broadcast bit in the flags field
    uint16_t reserved = 0; // MUST BE ZERO (reserved for future use)
    Ipv4Address ciaddr; // client IP address; only filled in if client is in BOUND, RENEW or REBINDING state and can respond to Arp requests
    Ipv4Address yiaddr; // 'your' (client) IP address
    Ipv4Address giaddr; // relay agent IP address, used in booting via a relay agent
    MacAddress chaddr; // client hardware address (MAC)
    string sname; // optional server host name
    string file; // boot file name (unused in the simulation)
    DhcpOptions options; // holds DHCP options
}

File: src/inet/applications/dhcp/DhcpMessage.msg