return ip;
}
-/* return ulong *in network byteorder* */
-static inline ulong NetReadLong(ulong *from)
+/* return u32 *in network byteorder* */
+static inline u32 netread32(void *from)
{
- ulong l;
+ u32 l;
- memcpy((void *)&l, (void *)from, sizeof(u32));
+ memcpy((void *)&l, from, sizeof(u32));
return l;
}
memcpy((void *)to, from, sizeof(IPaddr_t));
}
-/* copy ulong */
-static inline void NetCopyLong(ulong *to, ulong *from)
+/* copy u32 */
+static inline void netcopy32(void *to, void *from)
{
- memcpy((void *)to, (void *)from, sizeof(u32));
+ memcpy(to, from, sizeof(u32));
}
/**
retval = -4;
else if (bp->bp_hlen != HWL_ETHER)
retval = -5;
- else if (!bootp_match_id(NetReadLong((ulong *)&bp->bp_id)))
+ else if (!bootp_match_id(netread32(&bp->bp_id)))
retval = -6;
debug("Filtering pkt = %d\n", retval);
BootpCopyNetParams(bp); /* Store net parameters from reply */
/* Retrieve extended information (we must parse the vendor area) */
- if (NetReadLong((ulong *)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC))
+ if (netread32(&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC))
BootpVendorProcess((uchar *)&bp->bp_vend[4], len);
NetSetTimeout(0, (thand_f *)0);
BootpID += get_timer(0);
BootpID = htonl(BootpID);
bootp_add_id(BootpID);
- NetCopyLong(&bp->bp_id, &BootpID);
+ netcopy32(&bp->bp_id, &BootpID);
/*
* Calculate proper packet lengths taking into account the
#if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET)
case 2: /* Time offset */
to_ptr = &NetTimeOffset;
- NetCopyLong((ulong *)to_ptr, (ulong *)(popt + 2));
+ netcopy32(to_ptr, popt + 2);
NetTimeOffset = ntohl(NetTimeOffset);
break;
#endif
break;
#endif
case 51:
- NetCopyLong(&dhcp_leasetime, (ulong *) (popt + 2));
+ netcopy32(&dhcp_leasetime, popt + 2);
break;
case 53: /* Ignore Message Type Option */
break;
static int DhcpMessageType(unsigned char *popt)
{
- if (NetReadLong((ulong *)popt) != htonl(BOOTP_VENDOR_MAGIC))
+ if (netread32(popt) != htonl(BOOTP_VENDOR_MAGIC))
return -1;
popt += 4;
* ID is the id of the OFFER packet
*/
- NetCopyLong(&bp->bp_id, &bp_offer->bp_id);
+ netcopy32(&bp->bp_id, &bp_offer->bp_id);
/*
* Copy options from OFFER packet if present
debug("TRANSITIONING TO REQUESTING STATE\n");
dhcp_state = REQUESTING;
- if (NetReadLong((ulong *)&bp->bp_vend[0]) ==
+ if (netread32(&bp->bp_vend[0]) ==
htonl(BOOTP_VENDOR_MAGIC))
DhcpOptionsProcess((u8 *)&bp->bp_vend[4], bp);
debug("DHCP State: REQUESTING\n");
if (DhcpMessageType((u8 *)bp->bp_vend) == DHCP_ACK) {
- if (NetReadLong((ulong *)&bp->bp_vend[0]) ==
+ if (netread32(&bp->bp_vend[0]) ==
htonl(BOOTP_VENDOR_MAGIC))
DhcpOptionsProcess((u8 *)&bp->bp_vend[4], bp);
/* Store net params from reply */