-
-uint16_t udhcp_checksum(void *addr, int count)
-{
- /* Compute Internet Checksum for "count" bytes
- * beginning at location "addr".
- */
- int32_t sum = 0;
- uint16_t *source = (uint16_t *) addr;
-
- while (count > 1) {
- /* This is the inner loop */
- sum += *source++;
- count -= 2;
- }
-
- /* Add left-over byte, if any */
- if (count > 0) {
- /* Make sure that the left-over byte is added correctly both
- * with little and big endian hosts */
- uint16_t tmp = 0;
- *(uint8_t *) (&tmp) = * (uint8_t *) source;
- sum += tmp;
- }
- /* Fold 32-bit sum to 16 bits */
- while (sum >> 16)
- sum = (sum & 0xffff) + (sum >> 16);
-
- return ~sum;
-}
-
-
-/* Construct a ip/udp header for a packet, and specify the source and dest hardware address */
-void BUG_sizeof_struct_udp_dhcp_packet_must_be_576(void);
-int udhcp_raw_packet(struct dhcpMessage *payload,
- uint32_t source_ip, int source_port,
- uint32_t dest_ip, int dest_port, uint8_t *dest_arp, int ifindex)
+/* Construct a ip/udp header for a packet, send packet */
+int FAST_FUNC udhcp_send_raw_packet(struct dhcp_packet *dhcp_pkt,
+ uint32_t source_nip, int source_port,
+ uint32_t dest_nip, int dest_port, const uint8_t *dest_arp,
+ int ifindex)