in.h File Reference

#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 Documentation

#define IP_ICMP   1

Definition at line 11 of file in.h.

#define IP_TCP   6

Definition at line 12 of file in.h.

#define IP_UDP   17

Definition at line 13 of file in.h.

Referenced by gdbudp_recv(), and gdbudp_send().

#define IP_ICMP6   58

Definition at line 14 of file in.h.

#define INADDR_NONE   0xffffffff

Definition at line 18 of file in.h.

#define INADDR_BROADCAST   0xffffffff

#define IN_CLASSA ( addr   )     ( ( (addr) & 0x80000000 ) == 0x00000000 )

Definition at line 22 of file in.h.

Referenced by ipv4_create_routes().

#define IN_CLASSA_NET   0xff000000

Definition at line 23 of file in.h.

Referenced by ipv4_create_routes().

#define IN_CLASSB ( addr   )     ( ( (addr) & 0xc0000000 ) == 0x80000000 )

Definition at line 24 of file in.h.

Referenced by ipv4_create_routes().

#define IN_CLASSB_NET   0xffff0000

Definition at line 25 of file in.h.

Referenced by ipv4_create_routes().

#define IN_CLASSC ( addr   )     ( ( (addr) & 0xe0000000 ) == 0xc0000000 )

Definition at line 26 of file in.h.

Referenced by ipv4_create_routes().

#define IN_CLASSC_NET   0xffffff00

Definition at line 27 of file in.h.

Referenced by ipv4_create_routes().

#define IN_MULTICAST ( addr   )     ( ( (addr) & 0xf0000000 ) == 0xe0000000 )

Definition at line 28 of file in.h.

Referenced by ipv4_ll_addr(), and ipv4_tx().

#define s6_addr   in6_u.u6_addr8

Definition at line 48 of file in.h.

#define s6_addr16   in6_u.u6_addr16

Definition at line 49 of file in.h.

#define s6_addr32   in6_u.u6_addr32

Definition at line 50 of file in.h.


Typedef Documentation

typedef struct in_addr in_addr

Definition at line 37 of file in.h.


Function Documentation

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.

Parameters:
in IP address
Return values:
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 * ) &in;
00510         
00511         sprintf ( buf, "%d.%d.%d.%d", bytes[0], bytes[1], bytes[2], bytes[3] );
00512         return buf;
00513 }


Variable Documentation

IPv4 socket address.

IPv6 socket address.


Generated on Tue Apr 6 20:01:50 2010 for gPXE by  doxygen 1.5.7.1