60397e97f22805c3faa56ab84d5f367ba80b0bc1
Stefan Schuermans implementation of ethernet...

Stefan Schuermans authored 12 years ago

1) #ifndef NETHELP_H
2) #define NETHELP_H
3) 
4) // byte order
5) #define ntohs(n) (((unsigned short)(n) & 0xFF00) >> 8 | \
6)                   ((unsigned short)(n) & 0x00FF) << 8)
7) #define htons(h) (((unsigned short)(h) & 0xFF00) >> 8 | \
8)                   ((unsigned short)(h) & 0x00FF) << 8)
Stefan Schuermans switch to long tpye for ntohl

Stefan Schuermans authored 12 years ago

9) #define ntohl(n) (((unsigned long)(n) & 0xFF000000) >> 24 | \
10)                   ((unsigned long)(n) & 0x00FF0000) >> 8 | \
11)                   ((unsigned long)(n) & 0x0000FF00) << 8 | \
12)                   ((unsigned long)(n) & 0x000000FF) << 24)
13) #define htonl(h) (((unsigned long)(h) & 0xFF000000) >> 24 | \
14)                   ((unsigned long)(h) & 0x00FF0000) >> 8 | \
15)                   ((unsigned long)(h) & 0x0000FF00) << 8 | \
16)                   ((unsigned long)(h) & 0x000000FF) << 24)