1 / 15

Name and Address Conversions

Name and Address Conversions. Domain Name System. A lookup mechanism for translating objects into other objects A globally distributed, loosely coherent, scalable, reliable, dynamic database Comprised of three components Name space Servers making that name space available

fagan
Download Presentation

Name and Address Conversions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Name and Address Conversions

  2. Domain Name System • A lookup mechanism for translating objects into other objects • A globally distributed, loosely coherent, scalable, reliable, dynamic database • Comprised of three components • Name space • Servers making that name space available • Resolvers (clients) which query the servers about the name space

  3. Domain Name Space • DNS's distributed database is indexed by domain names. • Each domain name is essentially just a path in a large inverted tree, called the domain name space.

  4. Header Question : the question for the name server Answer : RRs answering the question Authority : RRs pointing toward an authority Additional : RRs holding additional information Name Resolution • A DNS query has three parameters: • A domain name (e.g., ice.hufs.ac.kr), • Remember, every node has a domain name! • A class (e.g., IN), and • A type (e.g., A) • DNS message format

  5. Mapping Addresses to Names

  6. 주요 RRs SOA Record (Start Of Authority): 해당 도메인에 대해 네임서버가 인증(authoritative)된 자료를 갖고 있음을 의미 NS(Name Server) Record: 해당 도메인에 대한 delegation하는 네임서버를 지시 A Record: 도메인에 IPv4 주소를 mapping AAAA Record: 도메인에 IPv6 주소를 mapping CNAME Record: 도메인에 대한 또 다른 이름 설정 MX(Mail eXchanger) Record: 해당 호스트의 메일 라우팅 경로를 조정 PTR(Pointer) Record: IP 주소를 domain name으로 reverse mapping해 주며, Reverse Zone 파일에서 사용 Resource Records

  7. Name and Address Conversion Functions • Domain name  IPv4 address • IPv4 address  domain name • gethostbyname/gethostbyaddr are not reentrant !! • static struct hostent host; /* result stored here */ • struct hostent * • gethostbyname(const char *hostname) • { • /* call DNS functions for A or AAAA query */ • /* fill in host structure */ • return(&host); • }

  8. Service Name Conversion Functions • Service name  port ( See /etc/services ) • Port  service name

  9. Example: name/daytimetcpcli1.c Network-related information

  10. hostname: hostname or address string service: service name or decimal port number string result: addrinfo data structure is dynamically allocated Re-entrant, thread-safe, and protocol independent functions (support IPv4, IPv6) Protocol Independent Name/Address Conversion (1)

  11. Protocol Independent Name/Address Conversion (2) • hints: NULL or pointer to addrinfo data structure • The following member can be set by caller • ai_flag /* AI_PASSIVE for server, AI_CANNONNAME */ • ai_family /* AF_xxx */ • ai_socktype /* SOCK_xxx */ • ai_protocol /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ • Example

  12. getaddrinfo Actions and Results

  13. If the caller does not want to return host(serv) string, specify hostlen(servlen) of 0 flags getnameinfo Function

  14. Protocol Independent Functions

  15. Protocol-indep Daytime TCP Client/Server names/daytimetcpcli.c names/daytimetcpsrv1.c

More Related