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
8FILE_LICENCE ( GPL2_OR_LATER );
9
12 int rc;
13 struct in_addr addr;
14};
15
21
23 struct sockaddr *sa ) {
24 struct sockaddr_in *sin;
25
26 if ( sa->sa_family == AF_INET ) {
27 sin = ( ( struct sockaddr_in * ) sa );
28 comboot_resolver->addr = sin->sin_addr;
29 }
30}
31
36
39
42};
43
44int 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}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
struct arbelprm_rc_send_wqe rc
Definition arbel.h:3
const char * name
Definition ath9k_hw.c:1986
SYSLINUX COMBOOT.
static void comboot_resolv_close(struct comboot_resolver *comboot_resolver, int rc)
static struct interface_descriptor comboot_resolv_desc
int comboot_resolv(const char *name, struct in_addr *address)
static struct interface_operation comboot_resolv_op[]
static void comboot_resolv_done(struct comboot_resolver *comboot_resolver, struct sockaddr *sa)
uint64_t address
Base address.
Definition ena.h:13
Error codes.
#define AF_INET
IPv4 Internet addresses.
Definition socket.h:64
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define EAFNOSUPPORT
Address family not supported.
Definition errno.h:314
#define EINPROGRESS
Operation in progress.
Definition errno.h:419
void intf_close(struct interface *intf, int rc)
Close an object interface.
Definition interface.c:250
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
Definition interface.c:279
#define INTF_DESC(object_type, intf, operations)
Define an object interface descriptor.
Definition interface.h:81
#define INTF_INIT(descriptor)
Initialise a static object interface.
Definition interface.h:218
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
Definition interface.h:33
Linked lists.
void step(void)
Single-step a single process.
Definition process.c:99
Processes.
void resolv_done(struct interface *intf, struct sockaddr *sa)
Name resolved.
Definition resolv.c:56
int resolv(struct interface *resolv, const char *name, struct sockaddr *sa)
Start name resolution.
Definition resolv.c:258
Name resolution.
struct interface intf
struct in_addr addr
IP address structure.
Definition in.h:42
uint32_t s_addr
Definition in.h:43
An object interface descriptor.
Definition interface.h:56
An object interface operation.
Definition interface.h:18
An object interface.
Definition interface.h:125
IPv4 socket address.
Definition in.h:85
Generalized socket address structure.
Definition socket.h:97
struct sockaddr sa
Definition syslog.c:57
struct sockaddr_in sin
Definition syslog.c:59