6 * Data transfer interface opening
10 FILE_LICENCE ( GPL2_OR_LATER
);
13 #include <gpxe/tables.h>
14 #include <gpxe/socket.h>
16 struct xfer_interface
;
23 * Parameter list for open() is:
28 /** Location is a URI string
30 * Parameter list for open() is:
32 * const char *uri_string;
35 /** Location is a socket
37 * Parameter list for open() is:
40 * struct sockaddr *peer;
41 * struct sockaddr *local;
50 * This is the "scheme" portion of the URI, e.g. "http" or
56 * @v xfer Data transfer interface
58 * @ret rc Return status code
60 int ( * open
) ( struct xfer_interface
*xfer
, struct uri
*uri
);
63 /** URI opener table */
64 #define URI_OPENERS __table ( struct uri_opener, "uri_openers" )
66 /** Register a URI opener */
67 #define __uri_opener __table_entry ( URI_OPENERS, 01 )
69 /** A socket opener */
70 struct socket_opener
{
71 /** Communication semantics (e.g. SOCK_STREAM) */
73 /** Address family (e.g. AF_INET) */
77 * @v xfer Data transfer interface
78 * @v peer Peer socket address
79 * @v local Local socket address, or NULL
80 * @ret rc Return status code
82 int ( * open
) ( struct xfer_interface
*xfer
, struct sockaddr
*peer
,
83 struct sockaddr
*local
);
86 /** Socket opener table */
87 #define SOCKET_OPENERS __table ( struct socket_opener, "socket_openers" )
89 /** Register a socket opener */
90 #define __socket_opener __table_entry ( SOCKET_OPENERS, 01 )
92 extern int xfer_open_uri ( struct xfer_interface
*xfer
, struct uri
*uri
);
93 extern int xfer_open_uri_string ( struct xfer_interface
*xfer
,
94 const char *uri_string
);
95 extern int xfer_open_named_socket ( struct xfer_interface
*xfer
,
96 int semantics
, struct sockaddr
*peer
,
97 const char *name
, struct sockaddr
*local
);
98 extern int xfer_open_socket ( struct xfer_interface
*xfer
, int semantics
,
99 struct sockaddr
*peer
, struct sockaddr
*local
);
100 extern int xfer_vopen ( struct xfer_interface
*xfer
, int type
, va_list args
);
101 extern int xfer_open ( struct xfer_interface
*xfer
, int type
, ... );
102 extern int xfer_vreopen ( struct xfer_interface
*xfer
, int type
,
105 #endif /* _GPXE_OPEN_H */