📄 ipv6
字号:
(connectory) memset(&hints, 0, sizeof(hints)); hints.ai_family = family; hints.ai_socktype = SOCK_STREAM; if ((err = Getaddrinfo(host, port, &hints, &results))) return -5;---(inet_vhostsockaddr) /* * Can it really be this simple? */ memset(&hints, 0, sizeof(hints)); hints.ai_family = family; hints.ai_socktype = SOCK_STREAM; if (port != -1) { hints.ai_flags = AI_PASSIVE; snprintf(p_port, 12, "%hu", port); p = p_port; } if ((err = Getaddrinfo(LocalHostName, p, &hints, &res))) return -10;---(inet_strton -- <INTERESTING>)AI_NUMERICHOST memset(&hints, 0, sizeof(hints)); hints.ai_flags = flags; hints.ai_family = family; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = 0; if ((retval = Getaddrinfo(host, port, &hints, &results))) { yell("getaddrinfo(%s): %s", host, gai_strerror(retval)); return -5; }---(wserv) memset(&hints, 0, sizeof(hints)); hints.ai_flags = 0; hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = 0; if ((retval = getaddrinfo(host, port, &hints, &results))) { yell("getaddrinfo(%s): %s", host, gai_strerror(retval)); my_exit(6); }-------------------------------------------------------------------------------This document details the conversion of EPIC into an IPv6 program. If thisdocument can be made use to anyone else, they are welcome to it.EPIC is a particularly interesting case study for IPv4 to IPv6 transitionbecause it touches every direction of every domain. It is (obviously)an IPv4 client, but it is also an IPv4 server (DCCs). It is a Unix Domainclient, and it can be a Unix Domain server (but this is not in use).Fortunately for us, all of the networking related code is contained in threesubsystems (/DCC, /SERVER, and /WINDOW CREATE), and five modules: dcc.c,network.c, screen.c, server.c, and wserv.c.EPIC has traditionally retained and stored data on an "ad hoc" basis. Whenevera piece of data is needed, it is retrieved from whatever place is the mostconvenient and stashed away in a variable. This means that some data we keepin multiple places (redundancy). An example: the result of a hostname lookupis an in_addr which we store as the "remote address" of the peer. After theconnect(2), getpeername(2) returns a struct sockaddr which also contains this"remote address". Now we have two copies of the same information. The maintainer then is left to wonder why we have two different copies and whateach copy is to be used for.The first thing to do is take a catalog of all the data items used to storenetworking information. This includes in_addr's, sockaddr's, and what theyare used for and why they are kept. We can then design a more efficientand practical list of data items stored.CATALOG OF IPV4 DATA:---------------------dcc.c=====in_addr DCC_list.remoteu_short DCC_list.remportin_addr DCC_list.local_addru_short DCC_list.local_porthostent dcc_raw_connect.hpin_addr dcc_send_booster_ctcp.myiphostent register_dcc_offer.hostent_fromhostsockaddr_in process_incoming_chat.remaddrsockaddr_in process_incoming_listen.remaddrhostent process_incoming_listen.hpsockaddr_in process_outgoing_file.remaddrsockaddr_in dcc_open.remaddrserver.c/h========in_addr Server.local_addrsockaddr_in Server.local_sockname;sockaddr_in Server.remote_sockname;in_addr Server.uh_addr;sockaddr_in connect_to_server.localaddrsockaddr_in connect_to_server.remaddrin_addr get_server_local_addr (servnum)in_addr get_server_uh_addr (servnum)irc.c=====in_addr LocalHostAddr;hostent parse_args.hpfunctions.c===========in_addr function_iptolong.addrin_addr function_longtoip.addrnetwork.c=========[include here]commands.c==========hostent e_hostname.hpCATALOG OF IPV4 FUNCTION CALLS:-------------------------------inet_aton=========dcc.c register_dcc_offerfunctions.c function_iptolongnetwork.c connect_by_numbernetwork.c lame_external_resolvinet_ntoa=========dcc.c dcc_opendcc.c register_dcc_offerdcc.c process_incoming_chatdcc.c process_incoming_listendcc.c process_outgoing_filefunctions.c function_longtoipgethostbyname=============commands.c e_hostnamedcc.c dcc_raw_connectdcc.c register_dcc_offerirc.c parse_argsnetwork.c lookup_hostgethostbyaddr=============dcc.c process_incoming_listennetwork.c lookup_ip (via resolv() and ip_to_host())
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -