|
|
1.1 ! root 1: /* netboot ! 2: * ! 3: * ether.h,v ! 4: * Revision 1.1 1993/07/08 16:03:57 brezak ! 5: * Diskless boot prom code from Jim McKim ([email protected]) ! 6: * ! 7: * Revision 1.1.1.1 1993/05/28 11:41:07 mckim ! 8: * Initial version. ! 9: * ! 10: * ! 11: * source in this file came from ! 12: * the Mach ethernet boot written by Leendert van Doorn. ! 13: * ! 14: * Ethernet definitions ! 15: */ ! 16: ! 17: #define ETH_ADDRSIZE 6 /* address size */ ! 18: ! 19: /* ! 20: * Structure of an ethernet header ! 21: */ ! 22: typedef struct { ! 23: u_char eth_dst[ETH_ADDRSIZE]; /* destination address */ ! 24: u_char eth_src[ETH_ADDRSIZE]; /* source address */ ! 25: u_short eth_proto; /* protocol type */ ! 26: } ethhdr_t; ! 27: ! 28: /* protocol types */ ! 29: #define ETHTYPE_IP 0x0800 /* IP protocol */ ! 30: #define ETHTYPE_ARP 0x0806 /* ARP protocol */ ! 31: #define ETHTYPE_RARP 0x8035 /* Reverse ARP protocol */ ! 32: ! 33: extern u_char eth_myaddr[]; ! 34: ! 35: int EtherInit(void); ! 36: void EtherReset(void); ! 37: void EtherStop(void); ! 38: void EtherSend(packet_t *pkt, u_short proto, u_char *dest); ! 39: packet_t *EtherReceive(void); ! 40: void EtherPrintAddr(u_char *addr); ! 41: ! 42: /* TBD - move these elsewhere? */ ! 43: ! 44: static inline u_short ! 45: htons(u_short x) { ! 46: return ((x >> 8) & 0xff) ! 47: | ((x & 0xff) << 8); ! 48: } ! 49: ! 50: #if 0 ! 51: static inline u_short ! 52: ntohs(u_short x) { ! 53: return x >> 8 & 0xff ! 54: | (x & 0xff) << 8; ! 55: } ! 56: #else ! 57: static inline u_short ! 58: ntohs(u_short x) { ! 59: return htons(x); ! 60: } ! 61: #endif ! 62: ! 63: static inline u_long ! 64: htonl(u_long x) { ! 65: return (x >> 24 & 0xffL) ! 66: | (x >> 8 & 0xff00L) ! 67: | (x << 8 & 0xff0000L) ! 68: | (x << 24 & 0xff000000L); ! 69: } ! 70: ! 71: #if 0 ! 72: static inline u_long ! 73: ntohl(u_long x) { ! 74: return x >> 24 & 0xffL ! 75: | x >> 8 & 0xff00L ! 76: | x << 8 & 0xff0000L ! 77: | x << 24 & 0xff000000L; ! 78: } ! 79: #else ! 80: static inline u_long ! 81: ntohl(u_long x) { ! 82: return htonl(x); ! 83: } ! 84: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.