iPXE
comboot_resolv.c
Go to the documentation of this file.
1 #include <errno.h>
2 #include <comboot.h>
3 #include <ipxe/in.h>
4 #include <ipxe/list.h>
5 #include <ipxe/process.h>
6 #include <ipxe/resolv.h>
7 
8 FILE_LICENCE ( GPL2_OR_LATER );
9 
11  struct interface intf;
12  int rc;
13  struct in_addr addr;
14 };
15 
17  int rc ) {
20 }
21 
23  struct sockaddr *sa ) {
24  struct sockaddr_in *sin;
25 
26  if ( sa->sa_family == AF_INET ) {
27  sin = ( ( struct sockaddr_in * ) sa );
29  }
30 }
31 
35 };
36 
39 
42 };
43 
44 int comboot_resolv ( const char *name, struct in_addr *address ) {
45  int rc;
46 
49 
50  if ( ( rc = resolv ( &comboot_resolver.intf, name, NULL ) ) != 0 )
51  return rc;
52 
53  while ( comboot_resolver.rc == -EINPROGRESS )
54  step();
55 
57  return -EAFNOSUPPORT;
58 
60  return comboot_resolver.rc;
61 }
An object interface operation.
Definition: interface.h:17
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
const char * name
Definition: ath9k_hw.c:1984
void intf_close(struct interface *intf, int rc)
Close an object interface.
Definition: interface.c:244
static struct interface_operation comboot_resolv_op[]
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
Definition: interface.c:273
struct sockaddr sa
Definition: dns.c:68
void resolv_done(struct interface *intf, struct sockaddr *sa)
Name resolved.
Definition: resolv.c:55
Error codes.
Name resolution.
uint64_t address
Base address.
Definition: ena.h:24
#define INTF_INIT(descriptor)
Initialise a static object interface.
Definition: interface.h:187
sa_family_t sa_family
Socket address family.
Definition: socket.h:101
SYSLINUX COMBOOT.
IPv4 socket address.
Definition: in.h:82
FILE_LICENCE(GPL2_OR_LATER)
static void comboot_resolv_done(struct comboot_resolver *comboot_resolver, struct sockaddr *sa)
static struct interface_descriptor comboot_resolv_desc
#define EAFNOSUPPORT
Address family not supported.
Definition: errno.h:313
An object interface.
Definition: interface.h:109
struct sockaddr_in sin
Definition: dns.c:70
#define EINPROGRESS
Operation in progress.
Definition: errno.h:418
Linked lists.
Generalized socket address structure.
Definition: socket.h:96
An object interface descriptor.
Definition: interface.h:40
IP address structure.
Definition: in.h:39
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
Definition: interface.h:32
struct in_addr addr
Processes.
static void comboot_resolv_close(struct comboot_resolver *comboot_resolver, int rc)
uint32_t s_addr
Definition: in.h:40
int comboot_resolv(const char *name, struct in_addr *address)
struct in_addr sin_addr
IPv4 address.
Definition: in.h:98
#define INTF_DESC(object_type, intf, operations)
Define an object interface descriptor.
Definition: interface.h:65
void step(void)
Single-step a single process.
Definition: process.c:98
struct interface intf
int resolv(struct interface *resolv, const char *name, struct sockaddr *sa)
Start name resolution.
Definition: resolv.c:257
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
#define AF_INET
IPv4 Internet addresses.
Definition: socket.h:63