This preview shows page 1. Sign up to view the full content.
Unformatted text preview: rk byte order htons: convert uint16_t from host to network byte order ntohl: convert uint32_t from network to host byte order ntohs: convert uint16_t from network to host byte order Carnegie Mellon Do[ed Decimal Nota8on By conven8on, each byte in a 32-bit IP address is represented by its decimal value and separated by a period IP address: 0x8002C2F2 = 126.96.36.199 Func8ons for conver8ng between binary IP addresses and do[ed decimal strings: inet_aton: doned decimal string IP address in network byte order inet_ntoa: IP address in network byte order doned decimal string "n" denotes network representa2on "a" denotes applica2on representa2on Carnegie Mellon IP Address Structure IP (V4) Address space divided into classes: 0 1 2 3 8 16 24 31 Class A 0 Net ID Host ID Class B 1 0 Net ID Host ID Class C 1 1 0 Net ID Host ID Class D 1 1 1 0 Mul2cast address Class E 1 1 1 1 Reserved for experiments Network ID Wri[en in form w.x.y.z/n n = number of bits in host address E.g., CMU wrinen as 188.8.131.52/16 Class B addre...
View Full Document
This note was uploaded on 04/06/2013 for the course ECE 18213 taught by Professor John during the Spring '13 term at Carnegie Mellon.
- Spring '13