dhcp_debug.c
Go to the documentation of this file.
1 /**
2  * @file dhcp_debug.c
3  * @brief Data logging functions for debugging purpose (DHCP)
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.0
29  **/
30 
31 //Switch to the appropriate trace level
32 #define TRACE_LEVEL DHCP_TRACE_LEVEL
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "dhcp/dhcp_debug.h"
37 #include "debug.h"
38 
39 //Check TCP/IP stack configuration
40 #if (IPV4_SUPPORT == ENABLED && DHCP_TRACE_LEVEL >= TRACE_LEVEL_DEBUG)
41 
42 //DHCP message opcodes
43 static const char_t *const opcodeLabel[] =
44 {
45  "", //0
46  "BOOTREQUEST", //1
47  "BOOTREPLY" //2
48 };
49 
50 //DHCP message types
51 static const char_t *const messageLabel[] =
52 {
53  "", //0
54  "DHCPDISCOVER", //1
55  "DHCPOFFER", //2
56  "DHCPREQUEST", //3
57  "DHCPDECLINE", //4
58  "DHCPACK", //5
59  "DHCPNAK", //6
60  "DHCPRELEASE", //7
61  "DHCPINFORM" //8
62 };
63 
64 //DHCP options
65 static const char_t *const optionLabel[] =
66 {
67  "Pad", //0
68  "Subnet Mask", //1
69  "Time Offset", //2
70  "Router", //3
71  "Time Server", //4
72  "Name Server", //5
73  "DNS Server", //6
74  "Log Server", //7
75  "Cookie Server", //8
76  "LPR Server", //9
77  "Impress Server", //10
78  "Resource Location Server", //11
79  "Host Name", //12
80  "Boot File Size", //13
81  "Merit Dump File", //14
82  "Domain Name", //15
83  "Swap Server", //16
84  "Root Path", //17
85  "Extensions Path", //18
86  "IP Forwarding", //19
87  "Non-Local Source Routing", //20
88  "Policy Filter", //21
89  "Max Datagram Reassembly Size", //22
90  "Default IP TTL", //23
91  "Path MTU Aging Timeout", //24
92  "Path MTU Plateau Table", //25
93  "Interface MTU", //26
94  "All Subnets Are Local", //27
95  "Broadcast Address", //28
96  "Perform Mask Discovery", //29
97  "Mask Supplier", //30
98  "Perform Router Discovery", //31
99  "Router Solicitation Address", //32
100  "Static Route", //33
101  "Trailer Encapsulation", //34
102  "ARP Cache Timeout", //35
103  "Ethernet Encapsulation", //36
104  "TCP Default TTL", //37
105  "TCP Keepalive Interval", //38
106  "TCP Keepalive Garbage", //39
107  "NIS Domain", //40
108  "NIS Server", //41
109  "NTP Server", //42
110  "Vendor Specific Information", //43
111  "NetBIOS NBNS Server", //44
112  "NetBIOS NBDD Server", //45
113  "NetBIOS Node Type", //46
114  "NetBIOS Scope", //47
115  "X11 Font Server", //48
116  "X11 Display Manager", //49
117  "Requested IP Address", //50
118  "IP Address Lease Time", //51
119  "Option Overload", //52
120  "DHCP Message Type", //53
121  "Server Identifier", //54
122  "Parameter Request List", //55
123  "Message", //56
124  "Max DHCP Message Size", //57
125  "Renewal (T1) Time Value", //58
126  "Rebinding (T2) Time Value", //59
127  "Vendor Class Identifier", //60
128  "Client Identifier", //61
129  "", //62
130  "", //63
131  "NISP Domain", //64
132  "NISP Server", //65
133  "TFTP Server Name", //66
134  "Bootfile Name", //67
135  "Mobile IP Home Agent", //68
136  "SMTP Server", //69
137  "POP3 Server", //70
138  "NNTP Server", //71
139  "Default WWW Server", //72
140  "Default Finger Server", //73
141  "Default IRC Server", //74
142  "StreetTalk Server", //75
143  "STDA Server", //76
144  "", //77
145  "", //78
146  "", //79
147  "Rapid Commit" //80
148 };
149 
150 
151 /**
152  * @brief Dump DHCP message for debugging purpose
153  * @param[in] message Pointer to the DHCP message to dump
154  * @param[in] length Length of the message
155  * @return Error code
156  **/
157 
159 {
160  error_t error;
161  uint_t i;
162  const char_t *label;
163  DhcpOption *option;
164 
165  //Ensure the length of the DHCP message is acceptable
166  if(length < sizeof(DhcpMessage))
167  {
168  //Report a warning
169  TRACE_WARNING("DHCP message length is invalid!\r\n");
170  //Dump message contents for debugging purpose
172  //Report an error
173  return ERROR_INVALID_LENGTH;
174  }
175 
176  //Retrieve the name associated with the opcode
177  label = (message->op < arraysize(opcodeLabel)) ? opcodeLabel[message->op] : "";
178 
179  //Dump DHCP message contents
180  TRACE_DEBUG(" Op Code (op) = %" PRIu8 " (%s)\r\n", message->op, label);
181  TRACE_DEBUG(" Hardware Type (htype) = %" PRIu8 "\r\n", message->htype);
182  TRACE_DEBUG(" Hardware Address Length (hlen) = %" PRIu8 "\r\n", message->hlen);
183  TRACE_DEBUG(" Hops (hops) = %" PRIu8 "\r\n", message->hops);
184  TRACE_DEBUG(" Transaction ID (xid) = 0x%08" PRIX32 "\r\n", ntohl(message->xid));
185  TRACE_DEBUG(" Seconds (secs) = %" PRIu16 "s\r\n", ntohs(message->secs));
186  TRACE_DEBUG(" Flags (flags) = 0x%04" PRIX16 "\r\n", ntohs(message->flags));
187  TRACE_DEBUG(" Client IP Address (ciaddr) = %s\r\n", ipv4AddrToString(message->ciaddr, NULL));
188  TRACE_DEBUG(" Your IP Address (yiaddr) = %s\r\n", ipv4AddrToString(message->yiaddr, NULL));
189  TRACE_DEBUG(" Server IP Address (siaddr) = %s\r\n", ipv4AddrToString(message->siaddr, NULL));
190  TRACE_DEBUG(" Relay IP Address (giaddr) = %s\r\n", ipv4AddrToString(message->giaddr, NULL));
191  TRACE_DEBUG(" Client Hardware Address (chaddr) = %s\r\n", macAddrToString(&message->chaddr, NULL));
192  TRACE_DEBUG(" Magic Cookie = 0x%08" PRIX32 "\r\n", ntohl(message->magicCookie));
193 
194  //Get the length of the options field
195  length -= sizeof(DhcpMessage);
196 
197  //Parse DHCP options
198  for(i = 0; i < length; i++)
199  {
200  //Point to the current option
201  option = (DhcpOption *) (message->options + i);
202 
203  //Pad option detected?
204  if(option->code == DHCP_OPT_PAD)
205  continue;
206 
207  //End option detected?
208  if(option->code == DHCP_OPT_END)
209  break;
210 
211  //Check option length
212  if((i + 1) >= length || (i + 1 + option->length) >= length)
213  {
214  //Report a warning
215  TRACE_WARNING("DHCP option length is invalid!\r\n");
216  //Dump message contents for debugging purpose
218  //Report an error
219  return ERROR_INVALID_LENGTH;
220  }
221 
222  //Display the name of the current option
223  if(option->code < arraysize(optionLabel))
224  {
225  TRACE_DEBUG(" %s option (%" PRIu8 " bytes)\r\n",
226  optionLabel[option->code], option->length);
227  }
228  else
229  {
230  TRACE_DEBUG(" Option %" PRIu8 " (%" PRIu8 " bytes)\r\n",
231  option->code, option->length);
232  }
233 
234  //Check option code
235  switch(option->code)
236  {
237  //Message type?
239  error = dhcpDumpMessageType(option);
240  break;
241 
242  //Parameter Request List option
244  error = dhcpDumpParamRequestList(option);
245  break;
246 
247  //Boolean value?
257  error = dhcpDumpBoolean(option);
258  break;
259 
260  //8-bit unsigned integer?
265  error = dhcpDumpInt8(option);
266  break;
267 
268  //16-bit unsigned integer?
273  error = dhcpDumpInt16(option);
274  break;
275 
276  //32-bit unsigned integer?
283  error = dhcpDumpInt32(option);
284  break;
285 
286  //Character strings?
287  case DHCP_OPT_HOST_NAME:
290  case DHCP_OPT_ROOT_PATH:
292  case DHCP_OPT_NIS_DOMAIN:
293  case DHCP_OPT_MESSAGE:
297  error = dhcpDumpString(option);
298  break;
299 
300  //IPv4 address?
306  case DHCP_OPT_SERVER_ID:
307  error = dhcpDumpIpv4Addr(option);
308  break;
309 
310  //List of IPv4 addresses?
311  case DHCP_OPT_ROUTER:
314  case DHCP_OPT_DNS_SERVER:
315  case DHCP_OPT_LOG_SERVER:
317  case DHCP_OPT_LPR_SERVER:
320  case DHCP_OPT_NIS_SERVER:
321  case DHCP_OPT_NTP_SERVER:
336  error = dhcpDumpIpv4AddrList(option);
337  break;
338 
339  //Raw data?
340  default:
341  error = dhcpDumpRawData(option);
342  break;
343  }
344 
345  //Failed to parse current option?
346  if(error)
347  {
348  //Report a warning
349  TRACE_WARNING("Failed to parse DHCP options!\r\n");
350  //Dump message contents for debugging purpose
352  }
353 
354  //Jump to the next option
355  i += option->length + 1;
356  }
357 
358  //No error to report
359  return NO_ERROR;
360 }
361 
362 
363 /**
364  * @brief Dump Message Type option
365  * @param[in] option Pointer to the option to dump
366  * @return Error code
367  **/
368 
370 {
371  uint8_t type;
372  const char_t *label;
373 
374  //Check option length
375  if(option->length != 1)
376  return ERROR_INVALID_OPTION;
377 
378  //Get the message type
379  type = option->value[0];
380  //Retrieve the name of the current DHCP message
381  label = (type < arraysize(messageLabel)) ? messageLabel[type] : "Unknown";
382  //Display message type
383  TRACE_DEBUG(" %" PRIu8 " (%s)\r\n", type, label);
384 
385  //No error to report
386  return NO_ERROR;
387 }
388 
389 
390 /**
391  * @brief Dump Parameter Request List option
392  * @param[in] option Pointer to the option to dump
393  * @return Error code
394  **/
395 
397 {
398  size_t i;
399  uint8_t code;
400  const char_t *label;
401 
402  //Parse the list of requested options
403  for(i = 0; i < option->length; i++)
404  {
405  //Get current option code
406  code = option->value[i];
407  //Find the name associated with this option code
408  label = (code < arraysize(optionLabel)) ? optionLabel[code] : "Unknown";
409  //Display option code and option name
410  TRACE_DEBUG(" %" PRIu8 " (%s option)\r\n", code, label);
411  }
412 
413  //No error to report
414  return NO_ERROR;
415 }
416 
417 
418 /**
419  * @brief Dump an option containing a boolean
420  * @param[in] option Pointer to the option to dump
421  * @return Error code
422  **/
423 
425 {
426  //Check option length
427  if(option->length != 1)
428  return ERROR_INVALID_OPTION;
429 
430  //Dump option contents
431  TRACE_DEBUG(" %" PRIu8 " (%s)\r\n", option->value[0], option->value[0] ? "True" : "False");
432 
433  //No error to report
434  return NO_ERROR;
435 }
436 
437 
438 /**
439  * @brief Dump an option containing a 8-bit integer
440  * @param[in] option Pointer to the option to dump
441  * @return Error code
442  **/
443 
445 {
446  //Check option length
447  if(option->length != 1)
448  return ERROR_INVALID_OPTION;
449 
450  //Dump option contents
451  TRACE_DEBUG(" %" PRIu8 "\r\n", option->value[0]);
452 
453  //No error to report
454  return NO_ERROR;
455 }
456 
457 
458 /**
459  * @brief Dump an option containing a 16-bit integer
460  * @param[in] option Pointer to the option to dump
461  * @return Error code
462  **/
463 
465 {
466  uint16_t value;
467 
468  //Check option length
469  if(option->length != 2)
470  return ERROR_INVALID_OPTION;
471 
472  //Retrieve 16-bit value
473  value = LOAD16BE(option->value);
474  //Dump option contents
475  TRACE_DEBUG(" %" PRIu16 "\r\n", value);
476 
477  //No error to report
478  return NO_ERROR;
479 }
480 
481 
482 /**
483  * @brief Dump an option containing a 32-bit integer
484  * @param[in] option Pointer to the option to dump
485  * @return Error code
486  **/
487 
489 {
490  uint32_t value;
491 
492  //Check option length
493  if(option->length != 4)
494  return ERROR_INVALID_OPTION;
495 
496  //Retrieve 32-bit value
497  value = LOAD32BE(option->value);
498  //Dump option contents
499  TRACE_DEBUG(" %" PRIu32 "\r\n", value);
500 
501  //No error to report
502  return NO_ERROR;
503 }
504 
505 
506 /**
507  * @brief Dump an option containing a string
508  * @param[in] option Pointer to the option to dump
509  * @return Error code
510  **/
511 
513 {
514  size_t i;
515 
516  //Append prefix
517  TRACE_DEBUG(" ");
518 
519  //Dump option contents
520  for(i = 0; i < option->length; i++)
521  {
522  TRACE_DEBUG("%c", option->value[i]);
523  }
524 
525  //Add a line feed
526  TRACE_DEBUG("\r\n");
527 
528  //No error to report
529  return NO_ERROR;
530 }
531 
532 
533 /**
534  * @brief Dump an option containing an IPv4 address
535  * @param[in] option Pointer to the option to dump
536  * @return Error code
537  **/
538 
540 {
542 
543  //Check option length
544  if(option->length != sizeof(Ipv4Addr))
545  return ERROR_INVALID_OPTION;
546 
547  //Retrieve IPv4 address
548  ipv4CopyAddr(&ipAddr, option->value);
549  //Dump option contents
550  TRACE_DEBUG(" %s\r\n", ipv4AddrToString(ipAddr, NULL));
551 
552  //No error to report
553  return NO_ERROR;
554 }
555 
556 
557 /**
558  * @brief Dump an option containing a list of IPv4 addresses
559  * @param[in] option Pointer to the option to dump
560  * @return Error code
561  **/
562 
564 {
565  size_t i;
567 
568  //Check option length
569  if((option->length % sizeof(Ipv4Addr)) != 0)
570  return ERROR_INVALID_OPTION;
571 
572  //Parse the list of IPv4 addresses
573  for(i = 0; i < option->length; i += sizeof(Ipv4Addr))
574  {
575  //Retrieve the current IPv4 address
576  ipv4CopyAddr(&ipAddr, option->value + i);
577  //Display current address
578  TRACE_DEBUG(" %s\r\n", ipv4AddrToString(ipAddr, NULL));
579  }
580 
581  //No error to report
582  return NO_ERROR;
583 }
584 
585 
586 /**
587  * @brief Dump an option containing raw data
588  * @param[in] option Pointer to the option to dump
589  * @return Error code
590  **/
591 
593 {
594  //Dump option contents
595  TRACE_DEBUG_ARRAY(" ", option->value, option->length);
596 
597  //No error to report
598  return NO_ERROR;
599 }
600 
601 #endif
uint8_t message[]
Definition: chap.h:154
uint8_t type
Definition: coap_common.h:176
uint8_t code
Definition: coap_common.h:179
unsigned int uint_t
Definition: compiler_port.h:50
char char_t
Definition: compiler_port.h:48
#define LOAD32BE(p)
Definition: cpu_endian.h:210
#define ntohl(value)
Definition: cpu_endian.h:422
#define ntohs(value)
Definition: cpu_endian.h:421
#define LOAD16BE(p)
Definition: cpu_endian.h:186
Debugging facilities.
#define TRACE_DEBUG_ARRAY(p, a, n)
Definition: debug.h:108
#define TRACE_DEBUG(...)
Definition: debug.h:107
#define TRACE_WARNING(...)
Definition: debug.h:85
DhcpMessage
Definition: dhcp_common.h:226
@ DHCP_OPT_LPR_SERVER
Definition: dhcp_common.h:115
@ DHCP_OPT_IP_FORWARDING
Definition: dhcp_common.h:125
@ DHCP_OPT_NTP_SERVER
Definition: dhcp_common.h:148
@ DHCP_OPT_ROOT_PATH
Definition: dhcp_common.h:123
@ DHCP_OPT_DEFAULT_WWW_SERVER
Definition: dhcp_common.h:176
@ DHCP_OPT_END
Definition: dhcp_common.h:191
@ DHCP_OPT_NETBIOS_NBNS_SERVER
Definition: dhcp_common.h:150
@ DHCP_OPT_TRAILER_ENCAPSULATION
Definition: dhcp_common.h:140
@ DHCP_OPT_MAX_DHCP_MESSAGE_SIZE
Definition: dhcp_common.h:163
@ DHCP_OPT_ETHERNET_ENCAPSULATION
Definition: dhcp_common.h:142
@ DHCP_OPT_LOG_SERVER
Definition: dhcp_common.h:113
@ DHCP_OPT_X11_FONT_SERVER
Definition: dhcp_common.h:154
@ DHCP_OPT_NIS_DOMAIN
Definition: dhcp_common.h:146
@ DHCP_OPT_HOST_NAME
Definition: dhcp_common.h:118
@ DHCP_OPT_TCP_DEFAULT_TTL
Definition: dhcp_common.h:143
@ DHCP_OPT_NAME_SERVER
Definition: dhcp_common.h:111
@ DHCP_OPT_DHCP_MESSAGE_TYPE
Definition: dhcp_common.h:159
@ DHCP_OPT_COOKIE_SERVER
Definition: dhcp_common.h:114
@ DHCP_OPT_PERFORM_MASK_DISCOVERY
Definition: dhcp_common.h:135
@ DHCP_OPT_ALL_SUBNETS_ARE_LOCAL
Definition: dhcp_common.h:133
@ DHCP_OPT_MASK_SUPPLIER
Definition: dhcp_common.h:136
@ DHCP_OPT_NETBIOS_NODE_TYPE
Definition: dhcp_common.h:152
@ DHCP_OPT_MAX_DATAGRAM_REASSEMBLY_SIZE
Definition: dhcp_common.h:128
@ DHCP_OPT_NON_LOCAL_SOURCE_ROUTING
Definition: dhcp_common.h:126
@ DHCP_OPT_BOOT_FILE_SIZE
Definition: dhcp_common.h:119
@ DHCP_OPT_RESOURCE_LOCATION_SERVER
Definition: dhcp_common.h:117
@ DHCP_OPT_DOMAIN_NAME
Definition: dhcp_common.h:121
@ DHCP_OPT_BOOTFILE_NAME
Definition: dhcp_common.h:171
@ DHCP_OPT_PATH_MTU_AGING_TIMEOUT
Definition: dhcp_common.h:130
@ DHCP_OPT_MESSAGE
Definition: dhcp_common.h:162
@ DHCP_OPT_NIS_SERVER
Definition: dhcp_common.h:147
@ DHCP_OPT_RENEWAL_TIME_VALUE
Definition: dhcp_common.h:164
@ DHCP_OPT_TIME_SERVER
Definition: dhcp_common.h:110
@ DHCP_OPT_DEFAULT_FINGER_SERVER
Definition: dhcp_common.h:177
@ DHCP_OPT_IP_ADDRESS_LEASE_TIME
Definition: dhcp_common.h:157
@ DHCP_OPT_MERIT_DUMP_FILE
Definition: dhcp_common.h:120
@ DHCP_OPT_NISP_DOMAIN
Definition: dhcp_common.h:168
@ DHCP_OPT_PERFORM_ROUTER_DISCOVERY
Definition: dhcp_common.h:137
@ DHCP_OPT_ARP_CACHE_TIMEOUT
Definition: dhcp_common.h:141
@ DHCP_OPT_DEFAULT_IP_TTL
Definition: dhcp_common.h:129
@ DHCP_OPT_INTERFACE_MTU
Definition: dhcp_common.h:132
@ DHCP_OPT_PARAM_REQUEST_LIST
Definition: dhcp_common.h:161
@ DHCP_OPT_SERVER_ID
Definition: dhcp_common.h:160
@ DHCP_OPT_TCP_KEEPALIVE_INTERVAL
Definition: dhcp_common.h:144
@ DHCP_OPT_IMPRESS_SERVER
Definition: dhcp_common.h:116
@ DHCP_OPT_ROUTER_SOLICITATION_ADDR
Definition: dhcp_common.h:138
@ DHCP_OPT_REBINDING_TIME_VALUE
Definition: dhcp_common.h:165
@ DHCP_OPT_SMTP_SERVER
Definition: dhcp_common.h:173
@ DHCP_OPT_NETBIOS_NBDD_SERVER
Definition: dhcp_common.h:151
@ DHCP_OPT_MOBILE_IP_HOME_AGENT
Definition: dhcp_common.h:172
@ DHCP_OPT_DNS_SERVER
Definition: dhcp_common.h:112
@ DHCP_OPT_SUBNET_MASK
Definition: dhcp_common.h:107
@ DHCP_OPT_POP3_SERVER
Definition: dhcp_common.h:174
@ DHCP_OPT_ROUTER
Definition: dhcp_common.h:109
@ DHCP_OPT_TCP_KEEPALIVE_GARBAGE
Definition: dhcp_common.h:145
@ DHCP_OPT_NNTP_SERVER
Definition: dhcp_common.h:175
@ DHCP_OPT_X11_DISPLAY_MANAGER
Definition: dhcp_common.h:155
@ DHCP_OPT_SWAP_SERVER
Definition: dhcp_common.h:122
@ DHCP_OPT_NISP_SERVER
Definition: dhcp_common.h:169
@ DHCP_OPT_OPTION_OVERLOAD
Definition: dhcp_common.h:158
@ DHCP_OPT_REQUESTED_IP_ADDR
Definition: dhcp_common.h:156
@ DHCP_OPT_DEFAULT_IRC_SERVER
Definition: dhcp_common.h:178
@ DHCP_OPT_EXTENSIONS_PATH
Definition: dhcp_common.h:124
@ DHCP_OPT_STDA_SERVER
Definition: dhcp_common.h:180
@ DHCP_OPT_BROADCAST_ADDR
Definition: dhcp_common.h:134
@ DHCP_OPT_STREET_TALK_SERVER
Definition: dhcp_common.h:179
@ DHCP_OPT_TFTP_SERVER_NAME
Definition: dhcp_common.h:170
@ DHCP_OPT_PAD
Definition: dhcp_common.h:106
DhcpOption
Definition: dhcp_common.h:238
error_t dhcpDumpMessageType(const DhcpOption *option)
Dump Message Type option.
Definition: dhcp_debug.c:369
error_t dhcpDumpParamRequestList(const DhcpOption *option)
Dump Parameter Request List option.
Definition: dhcp_debug.c:396
error_t dhcpDumpBoolean(const DhcpOption *option)
Dump an option containing a boolean.
Definition: dhcp_debug.c:424
error_t dhcpDumpIpv4AddrList(const DhcpOption *option)
Dump an option containing a list of IPv4 addresses.
Definition: dhcp_debug.c:563
error_t dhcpDumpInt16(const DhcpOption *option)
Dump an option containing a 16-bit integer.
Definition: dhcp_debug.c:464
error_t dhcpDumpRawData(const DhcpOption *option)
Dump an option containing raw data.
Definition: dhcp_debug.c:592
error_t dhcpDumpInt32(const DhcpOption *option)
Dump an option containing a 32-bit integer.
Definition: dhcp_debug.c:488
error_t dhcpDumpIpv4Addr(const DhcpOption *option)
Dump an option containing an IPv4 address.
Definition: dhcp_debug.c:539
error_t dhcpDumpString(const DhcpOption *option)
Dump an option containing a string.
Definition: dhcp_debug.c:512
error_t dhcpDumpMessage(const DhcpMessage *message, size_t length)
Dump DHCP message for debugging purpose.
Definition: dhcp_debug.c:158
error_t dhcpDumpInt8(const DhcpOption *option)
Dump an option containing a 8-bit integer.
Definition: dhcp_debug.c:444
Data logging functions for debugging purpose (DHCP)
error_t
Error codes.
Definition: error.h:43
@ ERROR_INVALID_OPTION
Definition: error.h:98
@ NO_ERROR
Success.
Definition: error.h:44
@ ERROR_INVALID_LENGTH
Definition: error.h:111
char_t * macAddrToString(const MacAddr *macAddr, char_t *str)
Convert a MAC address to a dash delimited string.
Definition: ethernet.c:917
Ipv4Addr ipAddr
Definition: ipcp.h:105
char_t * ipv4AddrToString(Ipv4Addr ipAddr, char_t *str)
Convert a binary IPv4 address to dot-decimal notation.
Definition: ipv4.c:1636
#define ipv4CopyAddr(destIpAddr, srcIpAddr)
Definition: ipv4.h:148
uint32_t Ipv4Addr
IPv4 network address.
Definition: ipv4.h:267
TCP/IP stack core.
#define arraysize(a)
Definition: os_port.h:71
uint8_t length
Definition: tcp.h:368
uint8_t value[]
Definition: tcp.h:369