iPXE
open.h
Go to the documentation of this file.
1#ifndef _IPXE_OPEN_H
2#define _IPXE_OPEN_H
3
4/** @file
5 *
6 * Data transfer interface opening
7 *
8 */
9
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_SECBOOT ( PERMITTED );
12
13#include <stdarg.h>
14#include <ipxe/tables.h>
15#include <ipxe/socket.h>
16
17struct uri;
18struct interface;
19
20/** Location types */
21enum {
22 /** Location is a URI
23 *
24 * Parameter list for open() is:
25 *
26 * struct uri *uri;
27 */
29 /** Location is a URI string
30 *
31 * Parameter list for open() is:
32 *
33 * const char *uri_string;
34 */
36 /** Location is a socket
37 *
38 * Parameter list for open() is:
39 *
40 * int semantics;
41 * struct sockaddr *peer;
42 * struct sockaddr *local;
43 */
45};
46
47/** A URI opener */
48struct uri_opener {
49 /** URI protocol name
50 *
51 * This is the "scheme" portion of the URI, e.g. "http" or
52 * "file".
53 */
54 const char *scheme;
55 /** Open URI
56 *
57 * @v intf Object interface
58 * @v uri URI
59 * @ret rc Return status code
60 */
61 int ( * open ) ( struct interface *intf, struct uri *uri );
62};
63
64/** URI opener table */
65#define URI_OPENERS __table ( struct uri_opener, "uri_openers" )
66
67/** Register a URI opener */
68#define __uri_opener __table_entry ( URI_OPENERS, 01 )
69
70/** A socket opener */
72 /** Communication semantics (e.g. SOCK_STREAM) */
74 /** Open socket
75 *
76 * @v intf Object interface
77 * @v peer Peer socket address
78 * @v local Local socket address, or NULL
79 * @ret rc Return status code
80 */
81 int ( * open ) ( struct interface *intf, struct sockaddr *peer,
82 struct sockaddr *local );
83};
84
85/** Socket opener table */
86#define SOCKET_OPENERS __table ( struct socket_opener, "socket_openers" )
87
88/** Register a socket opener */
89#define __socket_opener __table_entry ( SOCKET_OPENERS, 01 )
90
91extern struct uri_opener * xfer_uri_opener ( const char *scheme );
92extern int xfer_open_uri ( struct interface *intf, struct uri *uri );
93extern int xfer_open_uri_string ( struct interface *intf,
94 const char *uri_string );
95extern int xfer_open_named_socket ( struct interface *intf, int semantics,
96 struct sockaddr *peer, const char *name,
97 struct sockaddr *local );
98extern int xfer_open_socket ( struct interface *intf, int semantics,
99 struct sockaddr *peer, struct sockaddr *local );
100extern int xfer_vopen ( struct interface *intf, int type, va_list args );
101extern int xfer_open ( struct interface *intf, int type, ... );
102extern int xfer_vreopen ( struct interface *intf, int type,
103 va_list args );
104
105#endif /* _IPXE_OPEN_H */
const char * name
Definition ath9k_hw.c:1986
uint32_t type
Operating system type.
Definition ena.h:1
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
struct mschapv2_challenge peer
Peer challenge.
Definition mschapv2.h:1
int xfer_vreopen(struct interface *intf, int type, va_list args)
Reopen location.
Definition open.c:225
int xfer_open_socket(struct interface *intf, int semantics, struct sockaddr *peer, struct sockaddr *local)
Open socket.
Definition open.c:143
int xfer_open_uri(struct interface *intf, struct uri *uri)
Open URI.
Definition open.c:68
@ LOCATION_SOCKET
Location is a socket.
Definition open.h:44
@ LOCATION_URI
Location is a URI.
Definition open.h:28
@ LOCATION_URI_STRING
Location is a URI string.
Definition open.h:35
int xfer_open(struct interface *intf, int type,...)
Open location.
Definition open.c:203
int xfer_open_named_socket(struct interface *intf, int semantics, struct sockaddr *peer, const char *name, struct sockaddr *local)
Open named socket.
Definition resolv.c:403
int xfer_vopen(struct interface *intf, int type, va_list args)
Open location.
Definition open.c:171
struct uri_opener * xfer_uri_opener(const char *scheme)
Find opener for URI scheme.
Definition open.c:48
int xfer_open_uri_string(struct interface *intf, const char *uri_string)
Open URI string.
Definition open.c:116
Socket addresses.
__builtin_va_list va_list
Definition stdarg.h:7
An object interface.
Definition interface.h:125
Generalized socket address structure.
Definition socket.h:97
A socket opener.
Definition open.h:71
int(* open)(struct interface *intf, struct sockaddr *peer, struct sockaddr *local)
Open socket.
Definition open.h:81
int semantics
Communication semantics (e.g.
Definition open.h:73
A URI opener.
Definition open.h:48
const char * scheme
URI protocol name.
Definition open.h:54
int(* open)(struct interface *intf, struct uri *uri)
Open URI.
Definition open.h:61
A Uniform Resource Identifier.
Definition uri.h:65
Linker tables.