dhcpc.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* vi: set sw=4 ts=4: */
  2. /* dhcpc.h */
  3. #ifndef _DHCPC_H
  4. #define _DHCPC_H
  5. #if __GNUC_PREREQ(4,1)
  6. # pragma GCC visibility push(hidden)
  7. #endif
  8. struct client_config_t {
  9. uint8_t arp[6]; /* Our arp address */
  10. /* TODO: combine flag fields into single "unsigned opt" */
  11. /* (can be set directly to the result of getopt32) */
  12. char no_default_options; /* Do not include default optins in request */
  13. USE_FEATURE_UDHCP_PORT(uint16_t port;)
  14. int ifindex; /* Index number of the interface to use */
  15. uint8_t opt_mask[256 / 8]; /* Bitmask of options to send (-O option) */
  16. const char *interface; /* The name of the interface to use */
  17. char *pidfile; /* Optionally store the process ID */
  18. const char *script; /* User script to run at dhcp events */
  19. uint8_t *clientid; /* Optional client id to use */
  20. uint8_t *vendorclass; /* Optional vendor class-id to use */
  21. uint8_t *hostname; /* Optional hostname to use */
  22. uint8_t *fqdn; /* Optional fully qualified domain name to use */
  23. };
  24. /* server_config sits in 1st half of bb_common_bufsiz1 */
  25. #define client_config (*(struct client_config_t*)(&bb_common_bufsiz1[COMMON_BUFSIZE / 2]))
  26. #if ENABLE_FEATURE_UDHCP_PORT
  27. #define CLIENT_PORT (client_config.port)
  28. #else
  29. #define CLIENT_PORT 68
  30. #endif
  31. /*** clientpacket.h ***/
  32. uint32_t random_xid(void) FAST_FUNC;
  33. int send_discover(uint32_t xid, uint32_t requested) FAST_FUNC;
  34. int send_select(uint32_t xid, uint32_t server, uint32_t requested) FAST_FUNC;
  35. #if ENABLE_FEATURE_UDHCPC_ARPING
  36. int send_decline(uint32_t xid, uint32_t server, uint32_t requested) FAST_FUNC;
  37. #endif
  38. int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr) FAST_FUNC;
  39. int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr) FAST_FUNC;
  40. int send_release(uint32_t server, uint32_t ciaddr) FAST_FUNC;
  41. int udhcp_recv_raw_packet(struct dhcpMessage *payload, int fd) FAST_FUNC;
  42. #if __GNUC_PREREQ(4,1)
  43. # pragma GCC visibility pop
  44. #endif
  45. #endif