mirror of
https://github.com/ipxe/ipxe
synced 2025-12-20 20:10:18 +03:00
[pxe] Modularise PXE API provision
Use the linker table infrastructure to dispatch PXE API calls to the relevant function. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -159,7 +159,7 @@ static struct pxe_udp_connection pxe_udp = {
|
||||
* parameter.
|
||||
*
|
||||
*/
|
||||
PXENV_EXIT_t pxenv_udp_open ( struct s_PXENV_UDP_OPEN *pxenv_udp_open ) {
|
||||
static PXENV_EXIT_t pxenv_udp_open ( struct s_PXENV_UDP_OPEN *pxenv_udp_open ) {
|
||||
int rc;
|
||||
|
||||
DBG ( "PXENV_UDP_OPEN" );
|
||||
@@ -202,7 +202,8 @@ PXENV_EXIT_t pxenv_udp_open ( struct s_PXENV_UDP_OPEN *pxenv_udp_open ) {
|
||||
* @ref pxe_x86_pmode16 "implementation note" for more details.)
|
||||
*
|
||||
*/
|
||||
PXENV_EXIT_t pxenv_udp_close ( struct s_PXENV_UDP_CLOSE *pxenv_udp_close ) {
|
||||
static PXENV_EXIT_t
|
||||
pxenv_udp_close ( struct s_PXENV_UDP_CLOSE *pxenv_udp_close ) {
|
||||
DBG ( "PXENV_UDP_CLOSE\n" );
|
||||
|
||||
/* Close UDP connection */
|
||||
@@ -253,7 +254,8 @@ PXENV_EXIT_t pxenv_udp_close ( struct s_PXENV_UDP_CLOSE *pxenv_udp_close ) {
|
||||
* parameter.
|
||||
*
|
||||
*/
|
||||
PXENV_EXIT_t pxenv_udp_write ( struct s_PXENV_UDP_WRITE *pxenv_udp_write ) {
|
||||
static PXENV_EXIT_t
|
||||
pxenv_udp_write ( struct s_PXENV_UDP_WRITE *pxenv_udp_write ) {
|
||||
struct sockaddr_in dest;
|
||||
struct xfer_metadata meta = {
|
||||
.src = ( struct sockaddr * ) &pxe_udp.local,
|
||||
@@ -359,7 +361,7 @@ PXENV_EXIT_t pxenv_udp_write ( struct s_PXENV_UDP_WRITE *pxenv_udp_write ) {
|
||||
* expects us to do so, and will fail if we don't.
|
||||
*
|
||||
*/
|
||||
PXENV_EXIT_t pxenv_udp_read ( struct s_PXENV_UDP_READ *pxenv_udp_read ) {
|
||||
static PXENV_EXIT_t pxenv_udp_read ( struct s_PXENV_UDP_READ *pxenv_udp_read ) {
|
||||
struct in_addr dest_ip_wanted = { .s_addr = pxenv_udp_read->dest_ip };
|
||||
struct in_addr dest_ip;
|
||||
uint16_t d_port_wanted = pxenv_udp_read->d_port;
|
||||
@@ -405,3 +407,15 @@ PXENV_EXIT_t pxenv_udp_read ( struct s_PXENV_UDP_READ *pxenv_udp_read ) {
|
||||
pxenv_udp_read->Status = PXENV_STATUS_FAILURE;
|
||||
return PXENV_EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/** PXE UDP API */
|
||||
struct pxe_api_call pxe_udp_api[] __pxe_api_call = {
|
||||
PXE_API_CALL ( PXENV_UDP_OPEN, pxenv_udp_open,
|
||||
struct s_PXENV_UDP_OPEN ),
|
||||
PXE_API_CALL ( PXENV_UDP_CLOSE, pxenv_udp_close,
|
||||
struct s_PXENV_UDP_CLOSE ),
|
||||
PXE_API_CALL ( PXENV_UDP_WRITE, pxenv_udp_write,
|
||||
struct s_PXENV_UDP_WRITE ),
|
||||
PXE_API_CALL ( PXENV_UDP_READ, pxenv_udp_read,
|
||||
struct s_PXENV_UDP_READ ),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user