3
0

options.h 780 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /* vi: set sw=4 ts=4: */
  2. /* options.h */
  3. #ifndef _OPTIONS_H
  4. #define _OPTIONS_H
  5. #define TYPE_MASK 0x0F
  6. enum {
  7. OPTION_IP=1,
  8. OPTION_IP_PAIR,
  9. OPTION_STRING,
  10. OPTION_BOOLEAN,
  11. OPTION_U8,
  12. OPTION_U16,
  13. OPTION_S16,
  14. OPTION_U32,
  15. OPTION_S32
  16. };
  17. #define OPTION_REQ 0x10 /* have the client request this option */
  18. #define OPTION_LIST 0x20 /* There can be a list of 1 or more of these */
  19. struct dhcp_option {
  20. char name[12];
  21. char flags;
  22. uint8_t code;
  23. };
  24. extern const struct dhcp_option dhcp_options[];
  25. extern const unsigned char option_lengths[];
  26. uint8_t *get_option(struct dhcpMessage *packet, int code);
  27. int end_option(uint8_t *optionptr);
  28. int add_option_string(uint8_t *optionptr, uint8_t *string);
  29. int add_simple_option(uint8_t *optionptr, uint8_t code, uint32_t data);
  30. #endif