#include <stdint.h>#include <gpxe/socket.h>Go to the source code of this file.
Data Structures | |
| struct | in_addr |
| IP address structure. More... | |
| struct | in6_addr |
| IP6 address structure. More... | |
| struct | sockaddr_in |
| IPv4 socket address. More... | |
| struct | sockaddr_in6 |
| IPv6 socket address. More... | |
Defines | |
| #define | IP_ICMP 1 |
| #define | IP_TCP 6 |
| #define | IP_UDP 17 |
| #define | IP_ICMP6 58 |
| #define | INADDR_NONE 0xffffffff |
| #define | INADDR_BROADCAST 0xffffffff |
| #define | IN_CLASSA(addr) ( ( (addr) & 0x80000000 ) == 0x00000000 ) |
| #define | IN_CLASSA_NET 0xff000000 |
| #define | IN_CLASSB(addr) ( ( (addr) & 0xc0000000 ) == 0x80000000 ) |
| #define | IN_CLASSB_NET 0xffff0000 |
| #define | IN_CLASSC(addr) ( ( (addr) & 0xe0000000 ) == 0xc0000000 ) |
| #define | IN_CLASSC_NET 0xffffff00 |
| #define | IN_MULTICAST(addr) ( ( (addr) & 0xf0000000 ) == 0xe0000000 ) |
| #define | s6_addr in6_u.u6_addr8 |
| #define | s6_addr16 in6_u.u6_addr16 |
| #define | s6_addr32 in6_u.u6_addr32 |
Typedefs | |
| typedef struct in_addr | in_addr |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
| int | inet_aton (const char *cp, struct in_addr *inp) |
| char * | inet_ntoa (struct in_addr in) |
| Convert IPv4 address to dotted-quad notation. | |
Variables | |
| struct sockaddr_in | may_alias |
| IPv4 socket address. | |
| #define IP_UDP 17 |
| #define INADDR_BROADCAST 0xffffffff |
Definition at line 20 of file in.h.
Referenced by dhcp_discovery_tx(), dhcp_pxebs_tx(), dhcp_request_tx(), ipv4_ll_addr(), ipv4_route(), ipv4_tx(), and start_pxebs().
| #define IN_CLASSA | ( | addr | ) | ( ( (addr) & 0x80000000 ) == 0x00000000 ) |
| #define IN_CLASSA_NET 0xff000000 |
| #define IN_CLASSB | ( | addr | ) | ( ( (addr) & 0xc0000000 ) == 0x80000000 ) |
| #define IN_CLASSB_NET 0xffff0000 |
| #define IN_CLASSC | ( | addr | ) | ( ( (addr) & 0xe0000000 ) == 0xc0000000 ) |
| #define IN_CLASSC_NET 0xffffff00 |
| #define IN_MULTICAST | ( | addr | ) | ( ( (addr) & 0xf0000000 ) == 0xe0000000 ) |
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
| int inet_aton | ( | const char * | cp, | |
| struct in_addr * | inp | |||
| ) |
Definition at line 16 of file misc.c.
References htonl, in_addr::s_addr, and strtoul().
Referenced by numeric_resolv(), slam_parse_multicast_address(), storef_ipv4(), and tftp_process_multicast().
00016 { 00017 const char *p = cp; 00018 const char *digits_start; 00019 unsigned long ip = 0; 00020 unsigned long val; 00021 int j; 00022 for(j = 0; j <= 3; j++) { 00023 digits_start = p; 00024 val = strtoul(p, ( char ** ) &p, 10); 00025 if ((p == digits_start) || (val > 255)) return 0; 00026 if ( ( j < 3 ) && ( *(p++) != '.' ) ) return 0; 00027 ip = (ip << 8) | val; 00028 } 00029 if ( *p == '\0' ) { 00030 inp->s_addr = htonl(ip); 00031 return 1; 00032 } 00033 return 0; 00034 }
| char* inet_ntoa | ( | struct in_addr | in | ) |
Convert IPv4 address to dotted-quad notation.
| in | IP address |
| string | IP address in dotted-quad notation |
Definition at line 507 of file ipv4.c.
References sprintf.
Referenced by add_ipv4_miniroute(), apply_dns_settings(), boot_next_server_and_filename(), del_ipv4_miniroute(), dhcp_deliver_iob(), dhcp_proxy_rx(), dhcp_proxy_tx(), dhcp_pxebs_accept(), dhcp_pxebs_rx(), dhcp_pxebs_tx(), dhcp_request_rx(), dhcp_request_tx(), dhcp_rx_offer(), dns_xfer_deliver_raw(), efi_snp_mcast_ip_to_mac(), fetchf_ipv4(), ibft_ipaddr(), ipv4_ntoa(), ipv4_rx(), ipv4_tx(), pxe_tftp_open(), pxenv_udp_open(), pxenv_udp_read(), pxenv_udp_write(), pxenv_undi_get_mcast_address(), route(), start_pxebs(), tftp_apply_settings(), and tftp_process_multicast().
00507 { 00508 static char buf[16]; /* "xxx.xxx.xxx.xxx" */ 00509 uint8_t *bytes = ( uint8_t * ) ∈ 00510 00511 sprintf ( buf, "%d.%d.%d.%d", bytes[0], bytes[1], bytes[2], bytes[3] ); 00512 return buf; 00513 }
| struct multiboot_memory_map may_alias |
IPv4 socket address.
IPv6 socket address.
1.5.7.1