dhcpc.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* vi: set sw=4 ts=4: */
  2. /* dhcpc.h */
  3. #ifndef _DHCPC_H
  4. #define _DHCPC_H
  5. #define INIT_SELECTING 0
  6. #define REQUESTING 1
  7. #define BOUND 2
  8. #define RENEWING 3
  9. #define REBINDING 4
  10. #define INIT_REBOOT 5
  11. #define RENEW_REQUESTED 6
  12. #define RELEASED 7
  13. struct client_config_t {
  14. /* TODO: combine flag fields into single "unsigned opt" */
  15. /* (can be set directly to the result of getopt32) */
  16. char foreground; /* Do not fork */
  17. char quit_after_lease; /* Quit after obtaining lease */
  18. char release_on_quit; /* Perform release on quit */
  19. char abort_if_no_lease; /* Abort if no lease */
  20. char background_if_no_lease; /* Fork to background if no lease */
  21. const char *interface; /* The name of the interface to use */
  22. char *pidfile; /* Optionally store the process ID */
  23. const char *script; /* User script to run at dhcp events */
  24. uint8_t *clientid; /* Optional client id to use */
  25. uint8_t *vendorclass; /* Optional vendor class-id to use */
  26. uint8_t *hostname; /* Optional hostname to use */
  27. uint8_t *fqdn; /* Optional fully qualified domain name to use */
  28. int ifindex; /* Index number of the interface to use */
  29. int retries; /* Max number of request packets */
  30. int timeout; /* Number of seconds to try to get a lease */
  31. uint8_t arp[6]; /* Our arp address */
  32. };
  33. #define client_config (*(struct client_config_t*)&bb_common_bufsiz1)
  34. /*** clientpacket.h ***/
  35. uint32_t random_xid(void);
  36. int send_discover(uint32_t xid, uint32_t requested);
  37. int send_selecting(uint32_t xid, uint32_t server, uint32_t requested);
  38. int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr);
  39. int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr);
  40. int send_release(uint32_t server, uint32_t ciaddr);
  41. int get_raw_packet(struct dhcpMessage *payload, int fd);
  42. #endif